mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2025-01-06 14:26:35 +03:00
Remove unused code.
This commit is contained in:
parent
0d7620935f
commit
09402d13c2
@ -260,10 +260,10 @@ function webpackOptions(
|
||||
/assets\//
|
||||
],
|
||||
swDest: "service-worker.js"
|
||||
})
|
||||
}),
|
||||
// comment this out to do performance profiling
|
||||
// (drag-and-drop `events.json` file into Chrome performance tab)
|
||||
// , new webpack.debug.ProfilingPlugin()
|
||||
// new webpack.debug.ProfilingPlugin()
|
||||
],
|
||||
output: {},
|
||||
resolve: {
|
||||
@ -413,10 +413,7 @@ function webpackOptions(
|
||||
}
|
||||
|
||||
function hmrClientPath() {
|
||||
// return require.resolve("webpack-hot-middleware/client");
|
||||
var ansiColors = {
|
||||
// red: 'FF0000' // note the lack of "#"
|
||||
// reset: ['ffffff', '0000000'], // [FOREGROUD_COLOR, BACKGROUND_COLOR]
|
||||
reset: ['ffffff', 'transparent'], // [FOREGROUD_COLOR, BACKGROUND_COLOR]
|
||||
black: '000',
|
||||
red: 'c91b00',
|
||||
@ -431,7 +428,6 @@ function hmrClientPath() {
|
||||
var overlayStyles = {
|
||||
// options from https://github.com/webpack-contrib/webpack-hot-middleware/blob/master/client-overlay.js
|
||||
|
||||
// color: '#FF0000' // note the inclusion of "#" (these options would be the equivalent of div.style[option] = value)
|
||||
background: 'rgba(0,0,0,0.90)',
|
||||
color: '#e8e8e8',
|
||||
lineHeight: '1.6',
|
||||
|
@ -8,29 +8,10 @@ const globby = require("globby");
|
||||
|
||||
module.exports = class PluginGenerateElmPagesBuild {
|
||||
constructor() {
|
||||
this.value = 1;
|
||||
}
|
||||
|
||||
apply(/** @type {webpack.Compiler} */ compiler) {
|
||||
compiler.hooks.afterEmit.tap('DoneMsg', () => {
|
||||
console.log('---> DONE!');
|
||||
|
||||
})
|
||||
|
||||
compiler.hooks.beforeCompile.tap('PluginGenerateElmPagesBuild', (compilation) => {
|
||||
// compiler.hooks.thisCompilation.tap('PluginGenerateElmPagesBuild', (compilation) => {
|
||||
|
||||
// compilation.contextDependencies.add('content')
|
||||
// compiler.hooks.thisCompilation.tap('ThisCompilation', (compilation) => {
|
||||
console.log('----> PluginGenerateElmPagesBuild');
|
||||
const src = `module Example exposing (..)
|
||||
|
||||
value : Int
|
||||
value = ${this.value++}
|
||||
`
|
||||
// console.log('@@@ Writing EXAMPLE module');
|
||||
// fs.writeFileSync(path.join(process.cwd(), './src/Example.elm'), src);
|
||||
|
||||
const staticRoutes = generateRecords();
|
||||
|
||||
const markdownContent = globby
|
||||
@ -40,10 +21,6 @@ value = ${this.value++}
|
||||
return parseMarkdown(path, contents);
|
||||
});
|
||||
|
||||
const images = globby
|
||||
.sync("images/**/*", {})
|
||||
.filter(imagePath => !fs.lstatSync(imagePath).isDirectory());
|
||||
|
||||
let resolvePageRequests;
|
||||
let rejectPageRequests;
|
||||
global.pagesWithRequests = new Promise(function (resolve, reject) {
|
||||
@ -56,8 +33,7 @@ value = ${this.value++}
|
||||
staticRoutes,
|
||||
markdownContent
|
||||
).then((payload) => {
|
||||
console.log('PROMISE RESOLVED doCliStuff');
|
||||
|
||||
// console.log('PROMISE RESOLVED doCliStuff');
|
||||
|
||||
resolvePageRequests(payload);
|
||||
global.filesToGenerate = payload.filesToGenerate;
|
||||
@ -66,13 +42,6 @@ value = ${this.value++}
|
||||
resolvePageRequests({ type: 'error', message: errorPayload });
|
||||
})
|
||||
|
||||
|
||||
// compilation.assets['./src/Example.elm'] = {
|
||||
// source: () => src,
|
||||
// size: () => src.length
|
||||
// };
|
||||
// callback()
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
|
46
index.js
46
index.js
@ -90,67 +90,27 @@ function loadContentAndInitializeApp(/** @type { init: any } */ mainElmModule)
|
||||
// heartbeat
|
||||
} else {
|
||||
const obj = JSON.parse(event.data)
|
||||
console.log('obj.action', obj.action);
|
||||
// console.log('obj.action', obj.action);
|
||||
|
||||
if (obj.action === 'building') {
|
||||
app.ports.fromJsPort.send({ thingy: 'hmr-check' });
|
||||
} else if (obj.action === 'built') {
|
||||
// console.log('built -- fetching');
|
||||
// console.log('httpGet start');
|
||||
|
||||
let currentPath = window.location.pathname.replace(/(\w)$/, "$1/")
|
||||
httpGet(`${window.location.origin}${currentPath}content.json`).then(function (/** @type JSON */ contentJson) {
|
||||
// console.log('httpGet response', contentJson);
|
||||
// console.log('httpGet received');
|
||||
|
||||
app.ports.fromJsPort.send({ contentJson: contentJson });
|
||||
// success()
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
// module.hot.addStatusHandler(function (status) {
|
||||
// console.log('HMR', status)
|
||||
// if (status === 'idle') {
|
||||
|
||||
// // httpGet(`${window.location.origin}${path}content.json`).then(function (/** @type JSON */ contentJson) {
|
||||
// // // console.log('hot contentJson', contentJson);
|
||||
|
||||
// // app.ports.fromJsPort.send({ contentJson: contentJson });
|
||||
// // });
|
||||
// // console.log('Reloaded!!!!!!!!!!', status)
|
||||
// } else if (status === 'check') {
|
||||
|
||||
// console.log('sending', { thingy: 'hmr-check' });
|
||||
|
||||
// app.ports.fromJsPort.send({ thingy: 'hmr-check' });
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
|
||||
|
||||
// found this trick from https://github.com/roots/sage/issues/1826
|
||||
// module.hot.addStatusHandler(function (status) { /* handle status */}) works, but after several saves
|
||||
// it stops working for some reason. So this is a workaround to work even when those updates stop coming through
|
||||
// const reporter = window.__webpack_hot_middleware_reporter__
|
||||
// console.log('reporter keys', reporter);
|
||||
|
||||
// const success = reporter.success
|
||||
// reporter.success = function () {
|
||||
// console.log('SUCCESS');
|
||||
// let currentPath = window.location.pathname.replace(/(\w)$/, "$1/")
|
||||
// httpGet(`${window.location.origin}${currentPath}content.json`).then(function (/** @type JSON */ contentJson) {
|
||||
// // console.log('hot contentJson', contentJson);
|
||||
|
||||
// app.ports.fromJsPort.send({ contentJson: contentJson });
|
||||
// success()
|
||||
// });
|
||||
// }
|
||||
|
||||
|
||||
return app
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user