@embroider/webpack 1.6.0 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embroider/webpack",
3
- "version": "1.6.0",
3
+ "version": "1.8.0",
4
4
  "private": false,
5
5
  "description": "Builds EmberJS apps with Webpack",
6
6
  "repository": {
@@ -23,9 +23,9 @@
23
23
  "@babel/core": "^7.14.5",
24
24
  "@babel/plugin-proposal-nullish-coalescing-operator": "^7.14.5",
25
25
  "@babel/plugin-proposal-optional-chaining": "^7.14.5",
26
- "@embroider/babel-loader-8": "1.6.0",
27
- "@embroider/hbs-loader": "1.6.0",
28
- "@embroider/shared-internals": "1.6.0",
26
+ "@embroider/babel-loader-8": "1.8.0",
27
+ "@embroider/hbs-loader": "1.8.0",
28
+ "@embroider/shared-internals": "1.8.0",
29
29
  "@types/source-map": "^0.5.7",
30
30
  "@types/supports-color": "^8.1.0",
31
31
  "babel-loader": "^8.2.2",
@@ -54,7 +54,7 @@
54
54
  "webpack": "^5.38.1"
55
55
  },
56
56
  "peerDependencies": {
57
- "@embroider/core": "1.6.0",
57
+ "@embroider/core": "1.8.0",
58
58
  "webpack": "^5.0.0"
59
59
  },
60
60
  "engines": {
@@ -11,7 +11,11 @@
11
11
  */
12
12
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
13
13
  if (k2 === undefined) k2 = k;
14
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
14
+ var desc = Object.getOwnPropertyDescriptor(m, k);
15
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
16
+ desc = { enumerable: true, get: function() { return m[k]; } };
17
+ }
18
+ Object.defineProperty(o, k2, desc);
15
19
  }) : (function(o, m, k, k2) {
16
20
  if (k2 === undefined) k2 = k;
17
21
  o[k2] = m[k];
@@ -56,6 +60,40 @@ function equalAppInfo(left, right) {
56
60
  left.entrypoints.length === right.entrypoints.length &&
57
61
  left.entrypoints.every((e, index) => (0, isEqual_1.default)(e.modules, right.entrypoints[index].modules)));
58
62
  }
63
+ function createBarrier() {
64
+ const barriers = [];
65
+ let done = true;
66
+ let limit = 0;
67
+ return [begin, increment];
68
+ function begin(newLimit) {
69
+ if (!done)
70
+ flush(new Error('begin called before limit reached'));
71
+ done = false;
72
+ limit = newLimit;
73
+ }
74
+ async function increment() {
75
+ if (done) {
76
+ throw new Error('increment after limit reach');
77
+ }
78
+ const promise = new Promise((resolve, reject) => {
79
+ barriers.push([resolve, reject]);
80
+ });
81
+ if (barriers.length === limit) {
82
+ flush();
83
+ }
84
+ await promise;
85
+ }
86
+ function flush(err) {
87
+ for (const [resolve, reject] of barriers) {
88
+ if (err)
89
+ reject(err);
90
+ else
91
+ resolve();
92
+ }
93
+ barriers.length = 0;
94
+ done = true;
95
+ }
96
+ }
59
97
  // we want to ensure that not only does our instance conform to
60
98
  // PackagerInstance, but our constructor conforms to Packager. So instead of
61
99
  // just exporting our class directly, we export a const constructor of the
@@ -76,13 +114,26 @@ const Webpack = (_a = class Webpack {
76
114
  this.extraBabelLoaderOptions = options === null || options === void 0 ? void 0 : options.babelLoaderOptions;
77
115
  this.extraCssLoaderOptions = options === null || options === void 0 ? void 0 : options.cssLoaderOptions;
78
116
  this.extraStyleLoaderOptions = options === null || options === void 0 ? void 0 : options.styleLoaderOptions;
117
+ [this.beginBarrier, this.incrementBarrier] = createBarrier();
79
118
  warmUp(this.extraThreadLoaderOptions);
80
119
  }
120
+ get bundleSummary() {
121
+ let bundleSummary = this._bundleSummary;
122
+ if (bundleSummary === undefined) {
123
+ this._bundleSummary = bundleSummary = {
124
+ entrypoints: new Map(),
125
+ lazyBundles: new Map(),
126
+ variants: this.variants,
127
+ };
128
+ }
129
+ return bundleSummary;
130
+ }
81
131
  async build() {
132
+ this._bundleSummary = undefined;
133
+ this.beginBarrier(this.variants.length);
82
134
  let appInfo = this.examineApp();
83
135
  let webpack = this.getWebpack(appInfo);
84
- let stats = this.summarizeStats(await this.runWebpack(webpack));
85
- await this.writeFiles(stats, appInfo);
136
+ await this.runWebpack(webpack);
86
137
  }
87
138
  examineApp() {
88
139
  let meta = (0, core_1.getAppMeta)(this.pathToVanillaApp);
@@ -102,7 +153,8 @@ const Webpack = (_a = class Webpack {
102
153
  }
103
154
  return { entrypoints, otherAssets, babel, rootURL, resolvableExtensions, publicAssetURL };
104
155
  }
105
- configureWebpack({ entrypoints, babel, resolvableExtensions, publicAssetURL }, variant) {
156
+ configureWebpack(appInfo, variant, variantIndex) {
157
+ const { entrypoints, babel, resolvableExtensions, publicAssetURL } = appInfo;
106
158
  let entry = {};
107
159
  for (let entrypoint of entrypoints) {
108
160
  for (let moduleName of entrypoint.modules) {
@@ -117,7 +169,15 @@ const Webpack = (_a = class Webpack {
117
169
  performance: {
118
170
  hints: false,
119
171
  },
120
- plugins: stylePlugins,
172
+ plugins: [
173
+ ...stylePlugins,
174
+ compiler => {
175
+ compiler.hooks.done.tapPromise('EmbroiderPlugin', async (stats) => {
176
+ this.summarizeStats(stats, variant, variantIndex);
177
+ await this.writeFiles(this.bundleSummary, appInfo, variantIndex);
178
+ });
179
+ },
180
+ ],
121
181
  node: false,
122
182
  module: {
123
183
  rules: [
@@ -146,10 +206,10 @@ const Webpack = (_a = class Webpack {
146
206
  ],
147
207
  },
148
208
  output: {
149
- path: (0, path_1.join)(this.outputPath, 'assets'),
150
- filename: `chunk.[chunkhash].js`,
151
- chunkFilename: `chunk.[chunkhash].js`,
152
- publicPath: publicAssetURL + 'assets/',
209
+ path: (0, path_1.join)(this.outputPath),
210
+ filename: `assets/chunk.[chunkhash].js`,
211
+ chunkFilename: `assets/chunk.[chunkhash].js`,
212
+ publicPath: publicAssetURL,
153
213
  },
154
214
  optimization: {
155
215
  splitChunks: {
@@ -178,7 +238,7 @@ const Webpack = (_a = class Webpack {
178
238
  return this.lastWebpack;
179
239
  }
180
240
  debug(`configuring webpack`);
181
- let config = this.variants.map(variant => (0, mergeWith_1.default)({}, this.configureWebpack(appInfo, variant), this.extraConfig, appendArrays));
241
+ let config = this.variants.map((variant, variantIndex) => (0, mergeWith_1.default)({}, this.configureWebpack(appInfo, variant, variantIndex), this.extraConfig, appendArrays));
182
242
  this.lastAppInfo = appInfo;
183
243
  return (this.lastWebpack = (0, webpack_1.default)(config));
184
244
  }
@@ -243,7 +303,7 @@ const Webpack = (_a = class Webpack {
243
303
  throw err;
244
304
  }
245
305
  }
246
- async writeFiles(stats, { entrypoints, otherAssets }) {
306
+ async writeFiles(stats, { entrypoints, otherAssets }, variantIndex) {
247
307
  // we're doing this ourselves because I haven't seen a webpack 4 HTML plugin
248
308
  // that handles multiple HTML entrypoints correctly.
249
309
  let written = new Set();
@@ -254,10 +314,12 @@ const Webpack = (_a = class Webpack {
254
314
  await this.provideErrorContext('needed by %s', [entrypoint.filename], async () => {
255
315
  for (let script of entrypoint.scripts) {
256
316
  if (!stats.entrypoints.has(script)) {
317
+ const mapping = [];
257
318
  try {
258
319
  // zero here means we always attribute passthrough scripts to the
259
320
  // first build variant
260
- stats.entrypoints.set(script, new Map([[0, [await this.writeScript(script, written, this.variants[0])]]]));
321
+ stats.entrypoints.set(script, new Map([[0, mapping]]));
322
+ mapping.push(await this.writeScript(script, written, this.variants[0]));
261
323
  }
262
324
  catch (err) {
263
325
  if (err.code === 'ENOENT' && err.path === (0, path_1.join)(this.pathToVanillaApp, script)) {
@@ -273,10 +335,12 @@ const Webpack = (_a = class Webpack {
273
335
  }
274
336
  for (let style of entrypoint.styles) {
275
337
  if (!stats.entrypoints.has(style)) {
338
+ const mapping = [];
276
339
  try {
277
340
  // zero here means we always attribute passthrough styles to the
278
341
  // first build variant
279
- stats.entrypoints.set(style, new Map([[0, [await this.writeStyle(style, written, this.variants[0])]]]));
342
+ stats.entrypoints.set(style, new Map([[0, mapping]]));
343
+ mapping.push(await this.writeStyle(style, written, this.variants[0]));
280
344
  }
281
345
  catch (err) {
282
346
  if (err.code === 'ENOENT' && err.path === (0, path_1.join)(this.pathToVanillaApp, style)) {
@@ -292,12 +356,18 @@ const Webpack = (_a = class Webpack {
292
356
  }
293
357
  });
294
358
  }
295
- for (let entrypoint of entrypoints) {
296
- (0, fs_extra_1.outputFileSync)((0, path_1.join)(this.outputPath, entrypoint.filename), entrypoint.render(stats), 'utf8');
297
- written.add(entrypoint.filename);
359
+ // we need to wait for both compilers before writing html entrypoint
360
+ await this.incrementBarrier();
361
+ // only the first variant should write it.
362
+ if (variantIndex === 0) {
363
+ for (let entrypoint of entrypoints) {
364
+ (0, fs_extra_1.outputFileSync)((0, path_1.join)(this.outputPath, entrypoint.filename), entrypoint.render(stats), 'utf8');
365
+ written.add(entrypoint.filename);
366
+ }
298
367
  }
299
368
  for (let relativePath of otherAssets) {
300
369
  if (!written.has(relativePath)) {
370
+ written.add(relativePath);
301
371
  await this.provideErrorContext(`while copying app's assets`, [], async () => {
302
372
  this.copyThrough(relativePath);
303
373
  });
@@ -322,44 +392,35 @@ const Webpack = (_a = class Webpack {
322
392
  fileParts.splice(fileParts.length - 1, 0, hash);
323
393
  return fileParts.join('.');
324
394
  }
325
- summarizeStats(multiStats) {
326
- let output = {
327
- entrypoints: new Map(),
328
- lazyBundles: new Map(),
329
- variants: this.variants,
330
- };
331
- for (let [variantIndex, variant] of this.variants.entries()) {
332
- let { entrypoints, chunks } = multiStats.stats[variantIndex].toJson({
333
- all: false,
334
- entrypoints: true,
335
- chunks: true,
336
- });
337
- // webpack's types are written rather loosely, implying that these two
338
- // properties may not be present. They really always are, as far as I can
339
- // tell, but we need to check here anyway to satisfy the type checker.
340
- if (!entrypoints) {
341
- throw new Error(`unexpected webpack output: no entrypoints`);
395
+ summarizeStats(stats, variant, variantIndex) {
396
+ let output = this.bundleSummary;
397
+ let { entrypoints, chunks } = stats.toJson({
398
+ all: false,
399
+ entrypoints: true,
400
+ chunks: true,
401
+ });
402
+ // webpack's types are written rather loosely, implying that these two
403
+ // properties may not be present. They really always are, as far as I can
404
+ // tell, but we need to check here anyway to satisfy the type checker.
405
+ if (!entrypoints) {
406
+ throw new Error(`unexpected webpack output: no entrypoints`);
407
+ }
408
+ if (!chunks) {
409
+ throw new Error(`unexpected webpack output: no chunks`);
410
+ }
411
+ for (let id of Object.keys(entrypoints)) {
412
+ let { assets: entrypointAssets } = entrypoints[id];
413
+ if (!entrypointAssets) {
414
+ throw new Error(`unexpected webpack output: no entrypoint.assets`);
342
415
  }
343
- if (!chunks) {
344
- throw new Error(`unexpected webpack output: no chunks`);
345
- }
346
- for (let id of Object.keys(entrypoints)) {
347
- let { assets: entrypointAssets } = entrypoints[id];
348
- if (!entrypointAssets) {
349
- throw new Error(`unexpected webpack output: no entrypoint.assets`);
350
- }
351
- (0, core_1.getOrCreate)(output.entrypoints, id, () => new Map()).set(variantIndex, entrypointAssets.map(asset => 'assets/' + asset.name));
352
- if (variant.runtime !== 'browser') {
353
- // in the browser we don't need to worry about lazy assets (they will be
354
- // handled automatically by webpack as needed), but in any other runtime
355
- // we need the ability to preload them
356
- output.lazyBundles.set(id, (0, flatMap_1.default)(chunks.filter(chunk => { var _a; return (_a = chunk.runtime) === null || _a === void 0 ? void 0 : _a.includes(id); }), chunk => chunk.files)
357
- .filter(file => !(entrypointAssets === null || entrypointAssets === void 0 ? void 0 : entrypointAssets.find(a => a.name === file)))
358
- .map(file => `assets/${file}`));
359
- }
416
+ (0, core_1.getOrCreate)(output.entrypoints, id, () => new Map()).set(variantIndex, entrypointAssets.map(asset => asset.name));
417
+ if (variant.runtime !== 'browser') {
418
+ // in the browser we don't need to worry about lazy assets (they will be
419
+ // handled automatically by webpack as needed), but in any other runtime
420
+ // we need the ability to preload them
421
+ output.lazyBundles.set(id, (0, flatMap_1.default)(chunks.filter(chunk => { var _a; return (_a = chunk.runtime) === null || _a === void 0 ? void 0 : _a.includes(id); }), chunk => chunk.files).filter(file => !(entrypointAssets === null || entrypointAssets === void 0 ? void 0 : entrypointAssets.find(a => a.name === file))));
360
422
  }
361
423
  }
362
- return output;
363
424
  }
364
425
  runWebpack(webpack) {
365
426
  return new Promise((resolve, reject) => {
@@ -400,14 +461,19 @@ const Webpack = (_a = class Webpack {
400
461
  setupStyleConfig(variant) {
401
462
  let cssLoader = {
402
463
  loader: 'css-loader',
403
- options: Object.assign({ url: true, import: true, modules: 'global' }, this.extraCssLoaderOptions),
464
+ options: {
465
+ url: true,
466
+ import: true,
467
+ modules: 'global',
468
+ ...this.extraCssLoaderOptions,
469
+ },
404
470
  };
405
471
  if (!variant.optimizeForProduction && variant.runtime === 'browser') {
406
472
  // in development builds that only need to work in the browser (not
407
473
  // fastboot), we can use style-loader because it's fast
408
474
  return {
409
475
  loaders: [
410
- { loader: 'style-loader', options: Object.assign({ injectType: 'styleTag' }, this.extraStyleLoaderOptions) },
476
+ { loader: 'style-loader', options: { injectType: 'styleTag', ...this.extraStyleLoaderOptions } },
411
477
  cssLoader,
412
478
  ],
413
479
  plugins: [],
@@ -419,8 +485,8 @@ const Webpack = (_a = class Webpack {
419
485
  loaders: [mini_css_extract_plugin_1.default.loader, cssLoader],
420
486
  plugins: [
421
487
  new mini_css_extract_plugin_1.default({
422
- filename: `chunk.[chunkhash].css`,
423
- chunkFilename: `chunk.[chunkhash].css`,
488
+ filename: `assets/chunk.[chunkhash].css`,
489
+ chunkFilename: `assets/chunk.[chunkhash].css`,
424
490
  // in the browser, MiniCssExtractPlugin can manage it's own runtime
425
491
  // lazy loading of stylesheets.
426
492
  //
@@ -466,12 +532,21 @@ const threadLoaderOptions = {
466
532
  // keeping workers alive always.
467
533
  poolTimeout: Infinity,
468
534
  };
535
+ function canUseThreadLoader(extraOptions) {
536
+ // If the environment sets JOBS to 0, or if our extraOptions are set to false,
537
+ // we have been explicitly configured not to use thread-loader
538
+ if (process.env.JOBS === '0' || extraOptions === false) {
539
+ return false;
540
+ }
541
+ else {
542
+ return true;
543
+ }
544
+ }
469
545
  function warmUp(extraOptions) {
470
- // We don't know if we'll be parallel-safe or not, but if the environment sets
471
- // JOBS to 0, or our extraOptions are set to false, we know we won't use
472
- // thread-loader, so no need to consume extra resources warming the worker
473
- // pool
474
- if (process.env.JOBS === '1' || extraOptions === false) {
546
+ // We don't know if we'll be parallel-safe or not, but if we've been
547
+ // configured to not use thread-loader, then there is no need to consume extra
548
+ // resources warming the worker pool
549
+ if (!canUseThreadLoader(extraOptions)) {
475
550
  return null;
476
551
  }
477
552
  (0, thread_loader_1.warmup)(Object.assign({}, threadLoaderOptions, extraOptions), [
@@ -480,7 +555,7 @@ function warmUp(extraOptions) {
480
555
  ]);
481
556
  }
482
557
  function maybeThreadLoader(isParallelSafe, extraOptions) {
483
- if (process.env.JOBS === '0' || extraOptions === false || !isParallelSafe) {
558
+ if (!canUseThreadLoader(extraOptions) || !isParallelSafe) {
484
559
  return null;
485
560
  }
486
561
  return {
@@ -503,9 +578,12 @@ function nonNullArray(array) {
503
578
  }
504
579
  function babelLoaderOptions(_majorVersion, variant, appBabelConfigPath, extraOptions) {
505
580
  const cacheDirectory = (0, core_1.getPackagerCacheDir)('webpack-babel-loader');
506
- const options = Object.assign({ variant,
581
+ const options = {
582
+ variant,
507
583
  appBabelConfigPath,
508
- cacheDirectory }, extraOptions);
584
+ cacheDirectory,
585
+ ...extraOptions,
586
+ };
509
587
  return {
510
588
  loader: 'babel-loader-8',
511
589
  options,
@@ -1 +1 @@
1
- {"version":3,"file":"ember-webpack.js","sourceRoot":"","sources":["ember-webpack.ts"],"names":[],"mappings":";AAAA;;;;;;;;;EASE;;;;;;;;;;;;;;;;;;;;;;;;;;AAEF,0CAUyB;AACzB,kEAAqD;AACrD,sDAAwF;AACxF,uCAA+G;AAC/G,+BAAoD;AACpD,6DAAqC;AACrC,iEAAyC;AACzC,6DAAqC;AACrC,sFAA2D;AAC3D,kDAA8B;AAC9B,+BAA8B;AAC9B,iDAA6D;AAE7D,oDAA4B;AAC5B,2EAAyD;AACzD,oEAA2C;AAE3C,MAAM,KAAK,GAAG,IAAA,eAAS,EAAC,iBAAiB,CAAC,CAAC;AAgB3C,gEAAgE;AAChE,SAAS,YAAY,CAA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C;AAClC,CAAC;AAED,+EAA+E;AAC/E,QAAQ;AACR,SAAS,YAAY,CAAI,KAAU;IACjC,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,CAAqB,CAAC;AACnD,CAAC;AAED,SAAS,kBAAkB,CACzB,aAAgB,EAChB,OAAgB,EAChB,kBAA0B,EAC1B,YAA4C;IAE5C,MAAM,cAAc,GAAG,IAAA,0BAAmB,EAAC,sBAAsB,CAAC,CAAC;IACnE,MAAM,OAAO,mBACX,OAAO;QACP,kBAAkB;QAClB,cAAc,IACX,YAAY,CAChB,CAAC;IACF,OAAO;QACL,MAAM,EAAE,gBAAgB;QACxB,OAAO;KACR,CAAC;AACJ,CAAC","sourcesContent":["/*\n Most of the work this module does is putting an HTML-oriented facade around\n Webpack. That is, we want both the input and output to be primarily HTML files\n with proper spec semantics, and we use webpack to optimize the assets referred\n to by those files.\n\n While there are webpack plugins for handling HTML, none of them handle\n multiple HTML entrypoints and apply correct HTML semantics (for example,\n getting script vs module context correct).\n*/\n\nimport {\n AppMeta,\n HTMLEntrypoint,\n BundleSummary,\n Packager,\n PackagerConstructor,\n Variant,\n getAppMeta,\n getPackagerCacheDir,\n getOrCreate,\n} from '@embroider/core';\nimport { tmpdir } from '@embroider/shared-internals';\nimport webpack, { Configuration, RuleSetUseItem, WebpackPluginInstance } from 'webpack';\nimport { readFileSync, outputFileSync, copySync, realpathSync, Stats, statSync, readJsonSync } from 'fs-extra';\nimport { join, dirname, relative, sep } from 'path';\nimport isEqual from 'lodash/isEqual';\nimport mergeWith from 'lodash/mergeWith';\nimport flatMap from 'lodash/flatMap';\nimport MiniCssExtractPlugin from 'mini-css-extract-plugin';\nimport makeDebug from 'debug';\nimport { format } from 'util';\nimport { warmup as threadLoaderWarmup } from 'thread-loader';\nimport { Options, BabelLoaderOptions } from './options';\nimport crypto from 'crypto';\nimport semverSatisfies from 'semver/functions/satisfies';\nimport supportsColor from 'supports-color';\n\nconst debug = makeDebug('embroider:debug');\n\n// This is a type-only import, so it gets compiled away. At runtime, we load\n// terser lazily so it's only loaded for production builds that use it. Don't\n// add any non-type-only imports here.\nimport type { MinifyOptions } from 'terser';\n\ninterface AppInfo {\n entrypoints: HTMLEntrypoint[];\n otherAssets: string[];\n babel: AppMeta['babel'];\n rootURL: AppMeta['root-url'];\n publicAssetURL: string;\n resolvableExtensions: AppMeta['resolvable-extensions'];\n}\n\n// AppInfos are equal if they result in the same webpack config.\nfunction equalAppInfo(left: AppInfo, right: AppInfo): boolean {\n return (\n isEqual(left.babel, right.babel) &&\n left.entrypoints.length === right.entrypoints.length &&\n left.entrypoints.every((e, index) => isEqual(e.modules, right.entrypoints[index].modules))\n );\n}\n\n// we want to ensure that not only does our instance conform to\n// PackagerInstance, but our constructor conforms to Packager. So instead of\n// just exporting our class directly, we export a const constructor of the\n// correct type.\nconst Webpack: PackagerConstructor<Options> = class Webpack implements Packager {\n static annotation = '@embroider/webpack';\n\n pathToVanillaApp: string;\n private extraConfig: Configuration | undefined;\n private passthroughCache: Map<string, Stats> = new Map();\n private publicAssetURL: string | undefined;\n private extraThreadLoaderOptions: object | false | undefined;\n private extraBabelLoaderOptions: BabelLoaderOptions | undefined;\n private extraCssLoaderOptions: object | undefined;\n private extraStyleLoaderOptions: object | undefined;\n\n constructor(\n pathToVanillaApp: string,\n private outputPath: string,\n private variants: Variant[],\n private consoleWrite: (msg: string) => void,\n options?: Options\n ) {\n if (!semverSatisfies(webpack.version, '^5.0.0')) {\n throw new Error(`@embroider/webpack requires webpack@^5.0.0, but found version ${webpack.version}`);\n }\n\n this.pathToVanillaApp = realpathSync(pathToVanillaApp);\n this.extraConfig = options?.webpackConfig;\n this.publicAssetURL = options?.publicAssetURL;\n this.extraThreadLoaderOptions = options?.threadLoaderOptions;\n this.extraBabelLoaderOptions = options?.babelLoaderOptions;\n this.extraCssLoaderOptions = options?.cssLoaderOptions;\n this.extraStyleLoaderOptions = options?.styleLoaderOptions;\n warmUp(this.extraThreadLoaderOptions);\n }\n\n async build(): Promise<void> {\n let appInfo = this.examineApp();\n let webpack = this.getWebpack(appInfo);\n let stats = this.summarizeStats(await this.runWebpack(webpack));\n await this.writeFiles(stats, appInfo);\n }\n\n private examineApp(): AppInfo {\n let meta = getAppMeta(this.pathToVanillaApp);\n let rootURL = meta['root-url'];\n let babel = meta['babel'];\n let resolvableExtensions = meta['resolvable-extensions'];\n let entrypoints = [];\n let otherAssets = [];\n let publicAssetURL = this.publicAssetURL || rootURL;\n\n for (let relativePath of meta.assets) {\n if (/\\.html/i.test(relativePath)) {\n entrypoints.push(new HTMLEntrypoint(this.pathToVanillaApp, rootURL, publicAssetURL, relativePath));\n } else {\n otherAssets.push(relativePath);\n }\n }\n\n return { entrypoints, otherAssets, babel, rootURL, resolvableExtensions, publicAssetURL };\n }\n\n private configureWebpack(\n { entrypoints, babel, resolvableExtensions, publicAssetURL }: AppInfo,\n variant: Variant\n ): Configuration {\n let entry: { [name: string]: string } = {};\n for (let entrypoint of entrypoints) {\n for (let moduleName of entrypoint.modules) {\n entry[moduleName] = './' + moduleName;\n }\n }\n\n let { plugins: stylePlugins, loaders: styleLoaders } = this.setupStyleConfig(variant);\n\n return {\n mode: variant.optimizeForProduction ? 'production' : 'development',\n context: this.pathToVanillaApp,\n entry,\n performance: {\n hints: false,\n },\n plugins: stylePlugins,\n node: false,\n module: {\n rules: [\n {\n test: /\\.hbs$/,\n use: nonNullArray([\n maybeThreadLoader(babel.isParallelSafe, this.extraThreadLoaderOptions),\n babelLoaderOptions(\n babel.majorVersion,\n variant,\n join(this.pathToVanillaApp, babel.filename),\n this.extraBabelLoaderOptions\n ),\n {\n loader: require.resolve('@embroider/hbs-loader'),\n },\n ]),\n },\n {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n test: require(join(this.pathToVanillaApp, babel.fileFilter)),\n use: nonNullArray([\n maybeThreadLoader(babel.isParallelSafe, this.extraThreadLoaderOptions),\n babelLoaderOptions(\n babel.majorVersion,\n variant,\n join(this.pathToVanillaApp, babel.filename),\n this.extraBabelLoaderOptions\n ),\n ]),\n },\n {\n test: isCSS,\n use: styleLoaders,\n },\n ],\n },\n output: {\n path: join(this.outputPath, 'assets'),\n filename: `chunk.[chunkhash].js`,\n chunkFilename: `chunk.[chunkhash].js`,\n publicPath: publicAssetURL + 'assets/',\n },\n optimization: {\n splitChunks: {\n chunks: 'all',\n },\n },\n resolve: {\n extensions: resolvableExtensions,\n },\n resolveLoader: {\n alias: {\n // these loaders are our dependencies, not the app's dependencies. I'm\n // not overriding the default loader resolution rules in case the app also\n // wants to control those.\n 'thread-loader': require.resolve('thread-loader'),\n 'babel-loader-8': require.resolve('@embroider/babel-loader-8'),\n 'css-loader': require.resolve('css-loader'),\n 'style-loader': require.resolve('style-loader'),\n },\n },\n };\n }\n\n private lastAppInfo: AppInfo | undefined;\n private lastWebpack: webpack.MultiCompiler | undefined;\n\n private getWebpack(appInfo: AppInfo) {\n if (this.lastWebpack && this.lastAppInfo && equalAppInfo(appInfo, this.lastAppInfo)) {\n debug(`reusing webpack config`);\n return this.lastWebpack;\n }\n debug(`configuring webpack`);\n let config = this.variants.map(variant =>\n mergeWith({}, this.configureWebpack(appInfo, variant), this.extraConfig, appendArrays)\n );\n this.lastAppInfo = appInfo;\n return (this.lastWebpack = webpack(config));\n }\n\n private async writeScript(script: string, written: Set<string>, variant: Variant) {\n if (!variant.optimizeForProduction) {\n this.copyThrough(script);\n return script;\n }\n\n // loading these lazily here so they never load in non-production builds.\n // The node cache will ensures we only load them once.\n const [Terser, srcURL] = await Promise.all([import('terser'), import('source-map-url')]);\n\n let inCode = readFileSync(join(this.pathToVanillaApp, script), 'utf8');\n let terserOpts: MinifyOptions = {};\n let fileRelativeSourceMapURL;\n let appRelativeSourceMapURL;\n if (srcURL.default.existsIn(inCode)) {\n fileRelativeSourceMapURL = srcURL.default.getFrom(inCode)!;\n appRelativeSourceMapURL = join(dirname(script), fileRelativeSourceMapURL);\n let content;\n try {\n content = readJsonSync(join(this.pathToVanillaApp, appRelativeSourceMapURL));\n } catch (err) {\n // the script refers to a sourcemap that doesn't exist, so we just leave\n // the map out.\n }\n if (content) {\n terserOpts.sourceMap = { content, url: fileRelativeSourceMapURL };\n }\n }\n let { code: outCode, map: outMap } = await Terser.default.minify(inCode, terserOpts);\n let finalFilename = this.getFingerprintedFilename(script, outCode!);\n outputFileSync(join(this.outputPath, finalFilename), outCode!);\n written.add(script);\n if (appRelativeSourceMapURL && outMap) {\n outputFileSync(join(this.outputPath, appRelativeSourceMapURL), outMap);\n written.add(appRelativeSourceMapURL);\n }\n return finalFilename;\n }\n\n private async writeStyle(style: string, written: Set<string>, variant: Variant) {\n if (!variant.optimizeForProduction) {\n this.copyThrough(style);\n written.add(style);\n return style;\n }\n\n const csso = await import('csso');\n const cssContent = readFileSync(join(this.pathToVanillaApp, style), 'utf8');\n const minifiedCss = csso.minify(cssContent).css;\n\n let finalFilename = this.getFingerprintedFilename(style, minifiedCss);\n outputFileSync(join(this.outputPath, finalFilename), minifiedCss);\n written.add(style);\n return finalFilename;\n }\n\n private async provideErrorContext(message: string, messageParams: any[], fn: () => Promise<void>) {\n try {\n return await fn();\n } catch (err) {\n let context = format(message, ...messageParams);\n err.message = context + ': ' + err.message;\n throw err;\n }\n }\n\n private async writeFiles(stats: BundleSummary, { entrypoints, otherAssets }: AppInfo) {\n // we're doing this ourselves because I haven't seen a webpack 4 HTML plugin\n // that handles multiple HTML entrypoints correctly.\n\n let written: Set<string> = new Set();\n // scripts (as opposed to modules) and stylesheets (as opposed to CSS\n // modules that are imported from JS modules) get passed through without\n // going through webpack.\n for (let entrypoint of entrypoints) {\n await this.provideErrorContext('needed by %s', [entrypoint.filename], async () => {\n for (let script of entrypoint.scripts) {\n if (!stats.entrypoints.has(script)) {\n try {\n // zero here means we always attribute passthrough scripts to the\n // first build variant\n stats.entrypoints.set(\n script,\n new Map([[0, [await this.writeScript(script, written, this.variants[0])]]])\n );\n } catch (err) {\n if (err.code === 'ENOENT' && err.path === join(this.pathToVanillaApp, script)) {\n this.consoleWrite(\n `warning: in ${entrypoint.filename} <script src=\"${script\n .split(sep)\n .join(\n '/'\n )}\"> does not exist on disk. If this is intentional, use a data-embroider-ignore attribute.`\n );\n } else {\n throw err;\n }\n }\n }\n }\n for (let style of entrypoint.styles) {\n if (!stats.entrypoints.has(style)) {\n try {\n // zero here means we always attribute passthrough styles to the\n // first build variant\n stats.entrypoints.set(style, new Map([[0, [await this.writeStyle(style, written, this.variants[0])]]]));\n } catch (err) {\n if (err.code === 'ENOENT' && err.path === join(this.pathToVanillaApp, style)) {\n this.consoleWrite(\n `warning: in ${entrypoint.filename} <link rel=\"stylesheet\" href=\"${style\n .split(sep)\n .join(\n '/'\n )}\"> does not exist on disk. If this is intentional, use a data-embroider-ignore attribute.`\n );\n } else {\n throw err;\n }\n }\n }\n }\n });\n }\n\n for (let entrypoint of entrypoints) {\n outputFileSync(join(this.outputPath, entrypoint.filename), entrypoint.render(stats), 'utf8');\n written.add(entrypoint.filename);\n }\n\n for (let relativePath of otherAssets) {\n if (!written.has(relativePath)) {\n await this.provideErrorContext(`while copying app's assets`, [], async () => {\n this.copyThrough(relativePath);\n });\n }\n }\n }\n\n private copyThrough(relativePath: string) {\n let sourcePath = join(this.pathToVanillaApp, relativePath);\n let newStats = statSync(sourcePath);\n let oldStats = this.passthroughCache.get(sourcePath);\n if (!oldStats || oldStats.mtimeMs !== newStats.mtimeMs || oldStats.size !== newStats.size) {\n debug(`emitting ${relativePath}`);\n copySync(sourcePath, join(this.outputPath, relativePath));\n this.passthroughCache.set(sourcePath, newStats);\n }\n }\n\n private getFingerprintedFilename(filename: string, content: string): string {\n let md5 = crypto.createHash('md5');\n md5.update(content);\n let hash = md5.digest('hex');\n\n let fileParts = filename.split('.');\n fileParts.splice(fileParts.length - 1, 0, hash);\n return fileParts.join('.');\n }\n\n private summarizeStats(multiStats: webpack.MultiStats): BundleSummary {\n let output: BundleSummary = {\n entrypoints: new Map(),\n lazyBundles: new Map(),\n variants: this.variants,\n };\n for (let [variantIndex, variant] of this.variants.entries()) {\n let { entrypoints, chunks } = multiStats.stats[variantIndex].toJson({\n all: false,\n entrypoints: true,\n chunks: true,\n });\n\n // webpack's types are written rather loosely, implying that these two\n // properties may not be present. They really always are, as far as I can\n // tell, but we need to check here anyway to satisfy the type checker.\n if (!entrypoints) {\n throw new Error(`unexpected webpack output: no entrypoints`);\n }\n if (!chunks) {\n throw new Error(`unexpected webpack output: no chunks`);\n }\n\n for (let id of Object.keys(entrypoints)) {\n let { assets: entrypointAssets } = entrypoints[id];\n if (!entrypointAssets) {\n throw new Error(`unexpected webpack output: no entrypoint.assets`);\n }\n\n getOrCreate(output.entrypoints, id, () => new Map()).set(\n variantIndex,\n entrypointAssets.map(asset => 'assets/' + asset.name)\n );\n if (variant.runtime !== 'browser') {\n // in the browser we don't need to worry about lazy assets (they will be\n // handled automatically by webpack as needed), but in any other runtime\n // we need the ability to preload them\n output.lazyBundles.set(\n id,\n flatMap(\n chunks.filter(chunk => chunk.runtime?.includes(id)),\n chunk => chunk.files\n )\n .filter(file => !entrypointAssets?.find(a => a.name === file))\n .map(file => `assets/${file}`)\n );\n }\n }\n }\n return output;\n }\n\n private runWebpack(webpack: webpack.MultiCompiler): Promise<webpack.MultiStats> {\n return new Promise((resolve, reject) => {\n webpack.run((err, stats) => {\n try {\n if (err) {\n if (stats) {\n this.consoleWrite(stats.toString());\n }\n throw err;\n }\n if (!stats) {\n // this doesn't really happen, but webpack's types imply that it\n // could, so we just satisfy typescript here\n throw new Error('bug: no stats and no err');\n }\n if (stats.hasErrors()) {\n // write all the stats output to the console\n this.consoleWrite(\n stats.toString({\n color: Boolean(supportsColor.stdout),\n })\n );\n\n // the typing for MultiCompiler are all foobared.\n throw this.findBestError(flatMap((stats as any).stats, s => s.compilation.errors));\n }\n if (stats.hasWarnings() || process.env.VANILLA_VERBOSE) {\n this.consoleWrite(\n stats.toString({\n color: Boolean(supportsColor.stdout),\n })\n );\n }\n resolve(stats);\n } catch (e) {\n reject(e);\n }\n });\n });\n }\n\n private setupStyleConfig(variant: Variant): {\n loaders: RuleSetUseItem[];\n plugins: WebpackPluginInstance[];\n } {\n let cssLoader = {\n loader: 'css-loader',\n options: {\n url: true,\n import: true,\n modules: 'global',\n ...this.extraCssLoaderOptions,\n },\n };\n\n if (!variant.optimizeForProduction && variant.runtime === 'browser') {\n // in development builds that only need to work in the browser (not\n // fastboot), we can use style-loader because it's fast\n return {\n loaders: [\n { loader: 'style-loader', options: { injectType: 'styleTag', ...this.extraStyleLoaderOptions } },\n cssLoader,\n ],\n plugins: [],\n };\n } else {\n // in any other build, we separate the CSS into its own bundles\n return {\n loaders: [MiniCssExtractPlugin.loader, cssLoader],\n plugins: [\n new MiniCssExtractPlugin({\n filename: `chunk.[chunkhash].css`,\n chunkFilename: `chunk.[chunkhash].css`,\n // in the browser, MiniCssExtractPlugin can manage it's own runtime\n // lazy loading of stylesheets.\n //\n // but in fastboot, we need to disable that in favor of doing our\n // own insertion of `<link>` tags in the HTML\n runtime: variant.runtime === 'browser',\n }),\n ],\n };\n }\n }\n\n private findBestError(errors: any[]) {\n let error = errors[0];\n let file;\n if (error.module?.userRequest) {\n file = relative(this.pathToVanillaApp, error.module.userRequest);\n }\n\n if (!error.file) {\n error.file = file || (error.loc ? error.loc.file : null) || (error.location ? error.location.file : null);\n }\n if (error.line == null) {\n error.line = (error.loc ? error.loc.line : null) || (error.location ? error.location.line : null);\n }\n if (typeof error.message === 'string') {\n error.message = error.message.replace(error.module.context, error.module.userRequest);\n\n // the tmpdir on OSX is horribly long and makes error messages hard to\n // read. This is doing the same as String.prototype.replaceAll, which node\n // doesn't have yet.\n error.message = error.message.split(tmpdir).join('$TMPDIR');\n }\n return error;\n }\n};\n\nconst threadLoaderOptions = {\n workers: 'JOBS' in process.env && Number(process.env.JOBS),\n // poolTimeout shuts down idle workers. The problem is, for\n // interactive rebuilds that means your startup cost for the\n // next rebuild is at least 600ms worse. So we insist on\n // keeping workers alive always.\n poolTimeout: Infinity,\n};\n\nfunction warmUp(extraOptions: object | false | undefined) {\n // We don't know if we'll be parallel-safe or not, but if the environment sets\n // JOBS to 0, or our extraOptions are set to false, we know we won't use\n // thread-loader, so no need to consume extra resources warming the worker\n // pool\n if (process.env.JOBS === '1' || extraOptions === false) {\n return null;\n }\n\n threadLoaderWarmup(Object.assign({}, threadLoaderOptions, extraOptions), [\n require.resolve('@embroider/hbs-loader'),\n require.resolve('@embroider/babel-loader-8'),\n ]);\n}\n\nfunction maybeThreadLoader(isParallelSafe: boolean, extraOptions: object | false | undefined) {\n if (process.env.JOBS === '0' || extraOptions === false || !isParallelSafe) {\n return null;\n }\n\n return {\n loader: 'thread-loader',\n options: Object.assign({}, threadLoaderOptions, extraOptions),\n };\n}\n\nfunction appendArrays(objValue: any, srcValue: any) {\n if (Array.isArray(objValue)) {\n return objValue.concat(srcValue);\n }\n}\n\nfunction isCSS(filename: string) {\n return /\\.css$/i.test(filename);\n}\n\n// typescript doesn't understand that regular use of array.filter(Boolean) does\n// this.\nfunction nonNullArray<T>(array: T[]): NonNullable<T>[] {\n return array.filter(Boolean) as NonNullable<T>[];\n}\n\nfunction babelLoaderOptions(\n _majorVersion: 7,\n variant: Variant,\n appBabelConfigPath: string,\n extraOptions: BabelLoaderOptions | undefined\n) {\n const cacheDirectory = getPackagerCacheDir('webpack-babel-loader');\n const options: BabelLoaderOptions & { variant: Variant; appBabelConfigPath: string } = {\n variant,\n appBabelConfigPath,\n cacheDirectory,\n ...extraOptions,\n };\n return {\n loader: 'babel-loader-8',\n options,\n };\n}\n\nexport { Webpack };\n"]}
1
+ {"version":3,"file":"ember-webpack.js","sourceRoot":"","sources":["ember-webpack.ts"],"names":[],"mappings":";AAAA;;;;;;;;;EASE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEF,0CAUyB;AACzB,kEAAqD;AACrD,sDAAwF;AACxF,uCAA+G;AAC/G,+BAAoD;AACpD,6DAAqC;AACrC,iEAAyC;AACzC,6DAAqC;AACrC,sFAA2D;AAC3D,kDAA8B;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sBAAsB,CAAC,CAAC;IACnE,MAAM,OAAO,GAA0E;QACrF,OAAO;QACP,kBAAkB;QAClB,cAAc;QACd,GAAG,YAAY;KAChB,CAAC;IACF,OAAO;QACL,MAAM,EAAE,gBAAgB;QACxB,OAAO;KACR,CAAC;AACJ,CAAC","sourcesContent":["/*\n Most of the work this module does is putting an HTML-oriented facade around\n Webpack. That is, we want both the input and output to be primarily HTML files\n with proper spec semantics, and we use webpack to optimize the assets referred\n to by those files.\n\n While there are webpack plugins for handling HTML, none of them handle\n multiple HTML entrypoints and apply correct HTML semantics (for example,\n getting script vs module context correct).\n*/\n\nimport {\n AppMeta,\n HTMLEntrypoint,\n BundleSummary,\n Packager,\n PackagerConstructor,\n Variant,\n getAppMeta,\n getPackagerCacheDir,\n getOrCreate,\n} from '@embroider/core';\nimport { tmpdir } from '@embroider/shared-internals';\nimport webpack, { Configuration, RuleSetUseItem, WebpackPluginInstance } from 'webpack';\nimport { readFileSync, outputFileSync, copySync, realpathSync, Stats, statSync, readJsonSync } from 'fs-extra';\nimport { join, dirname, relative, sep } from 'path';\nimport isEqual from 'lodash/isEqual';\nimport mergeWith from 'lodash/mergeWith';\nimport flatMap from 'lodash/flatMap';\nimport MiniCssExtractPlugin from 'mini-css-extract-plugin';\nimport makeDebug from 'debug';\nimport { format } from 'util';\nimport { warmup as threadLoaderWarmup } from 'thread-loader';\nimport { Options, BabelLoaderOptions } from './options';\nimport crypto from 'crypto';\nimport semverSatisfies from 'semver/functions/satisfies';\nimport supportsColor from 'supports-color';\n\nconst debug = makeDebug('embroider:debug');\n\n// This is a type-only import, so it gets compiled away. At runtime, we load\n// terser lazily so it's only loaded for production builds that use it. Don't\n// add any non-type-only imports here.\nimport type { MinifyOptions } from 'terser';\n\ninterface AppInfo {\n entrypoints: HTMLEntrypoint[];\n otherAssets: string[];\n babel: AppMeta['babel'];\n rootURL: AppMeta['root-url'];\n publicAssetURL: string;\n resolvableExtensions: AppMeta['resolvable-extensions'];\n}\n\n// AppInfos are equal if they result in the same webpack config.\nfunction equalAppInfo(left: AppInfo, right: AppInfo): boolean {\n return (\n isEqual(left.babel, right.babel) &&\n left.entrypoints.length === right.entrypoints.length &&\n left.entrypoints.every((e, index) => isEqual(e.modules, right.entrypoints[index].modules))\n );\n}\n\ntype BeginFn = (total: number) => void;\ntype IncrementFn = () => Promise<void>;\n\nfunction createBarrier(): [BeginFn, IncrementFn] {\n const barriers: Array<[() => void, (e: unknown) => void]> = [];\n let done = true;\n let limit = 0;\n return [begin, increment];\n\n function begin(newLimit: number) {\n if (!done) flush(new Error('begin called before limit reached'));\n done = false;\n limit = newLimit;\n }\n\n async function increment() {\n if (done) {\n throw new Error('increment after limit reach');\n }\n const promise = new Promise<void>((resolve, reject) => {\n barriers.push([resolve, reject]);\n });\n if (barriers.length === limit) {\n flush();\n }\n await promise;\n }\n\n function flush(err?: Error) {\n for (const [resolve, reject] of barriers) {\n if (err) reject(err);\n else resolve();\n }\n barriers.length = 0;\n done = true;\n }\n}\n\n// we want to ensure that not only does our instance conform to\n// PackagerInstance, but our constructor conforms to Packager. So instead of\n// just exporting our class directly, we export a const constructor of the\n// correct type.\nconst Webpack: PackagerConstructor<Options> = class Webpack implements Packager {\n static annotation = '@embroider/webpack';\n\n pathToVanillaApp: string;\n private extraConfig: Configuration | undefined;\n private passthroughCache: Map<string, Stats> = new Map();\n private publicAssetURL: string | undefined;\n private extraThreadLoaderOptions: object | false | undefined;\n private extraBabelLoaderOptions: BabelLoaderOptions | undefined;\n private extraCssLoaderOptions: object | undefined;\n private extraStyleLoaderOptions: object | undefined;\n private _bundleSummary: BundleSummary | undefined;\n private beginBarrier: BeginFn;\n private incrementBarrier: IncrementFn;\n\n constructor(\n pathToVanillaApp: string,\n private outputPath: string,\n private variants: Variant[],\n private consoleWrite: (msg: string) => void,\n options?: Options\n ) {\n if (!semverSatisfies(webpack.version, '^5.0.0')) {\n throw new Error(`@embroider/webpack requires webpack@^5.0.0, but found version ${webpack.version}`);\n }\n\n this.pathToVanillaApp = realpathSync(pathToVanillaApp);\n this.extraConfig = options?.webpackConfig;\n this.publicAssetURL = options?.publicAssetURL;\n this.extraThreadLoaderOptions = options?.threadLoaderOptions;\n this.extraBabelLoaderOptions = options?.babelLoaderOptions;\n this.extraCssLoaderOptions = options?.cssLoaderOptions;\n this.extraStyleLoaderOptions = options?.styleLoaderOptions;\n [this.beginBarrier, this.incrementBarrier] = createBarrier();\n warmUp(this.extraThreadLoaderOptions);\n }\n\n get bundleSummary(): BundleSummary {\n let bundleSummary = this._bundleSummary;\n if (bundleSummary === undefined) {\n this._bundleSummary = bundleSummary = {\n entrypoints: new Map(),\n lazyBundles: new Map(),\n variants: this.variants,\n };\n }\n return bundleSummary;\n }\n\n async build(): Promise<void> {\n this._bundleSummary = undefined;\n this.beginBarrier(this.variants.length);\n let appInfo = this.examineApp();\n let webpack = this.getWebpack(appInfo);\n await this.runWebpack(webpack);\n }\n\n private examineApp(): AppInfo {\n let meta = getAppMeta(this.pathToVanillaApp);\n let rootURL = meta['root-url'];\n let babel = meta['babel'];\n let resolvableExtensions = meta['resolvable-extensions'];\n let entrypoints = [];\n let otherAssets = [];\n let publicAssetURL = this.publicAssetURL || rootURL;\n\n for (let relativePath of meta.assets) {\n if (/\\.html/i.test(relativePath)) {\n entrypoints.push(new HTMLEntrypoint(this.pathToVanillaApp, rootURL, publicAssetURL, relativePath));\n } else {\n otherAssets.push(relativePath);\n }\n }\n\n return { entrypoints, otherAssets, babel, rootURL, resolvableExtensions, publicAssetURL };\n }\n\n private configureWebpack(appInfo: AppInfo, variant: Variant, variantIndex: number): Configuration {\n const { entrypoints, babel, resolvableExtensions, publicAssetURL } = appInfo;\n\n let entry: { [name: string]: string } = {};\n for (let entrypoint of entrypoints) {\n for (let moduleName of entrypoint.modules) {\n entry[moduleName] = './' + moduleName;\n }\n }\n\n let { plugins: stylePlugins, loaders: styleLoaders } = this.setupStyleConfig(variant);\n\n return {\n mode: variant.optimizeForProduction ? 'production' : 'development',\n context: this.pathToVanillaApp,\n entry,\n performance: {\n hints: false,\n },\n plugins: [\n ...stylePlugins,\n compiler => {\n compiler.hooks.done.tapPromise('EmbroiderPlugin', async stats => {\n this.summarizeStats(stats, variant, variantIndex);\n await this.writeFiles(this.bundleSummary, appInfo, variantIndex);\n });\n },\n ],\n node: false,\n module: {\n rules: [\n {\n test: /\\.hbs$/,\n use: nonNullArray([\n maybeThreadLoader(babel.isParallelSafe, this.extraThreadLoaderOptions),\n babelLoaderOptions(\n babel.majorVersion,\n variant,\n join(this.pathToVanillaApp, babel.filename),\n this.extraBabelLoaderOptions\n ),\n {\n loader: require.resolve('@embroider/hbs-loader'),\n },\n ]),\n },\n {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n test: require(join(this.pathToVanillaApp, babel.fileFilter)),\n use: nonNullArray([\n maybeThreadLoader(babel.isParallelSafe, this.extraThreadLoaderOptions),\n babelLoaderOptions(\n babel.majorVersion,\n variant,\n join(this.pathToVanillaApp, babel.filename),\n this.extraBabelLoaderOptions\n ),\n ]),\n },\n {\n test: isCSS,\n use: styleLoaders,\n },\n ],\n },\n output: {\n path: join(this.outputPath),\n filename: `assets/chunk.[chunkhash].js`,\n chunkFilename: `assets/chunk.[chunkhash].js`,\n publicPath: publicAssetURL,\n },\n optimization: {\n splitChunks: {\n chunks: 'all',\n },\n },\n resolve: {\n extensions: resolvableExtensions,\n },\n resolveLoader: {\n alias: {\n // these loaders are our dependencies, not the app's dependencies. I'm\n // not overriding the default loader resolution rules in case the app also\n // wants to control those.\n 'thread-loader': require.resolve('thread-loader'),\n 'babel-loader-8': require.resolve('@embroider/babel-loader-8'),\n 'css-loader': require.resolve('css-loader'),\n 'style-loader': require.resolve('style-loader'),\n },\n },\n };\n }\n\n private lastAppInfo: AppInfo | undefined;\n private lastWebpack: webpack.MultiCompiler | undefined;\n\n private getWebpack(appInfo: AppInfo) {\n if (this.lastWebpack && this.lastAppInfo && equalAppInfo(appInfo, this.lastAppInfo)) {\n debug(`reusing webpack config`);\n return this.lastWebpack;\n }\n debug(`configuring webpack`);\n let config = this.variants.map((variant, variantIndex) =>\n mergeWith({}, this.configureWebpack(appInfo, variant, variantIndex), this.extraConfig, appendArrays)\n );\n this.lastAppInfo = appInfo;\n return (this.lastWebpack = webpack(config));\n }\n\n private async writeScript(script: string, written: Set<string>, variant: Variant) {\n if (!variant.optimizeForProduction) {\n this.copyThrough(script);\n return script;\n }\n\n // loading these lazily here so they never load in non-production builds.\n // The node cache will ensures we only load them once.\n const [Terser, srcURL] = await Promise.all([import('terser'), import('source-map-url')]);\n\n let inCode = readFileSync(join(this.pathToVanillaApp, script), 'utf8');\n let terserOpts: MinifyOptions = {};\n let fileRelativeSourceMapURL;\n let appRelativeSourceMapURL;\n if (srcURL.default.existsIn(inCode)) {\n fileRelativeSourceMapURL = srcURL.default.getFrom(inCode)!;\n appRelativeSourceMapURL = join(dirname(script), fileRelativeSourceMapURL);\n let content;\n try {\n content = readJsonSync(join(this.pathToVanillaApp, appRelativeSourceMapURL));\n } catch (err) {\n // the script refers to a sourcemap that doesn't exist, so we just leave\n // the map out.\n }\n if (content) {\n terserOpts.sourceMap = { content, url: fileRelativeSourceMapURL };\n }\n }\n let { code: outCode, map: outMap } = await Terser.default.minify(inCode, terserOpts);\n let finalFilename = this.getFingerprintedFilename(script, outCode!);\n outputFileSync(join(this.outputPath, finalFilename), outCode!);\n written.add(script);\n if (appRelativeSourceMapURL && outMap) {\n outputFileSync(join(this.outputPath, appRelativeSourceMapURL), outMap);\n written.add(appRelativeSourceMapURL);\n }\n return finalFilename;\n }\n\n private async writeStyle(style: string, written: Set<string>, variant: Variant) {\n if (!variant.optimizeForProduction) {\n this.copyThrough(style);\n written.add(style);\n return style;\n }\n\n const csso = await import('csso');\n const cssContent = readFileSync(join(this.pathToVanillaApp, style), 'utf8');\n const minifiedCss = csso.minify(cssContent).css;\n\n let finalFilename = this.getFingerprintedFilename(style, minifiedCss);\n outputFileSync(join(this.outputPath, finalFilename), minifiedCss);\n written.add(style);\n return finalFilename;\n }\n\n private async provideErrorContext(message: string, messageParams: any[], fn: () => Promise<void>) {\n try {\n return await fn();\n } catch (err) {\n let context = format(message, ...messageParams);\n err.message = context + ': ' + err.message;\n throw err;\n }\n }\n\n private async writeFiles(stats: BundleSummary, { entrypoints, otherAssets }: AppInfo, variantIndex: number) {\n // we're doing this ourselves because I haven't seen a webpack 4 HTML plugin\n // that handles multiple HTML entrypoints correctly.\n\n let written: Set<string> = new Set();\n // scripts (as opposed to modules) and stylesheets (as opposed to CSS\n // modules that are imported from JS modules) get passed through without\n // going through webpack.\n for (let entrypoint of entrypoints) {\n await this.provideErrorContext('needed by %s', [entrypoint.filename], async () => {\n for (let script of entrypoint.scripts) {\n if (!stats.entrypoints.has(script)) {\n const mapping = [] as string[];\n try {\n // zero here means we always attribute passthrough scripts to the\n // first build variant\n stats.entrypoints.set(script, new Map([[0, mapping]]));\n mapping.push(await this.writeScript(script, written, this.variants[0]));\n } catch (err) {\n if (err.code === 'ENOENT' && err.path === join(this.pathToVanillaApp, script)) {\n this.consoleWrite(\n `warning: in ${entrypoint.filename} <script src=\"${script\n .split(sep)\n .join(\n '/'\n )}\"> does not exist on disk. If this is intentional, use a data-embroider-ignore attribute.`\n );\n } else {\n throw err;\n }\n }\n }\n }\n for (let style of entrypoint.styles) {\n if (!stats.entrypoints.has(style)) {\n const mapping = [] as string[];\n try {\n // zero here means we always attribute passthrough styles to the\n // first build variant\n stats.entrypoints.set(style, new Map([[0, mapping]]));\n mapping.push(await this.writeStyle(style, written, this.variants[0]));\n } catch (err) {\n if (err.code === 'ENOENT' && err.path === join(this.pathToVanillaApp, style)) {\n this.consoleWrite(\n `warning: in ${entrypoint.filename} <link rel=\"stylesheet\" href=\"${style\n .split(sep)\n .join(\n '/'\n )}\"> does not exist on disk. If this is intentional, use a data-embroider-ignore attribute.`\n );\n } else {\n throw err;\n }\n }\n }\n }\n });\n }\n // we need to wait for both compilers before writing html entrypoint\n await this.incrementBarrier();\n // only the first variant should write it.\n if (variantIndex === 0) {\n for (let entrypoint of entrypoints) {\n outputFileSync(join(this.outputPath, entrypoint.filename), entrypoint.render(stats), 'utf8');\n written.add(entrypoint.filename);\n }\n }\n\n for (let relativePath of otherAssets) {\n if (!written.has(relativePath)) {\n written.add(relativePath);\n await this.provideErrorContext(`while copying app's assets`, [], async () => {\n this.copyThrough(relativePath);\n });\n }\n }\n }\n\n private copyThrough(relativePath: string) {\n let sourcePath = join(this.pathToVanillaApp, relativePath);\n let newStats = statSync(sourcePath);\n let oldStats = this.passthroughCache.get(sourcePath);\n if (!oldStats || oldStats.mtimeMs !== newStats.mtimeMs || oldStats.size !== newStats.size) {\n debug(`emitting ${relativePath}`);\n copySync(sourcePath, join(this.outputPath, relativePath));\n this.passthroughCache.set(sourcePath, newStats);\n }\n }\n\n private getFingerprintedFilename(filename: string, content: string): string {\n let md5 = crypto.createHash('md5');\n md5.update(content);\n let hash = md5.digest('hex');\n\n let fileParts = filename.split('.');\n fileParts.splice(fileParts.length - 1, 0, hash);\n return fileParts.join('.');\n }\n\n private summarizeStats(stats: webpack.Stats, variant: Variant, variantIndex: number): void {\n let output = this.bundleSummary;\n let { entrypoints, chunks } = stats.toJson({\n all: false,\n entrypoints: true,\n chunks: true,\n });\n\n // webpack's types are written rather loosely, implying that these two\n // properties may not be present. They really always are, as far as I can\n // tell, but we need to check here anyway to satisfy the type checker.\n if (!entrypoints) {\n throw new Error(`unexpected webpack output: no entrypoints`);\n }\n if (!chunks) {\n throw new Error(`unexpected webpack output: no chunks`);\n }\n\n for (let id of Object.keys(entrypoints)) {\n let { assets: entrypointAssets } = entrypoints[id];\n if (!entrypointAssets) {\n throw new Error(`unexpected webpack output: no entrypoint.assets`);\n }\n\n getOrCreate(output.entrypoints, id, () => new Map()).set(\n variantIndex,\n entrypointAssets.map(asset => asset.name)\n );\n if (variant.runtime !== 'browser') {\n // in the browser we don't need to worry about lazy assets (they will be\n // handled automatically by webpack as needed), but in any other runtime\n // we need the ability to preload them\n output.lazyBundles.set(\n id,\n flatMap(\n chunks.filter(chunk => chunk.runtime?.includes(id)),\n chunk => chunk.files\n ).filter(file => !entrypointAssets?.find(a => a.name === file)) as string[]\n );\n }\n }\n }\n\n private runWebpack(webpack: webpack.MultiCompiler): Promise<webpack.MultiStats> {\n return new Promise((resolve, reject) => {\n webpack.run((err, stats) => {\n try {\n if (err) {\n if (stats) {\n this.consoleWrite(stats.toString());\n }\n throw err;\n }\n if (!stats) {\n // this doesn't really happen, but webpack's types imply that it\n // could, so we just satisfy typescript here\n throw new Error('bug: no stats and no err');\n }\n if (stats.hasErrors()) {\n // write all the stats output to the console\n this.consoleWrite(\n stats.toString({\n color: Boolean(supportsColor.stdout),\n })\n );\n\n // the typing for MultiCompiler are all foobared.\n throw this.findBestError(flatMap((stats as any).stats, s => s.compilation.errors));\n }\n if (stats.hasWarnings() || process.env.VANILLA_VERBOSE) {\n this.consoleWrite(\n stats.toString({\n color: Boolean(supportsColor.stdout),\n })\n );\n }\n resolve(stats);\n } catch (e) {\n reject(e);\n }\n });\n });\n }\n\n private setupStyleConfig(variant: Variant): {\n loaders: RuleSetUseItem[];\n plugins: WebpackPluginInstance[];\n } {\n let cssLoader = {\n loader: 'css-loader',\n options: {\n url: true,\n import: true,\n modules: 'global',\n ...this.extraCssLoaderOptions,\n },\n };\n\n if (!variant.optimizeForProduction && variant.runtime === 'browser') {\n // in development builds that only need to work in the browser (not\n // fastboot), we can use style-loader because it's fast\n return {\n loaders: [\n { loader: 'style-loader', options: { injectType: 'styleTag', ...this.extraStyleLoaderOptions } },\n cssLoader,\n ],\n plugins: [],\n };\n } else {\n // in any other build, we separate the CSS into its own bundles\n return {\n loaders: [MiniCssExtractPlugin.loader, cssLoader],\n plugins: [\n new MiniCssExtractPlugin({\n filename: `assets/chunk.[chunkhash].css`,\n chunkFilename: `assets/chunk.[chunkhash].css`,\n // in the browser, MiniCssExtractPlugin can manage it's own runtime\n // lazy loading of stylesheets.\n //\n // but in fastboot, we need to disable that in favor of doing our\n // own insertion of `<link>` tags in the HTML\n runtime: variant.runtime === 'browser',\n }),\n ],\n };\n }\n }\n\n private findBestError(errors: any[]) {\n let error = errors[0];\n let file;\n if (error.module?.userRequest) {\n file = relative(this.pathToVanillaApp, error.module.userRequest);\n }\n\n if (!error.file) {\n error.file = file || (error.loc ? error.loc.file : null) || (error.location ? error.location.file : null);\n }\n if (error.line == null) {\n error.line = (error.loc ? error.loc.line : null) || (error.location ? error.location.line : null);\n }\n if (typeof error.message === 'string') {\n error.message = error.message.replace(error.module.context, error.module.userRequest);\n\n // the tmpdir on OSX is horribly long and makes error messages hard to\n // read. This is doing the same as String.prototype.replaceAll, which node\n // doesn't have yet.\n error.message = error.message.split(tmpdir).join('$TMPDIR');\n }\n return error;\n }\n};\n\nconst threadLoaderOptions = {\n workers: 'JOBS' in process.env && Number(process.env.JOBS),\n // poolTimeout shuts down idle workers. The problem is, for\n // interactive rebuilds that means your startup cost for the\n // next rebuild is at least 600ms worse. So we insist on\n // keeping workers alive always.\n poolTimeout: Infinity,\n};\n\nfunction canUseThreadLoader(extraOptions: object | false | undefined) {\n // If the environment sets JOBS to 0, or if our extraOptions are set to false,\n // we have been explicitly configured not to use thread-loader\n if (process.env.JOBS === '0' || extraOptions === false) {\n return false;\n } else {\n return true;\n }\n}\n\nfunction warmUp(extraOptions: object | false | undefined) {\n // We don't know if we'll be parallel-safe or not, but if we've been\n // configured to not use thread-loader, then there is no need to consume extra\n // resources warming the worker pool\n if (!canUseThreadLoader(extraOptions)) {\n return null;\n }\n\n threadLoaderWarmup(Object.assign({}, threadLoaderOptions, extraOptions), [\n require.resolve('@embroider/hbs-loader'),\n require.resolve('@embroider/babel-loader-8'),\n ]);\n}\n\nfunction maybeThreadLoader(isParallelSafe: boolean, extraOptions: object | false | undefined) {\n if (!canUseThreadLoader(extraOptions) || !isParallelSafe) {\n return null;\n }\n\n return {\n loader: 'thread-loader',\n options: Object.assign({}, threadLoaderOptions, extraOptions),\n };\n}\n\nfunction appendArrays(objValue: any, srcValue: any) {\n if (Array.isArray(objValue)) {\n return objValue.concat(srcValue);\n }\n}\n\nfunction isCSS(filename: string) {\n return /\\.css$/i.test(filename);\n}\n\n// typescript doesn't understand that regular use of array.filter(Boolean) does\n// this.\nfunction nonNullArray<T>(array: T[]): NonNullable<T>[] {\n return array.filter(Boolean) as NonNullable<T>[];\n}\n\nfunction babelLoaderOptions(\n _majorVersion: 7,\n variant: Variant,\n appBabelConfigPath: string,\n extraOptions: BabelLoaderOptions | undefined\n) {\n const cacheDirectory = getPackagerCacheDir('webpack-babel-loader');\n const options: BabelLoaderOptions & { variant: Variant; appBabelConfigPath: string } = {\n variant,\n appBabelConfigPath,\n cacheDirectory,\n ...extraOptions,\n };\n return {\n loader: 'babel-loader-8',\n options,\n };\n}\n\nexport { Webpack };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"options.js","sourceRoot":"","sources":["options.ts"],"names":[],"mappings":"","sourcesContent":["import { Configuration } from 'webpack';\n\n// [babel-loader](https://webpack.js.org/loaders/babel-loader/#options) specific options.\n// This does not include the babel configuration, which is pulled from the app, only the\n// additional options that `babel-loader` supports.\nexport interface BabelLoaderOptions {\n cacheDirectory?: boolean | string;\n cacheIdentifier?: string;\n cacheCompression?: boolean;\n customize?: string;\n}\n\nexport interface Options {\n webpackConfig: Configuration;\n\n // the base public URL for your assets in production. Use this when you want\n // to serve all your assets from a different origin (like a CDN) than your\n // actual index.html will be served on.\n //\n // This should be a URL ending in \"/\".\n publicAssetURL?: string;\n\n // [thread-loader](https://github.com/webpack-contrib/thread-loader) options.\n // If set to false, `thread-loader` will not be used. If set to an object, it\n // will be used to configure `thread-loader`. If not specified,\n // `thread-loader` will be used with a default configuration.\n //\n // Note that setting `JOBS=1` in the environment will also disable\n // `thread-loader`.\n threadLoaderOptions?: object | false;\n\n babelLoaderOptions?: BabelLoaderOptions;\n\n /**\n * Options for [`css-loader`](https://webpack.js.org/loaders/css-loader)\n */\n cssLoaderOptions?: object;\n\n /**\n * Options for [`style-loader`](https://webpack.js.org/loaders/style-loader/).\n *\n * Note that [`mini-css-extract-plugin`](https://webpack.js.org/plugins/mini-css-extract-plugin/)\n * is used instead of `style-loader` in production builds.\n */\n styleLoaderOptions?: object;\n}\n"]}
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["options.ts"],"names":[],"mappings":"","sourcesContent":["import { Configuration } from 'webpack';\n\n// [babel-loader](https://webpack.js.org/loaders/babel-loader/#options) specific options.\n// This does not include the babel configuration, which is pulled from the app, only the\n// additional options that `babel-loader` supports.\nexport interface BabelLoaderOptions {\n cacheDirectory?: boolean | string;\n cacheIdentifier?: string;\n cacheCompression?: boolean;\n customize?: string;\n}\n\nexport interface Options {\n // This allows you to extend the webpack config in arbitrary ways. Your\n // changes will get applied on top of the defaults provided by\n // @embroider/webpack.\n webpackConfig: Configuration;\n\n // the base public URL for your assets in production. Use this when you want\n // to serve all your assets from a different origin (like a CDN) than your\n // actual index.html will be served on.\n //\n // This should be a URL ending in \"/\".\n //\n // For example:\n //\n // 1. If your build produces the file \"./dist/assets/chunk.123.js\"\n // 2. And you set publicAssetURL to \"https://cdn/\"\n // 3. Browsers will try to locate the file at\n // \"https://cdn/assets/chunk.123.js\".\n //\n // Notice that `publicAssetURL` gets applied relative to your whole built\n // application -- not a particular subdirectory like \"/assets\". If you don't\n // want a part of the path to show up in the public URLs, you should adjust the\n // actual locations of the output files to remove that directory. For example:\n //\n // webpackConfig: {\n // output: {\n // // This overrides our default of \"assets/chunk.[chunkhash].js\"\n // // to move the chunks to the root of the app, eliminating the assets subdirectory.\n // filename: `mychunk.[chunkhash].js`,\n // chunkFilename: `mychunk.[chunkhash].js`,\n // },\n // publicOutputPath: \"https://cdn/\",\n // },\n //\n // The above example will result in CDN URLs like \"https://cdn/mychunk.123.js\".\n //\n publicAssetURL?: string;\n\n // [thread-loader](https://github.com/webpack-contrib/thread-loader) options.\n // If set to false, `thread-loader` will not be used. If set to an object, it\n // will be used to configure `thread-loader`. If not specified,\n // `thread-loader` will be used with a default configuration.\n //\n // Note that setting `JOBS=0` in the environment will also disable\n // `thread-loader`.\n threadLoaderOptions?: object | false;\n\n babelLoaderOptions?: BabelLoaderOptions;\n\n /**\n * Options for [`css-loader`](https://webpack.js.org/loaders/css-loader)\n */\n cssLoaderOptions?: object;\n\n /**\n * Options for [`style-loader`](https://webpack.js.org/loaders/style-loader/).\n *\n * Note that [`mini-css-extract-plugin`](https://webpack.js.org/plugins/mini-css-extract-plugin/)\n * is used instead of `style-loader` in production builds.\n */\n styleLoaderOptions?: object;\n}\n"]}