@teambit/webpack 1.0.1105 → 1.0.1106
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/webpack-fallbacks-aliases.ts +4 -0
- package/config/webpack-fallbacks-provide-plugin-config.ts +4 -0
- package/config/webpack-fallbacks.ts +4 -0
- package/dist/config/webpack-fallbacks-aliases.d.ts +4 -0
- package/dist/config/webpack-fallbacks-aliases.js +4 -0
- package/dist/config/webpack-fallbacks-aliases.js.map +1 -1
- package/dist/config/webpack-fallbacks-provide-plugin-config.d.ts +4 -0
- package/dist/config/webpack-fallbacks-provide-plugin-config.js +4 -0
- package/dist/config/webpack-fallbacks-provide-plugin-config.js.map +1 -1
- package/dist/config/webpack-fallbacks.d.ts +4 -0
- package/dist/config/webpack-fallbacks.js +5 -0
- package/dist/config/webpack-fallbacks.js.map +1 -1
- package/dist/events/webpack-compilation-done-event.d.ts +4 -0
- package/dist/events/webpack-compilation-done-event.js +5 -0
- package/dist/events/webpack-compilation-done-event.js.map +1 -1
- package/dist/events/webpack-compilation-started-event.d.ts +4 -0
- package/dist/events/webpack-compilation-started-event.js +4 -0
- package/dist/events/webpack-compilation-started-event.js.map +1 -1
- package/dist/index.d.ts +14 -0
- package/dist/index.js.map +1 -1
- package/dist/plugins/webpack-bit-reporter-plugin.d.ts +4 -0
- package/dist/plugins/webpack-bit-reporter-plugin.js.map +1 -1
- package/dist/{preview-1786731350011.js → preview-1786879175452.js} +2 -2
- package/dist/run-transformer.d.ts +4 -0
- package/dist/run-transformer.js +4 -0
- package/dist/run-transformer.js.map +1 -1
- package/dist/transformers/inject-body.d.ts +3 -0
- package/dist/transformers/inject-body.js +3 -0
- package/dist/transformers/inject-body.js.map +1 -1
- package/dist/transformers/inject-head.d.ts +3 -0
- package/dist/transformers/inject-head.js +3 -0
- package/dist/transformers/inject-head.js.map +1 -1
- package/dist/transformers/transformers.d.ts +6 -0
- package/dist/transformers/transformers.js +7 -0
- package/dist/transformers/transformers.js.map +1 -1
- package/dist/webpack.bundler.d.ts +5 -0
- package/dist/webpack.bundler.js +5 -0
- package/dist/webpack.bundler.js.map +1 -1
- package/dist/webpack.dev-server.d.ts +5 -0
- package/dist/webpack.dev-server.js +5 -0
- package/dist/webpack.dev-server.js.map +1 -1
- package/dist/webpack.main.runtime.d.ts +35 -0
- package/dist/webpack.main.runtime.js +42 -0
- package/dist/webpack.main.runtime.js.map +1 -1
- package/events/webpack-compilation-done-event.ts +4 -0
- package/events/webpack-compilation-started-event.ts +4 -0
- package/package.json +6 -6
- package/plugins/webpack-bit-reporter-plugin.ts +4 -0
- package/transformers/inject-body.ts +3 -0
- package/transformers/inject-head.ts +3 -0
- package/transformers/transformers.ts +6 -0
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated `@teambit/webpack.webpack-bundler` ships its own copy of this and no longer reads
|
|
3
|
+
* it from here. Kept only for backward-compatible `from '@teambit/webpack'` imports.
|
|
4
|
+
*/
|
|
1
5
|
export const fallbacksAliases = {
|
|
2
6
|
process: require.resolve('process/browser'),
|
|
3
7
|
buffer: require.resolve('buffer/'),
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated `@teambit/webpack.webpack-bundler` ships its own copy of this and no longer reads
|
|
3
|
+
* it from here. Kept only for backward-compatible `from '@teambit/webpack'` imports.
|
|
4
|
+
*/
|
|
1
5
|
export const fallbacksProvidePluginConfig = {
|
|
2
6
|
process: require.resolve('process/browser'),
|
|
3
7
|
Buffer: [require.resolve('buffer/'), 'Buffer'],
|
|
@@ -27,6 +27,10 @@ const utilFallbackPath = require.resolve('util/');
|
|
|
27
27
|
const vmFallbackPath = require.resolve('vm-browserify');
|
|
28
28
|
const zlibFallbackPath = require.resolve('browserify-zlib');
|
|
29
29
|
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated `@teambit/webpack.webpack-bundler` ships its own copy of this and no longer reads
|
|
32
|
+
* it from here. Kept only for backward-compatible `from '@teambit/webpack'` imports.
|
|
33
|
+
*/
|
|
30
34
|
export const fallbacks = {
|
|
31
35
|
assert: assertFallbackPath,
|
|
32
36
|
events: eventsFallbackPath,
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated `@teambit/webpack.webpack-bundler` ships its own copy of this and no longer reads
|
|
3
|
+
* it from here. Kept only for backward-compatible `from '@teambit/webpack'` imports.
|
|
4
|
+
*/
|
|
1
5
|
export declare const fallbacksAliases: {
|
|
2
6
|
process: string;
|
|
3
7
|
buffer: string;
|
|
@@ -4,6 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.fallbacksAliases = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated `@teambit/webpack.webpack-bundler` ships its own copy of this and no longer reads
|
|
9
|
+
* it from here. Kept only for backward-compatible `from '@teambit/webpack'` imports.
|
|
10
|
+
*/
|
|
7
11
|
const fallbacksAliases = exports.fallbacksAliases = {
|
|
8
12
|
process: require.resolve('process/browser'),
|
|
9
13
|
buffer: require.resolve('buffer/')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["fallbacksAliases","exports","process","require","resolve","buffer"],"sources":["webpack-fallbacks-aliases.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"names":["fallbacksAliases","exports","process","require","resolve","buffer"],"sources":["webpack-fallbacks-aliases.ts"],"sourcesContent":["/**\n * @deprecated `@teambit/webpack.webpack-bundler` ships its own copy of this and no longer reads\n * it from here. Kept only for backward-compatible `from '@teambit/webpack'` imports.\n */\nexport const fallbacksAliases = {\n process: require.resolve('process/browser'),\n buffer: require.resolve('buffer/'),\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACO,MAAMA,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG;EAC9BE,OAAO,EAAEC,OAAO,CAACC,OAAO,CAAC,iBAAiB,CAAC;EAC3CC,MAAM,EAAEF,OAAO,CAACC,OAAO,CAAC,SAAS;AACnC,CAAC","ignoreList":[]}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated `@teambit/webpack.webpack-bundler` ships its own copy of this and no longer reads
|
|
3
|
+
* it from here. Kept only for backward-compatible `from '@teambit/webpack'` imports.
|
|
4
|
+
*/
|
|
1
5
|
export declare const fallbacksProvidePluginConfig: {
|
|
2
6
|
process: string;
|
|
3
7
|
Buffer: string[];
|
|
@@ -4,6 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.fallbacksProvidePluginConfig = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated `@teambit/webpack.webpack-bundler` ships its own copy of this and no longer reads
|
|
9
|
+
* it from here. Kept only for backward-compatible `from '@teambit/webpack'` imports.
|
|
10
|
+
*/
|
|
7
11
|
const fallbacksProvidePluginConfig = exports.fallbacksProvidePluginConfig = {
|
|
8
12
|
process: require.resolve('process/browser'),
|
|
9
13
|
Buffer: [require.resolve('buffer/'), 'Buffer']
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["fallbacksProvidePluginConfig","exports","process","require","resolve","Buffer"],"sources":["webpack-fallbacks-provide-plugin-config.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"names":["fallbacksProvidePluginConfig","exports","process","require","resolve","Buffer"],"sources":["webpack-fallbacks-provide-plugin-config.ts"],"sourcesContent":["/**\n * @deprecated `@teambit/webpack.webpack-bundler` ships its own copy of this and no longer reads\n * it from here. Kept only for backward-compatible `from '@teambit/webpack'` imports.\n */\nexport const fallbacksProvidePluginConfig = {\n process: require.resolve('process/browser'),\n Buffer: [require.resolve('buffer/'), 'Buffer'],\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACO,MAAMA,4BAA4B,GAAAC,OAAA,CAAAD,4BAAA,GAAG;EAC1CE,OAAO,EAAEC,OAAO,CAACC,OAAO,CAAC,iBAAiB,CAAC;EAC3CC,MAAM,EAAE,CAACF,OAAO,CAACC,OAAO,CAAC,SAAS,CAAC,EAAE,QAAQ;AAC/C,CAAC","ignoreList":[]}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated `@teambit/webpack.webpack-bundler` ships its own copy of this and no longer reads
|
|
3
|
+
* it from here. Kept only for backward-compatible `from '@teambit/webpack'` imports.
|
|
4
|
+
*/
|
|
1
5
|
export declare const fallbacks: {
|
|
2
6
|
readonly assert: string;
|
|
3
7
|
readonly events: string;
|
|
@@ -32,6 +32,11 @@ const urlFallbackPath = require.resolve('url/');
|
|
|
32
32
|
const utilFallbackPath = require.resolve('util/');
|
|
33
33
|
const vmFallbackPath = require.resolve('vm-browserify');
|
|
34
34
|
const zlibFallbackPath = require.resolve('browserify-zlib');
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated `@teambit/webpack.webpack-bundler` ships its own copy of this and no longer reads
|
|
38
|
+
* it from here. Kept only for backward-compatible `from '@teambit/webpack'` imports.
|
|
39
|
+
*/
|
|
35
40
|
const fallbacks = exports.fallbacks = {
|
|
36
41
|
assert: assertFallbackPath,
|
|
37
42
|
events: eventsFallbackPath,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["assertFallbackPath","require","resolve","bufferFallbackPath","constantsFallbackPath","cryptoFallbackPath","domainFallbackPath","httpFallbackPath","httpsFallbackPath","osFallbackPath","pathFallbackPath","punycodeFallbackPath","processFallbackPath","eventsFallbackPath","querystringFallbackPath","streamFallbackPath","string_decoderFallbackPath","sysFallbackPath","timersFallbackPath","ttyFallbackPath","urlFallbackPath","utilFallbackPath","vmFallbackPath","zlibFallbackPath","fallbacks","exports","assert","events","buffer","constants","crypto","domain","http","https","os","path","punycode","process","querystring","stream","string_decoder","sys","timers","tty","url","util","vm","zlib","fs","net","tls","child_process"],"sources":["webpack-fallbacks.ts"],"sourcesContent":["// based on https://github1s.com/vercel/next.js/blob/canary/packages/next/build/webpack-config.ts\n// Full list of old polyfills is accessible here:\n// https://github.com/webpack/webpack/blob/2a0536cf510768111a3a6dceeb14cb79b9f59273/lib/ModuleNotFoundError.js#L13-L42\n\nconst assertFallbackPath = require.resolve('assert/');\nconst bufferFallbackPath = require.resolve('buffer/');\nconst constantsFallbackPath = require.resolve('constants-browserify');\nconst cryptoFallbackPath = require.resolve('crypto-browserify');\nconst domainFallbackPath = require.resolve('domain-browser');\nconst httpFallbackPath = require.resolve('stream-http');\nconst httpsFallbackPath = require.resolve('https-browserify');\nconst osFallbackPath = require.resolve('os-browserify/browser');\nconst pathFallbackPath = require.resolve('path-browserify');\nconst punycodeFallbackPath = require.resolve('punycode/');\nconst processFallbackPath = require.resolve('process/browser');\nconst eventsFallbackPath = require.resolve('events/');\n// Handled in separate alias\nconst querystringFallbackPath = require.resolve('querystring-es3');\nconst streamFallbackPath = require.resolve('stream-browserify');\nconst string_decoderFallbackPath = require.resolve('string_decoder/');\nconst sysFallbackPath = require.resolve('util/');\nconst timersFallbackPath = require.resolve('timers-browserify');\nconst ttyFallbackPath = require.resolve('tty-browserify');\n// Handled in separate alias\nconst urlFallbackPath = require.resolve('url/');\nconst utilFallbackPath = require.resolve('util/');\nconst vmFallbackPath = require.resolve('vm-browserify');\nconst zlibFallbackPath = require.resolve('browserify-zlib');\n\nexport const fallbacks = {\n assert: assertFallbackPath,\n events: eventsFallbackPath,\n buffer: bufferFallbackPath,\n constants: constantsFallbackPath,\n crypto: cryptoFallbackPath,\n domain: domainFallbackPath,\n http: httpFallbackPath,\n https: httpsFallbackPath,\n os: osFallbackPath,\n path: pathFallbackPath,\n punycode: punycodeFallbackPath,\n process: processFallbackPath,\n querystring: querystringFallbackPath,\n stream: streamFallbackPath,\n string_decoder: string_decoderFallbackPath,\n sys: sysFallbackPath,\n timers: timersFallbackPath,\n tty: ttyFallbackPath,\n url: urlFallbackPath,\n util: utilFallbackPath,\n vm: vmFallbackPath,\n zlib: zlibFallbackPath,\n fs: false,\n net: false,\n tls: false,\n child_process: false,\n // file: false,\n // module: false,\n // pnpapi: false,\n // readline: false,\n // worker_threads: false,\n} as const;\n"],"mappings":";;;;;;AAAA;AACA;AACA;;AAEA,MAAMA,kBAAkB,GAAGC,OAAO,CAACC,OAAO,CAAC,SAAS,CAAC;AACrD,MAAMC,kBAAkB,GAAGF,OAAO,CAACC,OAAO,CAAC,SAAS,CAAC;AACrD,MAAME,qBAAqB,GAAGH,OAAO,CAACC,OAAO,CAAC,sBAAsB,CAAC;AACrE,MAAMG,kBAAkB,GAAGJ,OAAO,CAACC,OAAO,CAAC,mBAAmB,CAAC;AAC/D,MAAMI,kBAAkB,GAAGL,OAAO,CAACC,OAAO,CAAC,gBAAgB,CAAC;AAC5D,MAAMK,gBAAgB,GAAGN,OAAO,CAACC,OAAO,CAAC,aAAa,CAAC;AACvD,MAAMM,iBAAiB,GAAGP,OAAO,CAACC,OAAO,CAAC,kBAAkB,CAAC;AAC7D,MAAMO,cAAc,GAAGR,OAAO,CAACC,OAAO,CAAC,uBAAuB,CAAC;AAC/D,MAAMQ,gBAAgB,GAAGT,OAAO,CAACC,OAAO,CAAC,iBAAiB,CAAC;AAC3D,MAAMS,oBAAoB,GAAGV,OAAO,CAACC,OAAO,CAAC,WAAW,CAAC;AACzD,MAAMU,mBAAmB,GAAGX,OAAO,CAACC,OAAO,CAAC,iBAAiB,CAAC;AAC9D,MAAMW,kBAAkB,GAAGZ,OAAO,CAACC,OAAO,CAAC,SAAS,CAAC;AACrD;AACA,MAAMY,uBAAuB,GAAGb,OAAO,CAACC,OAAO,CAAC,iBAAiB,CAAC;AAClE,MAAMa,kBAAkB,GAAGd,OAAO,CAACC,OAAO,CAAC,mBAAmB,CAAC;AAC/D,MAAMc,0BAA0B,GAAGf,OAAO,CAACC,OAAO,CAAC,iBAAiB,CAAC;AACrE,MAAMe,eAAe,GAAGhB,OAAO,CAACC,OAAO,CAAC,OAAO,CAAC;AAChD,MAAMgB,kBAAkB,GAAGjB,OAAO,CAACC,OAAO,CAAC,mBAAmB,CAAC;AAC/D,MAAMiB,eAAe,GAAGlB,OAAO,CAACC,OAAO,CAAC,gBAAgB,CAAC;AACzD;AACA,MAAMkB,eAAe,GAAGnB,OAAO,CAACC,OAAO,CAAC,MAAM,CAAC;AAC/C,MAAMmB,gBAAgB,GAAGpB,OAAO,CAACC,OAAO,CAAC,OAAO,CAAC;AACjD,MAAMoB,cAAc,GAAGrB,OAAO,CAACC,OAAO,CAAC,eAAe,CAAC;AACvD,MAAMqB,gBAAgB,GAAGtB,OAAO,CAACC,OAAO,CAAC,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"names":["assertFallbackPath","require","resolve","bufferFallbackPath","constantsFallbackPath","cryptoFallbackPath","domainFallbackPath","httpFallbackPath","httpsFallbackPath","osFallbackPath","pathFallbackPath","punycodeFallbackPath","processFallbackPath","eventsFallbackPath","querystringFallbackPath","streamFallbackPath","string_decoderFallbackPath","sysFallbackPath","timersFallbackPath","ttyFallbackPath","urlFallbackPath","utilFallbackPath","vmFallbackPath","zlibFallbackPath","fallbacks","exports","assert","events","buffer","constants","crypto","domain","http","https","os","path","punycode","process","querystring","stream","string_decoder","sys","timers","tty","url","util","vm","zlib","fs","net","tls","child_process"],"sources":["webpack-fallbacks.ts"],"sourcesContent":["// based on https://github1s.com/vercel/next.js/blob/canary/packages/next/build/webpack-config.ts\n// Full list of old polyfills is accessible here:\n// https://github.com/webpack/webpack/blob/2a0536cf510768111a3a6dceeb14cb79b9f59273/lib/ModuleNotFoundError.js#L13-L42\n\nconst assertFallbackPath = require.resolve('assert/');\nconst bufferFallbackPath = require.resolve('buffer/');\nconst constantsFallbackPath = require.resolve('constants-browserify');\nconst cryptoFallbackPath = require.resolve('crypto-browserify');\nconst domainFallbackPath = require.resolve('domain-browser');\nconst httpFallbackPath = require.resolve('stream-http');\nconst httpsFallbackPath = require.resolve('https-browserify');\nconst osFallbackPath = require.resolve('os-browserify/browser');\nconst pathFallbackPath = require.resolve('path-browserify');\nconst punycodeFallbackPath = require.resolve('punycode/');\nconst processFallbackPath = require.resolve('process/browser');\nconst eventsFallbackPath = require.resolve('events/');\n// Handled in separate alias\nconst querystringFallbackPath = require.resolve('querystring-es3');\nconst streamFallbackPath = require.resolve('stream-browserify');\nconst string_decoderFallbackPath = require.resolve('string_decoder/');\nconst sysFallbackPath = require.resolve('util/');\nconst timersFallbackPath = require.resolve('timers-browserify');\nconst ttyFallbackPath = require.resolve('tty-browserify');\n// Handled in separate alias\nconst urlFallbackPath = require.resolve('url/');\nconst utilFallbackPath = require.resolve('util/');\nconst vmFallbackPath = require.resolve('vm-browserify');\nconst zlibFallbackPath = require.resolve('browserify-zlib');\n\n/**\n * @deprecated `@teambit/webpack.webpack-bundler` ships its own copy of this and no longer reads\n * it from here. Kept only for backward-compatible `from '@teambit/webpack'` imports.\n */\nexport const fallbacks = {\n assert: assertFallbackPath,\n events: eventsFallbackPath,\n buffer: bufferFallbackPath,\n constants: constantsFallbackPath,\n crypto: cryptoFallbackPath,\n domain: domainFallbackPath,\n http: httpFallbackPath,\n https: httpsFallbackPath,\n os: osFallbackPath,\n path: pathFallbackPath,\n punycode: punycodeFallbackPath,\n process: processFallbackPath,\n querystring: querystringFallbackPath,\n stream: streamFallbackPath,\n string_decoder: string_decoderFallbackPath,\n sys: sysFallbackPath,\n timers: timersFallbackPath,\n tty: ttyFallbackPath,\n url: urlFallbackPath,\n util: utilFallbackPath,\n vm: vmFallbackPath,\n zlib: zlibFallbackPath,\n fs: false,\n net: false,\n tls: false,\n child_process: false,\n // file: false,\n // module: false,\n // pnpapi: false,\n // readline: false,\n // worker_threads: false,\n} as const;\n"],"mappings":";;;;;;AAAA;AACA;AACA;;AAEA,MAAMA,kBAAkB,GAAGC,OAAO,CAACC,OAAO,CAAC,SAAS,CAAC;AACrD,MAAMC,kBAAkB,GAAGF,OAAO,CAACC,OAAO,CAAC,SAAS,CAAC;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MoB,cAAc,GAAGrB,OAAO,CAACC,OAAO,CAAC,eAAe,CAAC;AACvD,MAAMqB,gBAAgB,GAAGtB,OAAO,CAACC,OAAO,CAAC,iBAAiB,CAAC;;AAE3D;AACA;AACA;AACA;AACO,MAAMsB,SAAS,GAAAC,OAAA,CAAAD,SAAA,GAAG;EACvBE,MAAM,EAAE1B,kBAAkB;EAC1B2B,MAAM,EAAEd,kBAAkB;EAC1Be,MAAM,EAAEzB,kBAAkB;EAC1B0B,SAAS,EAAEzB,qBAAqB;EAChC0B,MAAM,EAAEzB,kBAAkB;EAC1B0B,MAAM,EAAEzB,kBAAkB;EAC1B0B,IAAI,EAAEzB,gBAAgB;EACtB0B,KAAK,EAAEzB,iBAAiB;EACxB0B,EAAE,EAAEzB,cAAc;EAClB0B,IAAI,EAAEzB,gBAAgB;EACtB0B,QAAQ,EAAEzB,oBAAoB;EAC9B0B,OAAO,EAAEzB,mBAAmB;EAC5B0B,WAAW,EAAExB,uBAAuB;EACpCyB,MAAM,EAAExB,kBAAkB;EAC1ByB,cAAc,EAAExB,0BAA0B;EAC1CyB,GAAG,EAAExB,eAAe;EACpByB,MAAM,EAAExB,kBAAkB;EAC1ByB,GAAG,EAAExB,eAAe;EACpByB,GAAG,EAAExB,eAAe;EACpByB,IAAI,EAAExB,gBAAgB;EACtByB,EAAE,EAAExB,cAAc;EAClByB,IAAI,EAAExB,gBAAgB;EACtByB,EAAE,EAAE,KAAK;EACTC,GAAG,EAAE,KAAK;EACVC,GAAG,EAAE,KAAK;EACVC,aAAa,EAAE;EACf;EACA;EACA;EACA;EACA;AACF,CAAU","ignoreList":[]}
|
|
@@ -5,6 +5,10 @@ declare class WebpackCompilationDoneEventData {
|
|
|
5
5
|
readonly devServerID: string;
|
|
6
6
|
constructor(stats: Stats, devServerID: string);
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated not published by anything in this aspect (nor by `@teambit/webpack.webpack-bundler`/
|
|
10
|
+
* `@teambit/webpack.webpack-dev-server`, its replacements). Kept only for backward-compatible imports.
|
|
11
|
+
*/
|
|
8
12
|
export declare class WebpackCompilationDoneEvent extends BitBaseEvent<WebpackCompilationDoneEventData> {
|
|
9
13
|
readonly timestamp: number;
|
|
10
14
|
readonly stats: Stats;
|
|
@@ -20,6 +20,11 @@ class WebpackCompilationDoneEventData {
|
|
|
20
20
|
this.devServerID = devServerID;
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @deprecated not published by anything in this aspect (nor by `@teambit/webpack.webpack-bundler`/
|
|
26
|
+
* `@teambit/webpack.webpack-dev-server`, its replacements). Kept only for backward-compatible imports.
|
|
27
|
+
*/
|
|
23
28
|
class WebpackCompilationDoneEvent extends _pubsub().BitBaseEvent {
|
|
24
29
|
constructor(timestamp, stats, devServerID) {
|
|
25
30
|
super(WebpackCompilationDoneEvent.TYPE, '0.0.1', timestamp, new WebpackCompilationDoneEventData(stats, devServerID));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_pubsub","data","require","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","WebpackCompilationDoneEventData","constructor","stats","devServerID","WebpackCompilationDoneEvent","BitBaseEvent","timestamp","TYPE","exports"],"sources":["webpack-compilation-done-event.ts"],"sourcesContent":["/* eslint-disable max-classes-per-file */\nimport type { Stats } from 'webpack';\nimport { BitBaseEvent } from '@teambit/pubsub';\n\nclass WebpackCompilationDoneEventData {\n constructor(\n readonly stats: Stats,\n readonly devServerID: string\n ) {}\n}\n\nexport class WebpackCompilationDoneEvent extends BitBaseEvent<WebpackCompilationDoneEventData> {\n static readonly TYPE = 'webpack-compilation-done';\n\n constructor(\n readonly timestamp: number,\n readonly stats: Stats,\n readonly devServerID: string\n ) {\n super(\n WebpackCompilationDoneEvent.TYPE,\n '0.0.1',\n timestamp,\n new WebpackCompilationDoneEventData(stats, devServerID)\n );\n }\n}\n"],"mappings":";;;;;;AAEA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA+C,SAAAE,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,CAAAC,cAAA,CAAAL,CAAA,EAAAC,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAT,CAAA,CAAAC,CAAA,IAAAC,CAAA,EAAAF,CAAA;AAAA,SAAAG,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAF,CAAA,GAAAE,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAb,CAAA,QAAAU,CAAA,GAAAV,CAAA,CAAAc,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAAAe,MAAA,GAAAC,MAAA,EAAAf,CAAA,KAF/C;AAIA,MAAMgB,+BAA+B,CAAC;EACpCC,WAAWA,CACAC,KAAY,EACZC,WAAmB,EAC5B;IAAA,KAFSD,KAAY,GAAZA,KAAY;IAAA,KACZC,WAAmB,GAAnBA,WAAmB;EAC3B;AACL;
|
|
1
|
+
{"version":3,"names":["_pubsub","data","require","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","WebpackCompilationDoneEventData","constructor","stats","devServerID","WebpackCompilationDoneEvent","BitBaseEvent","timestamp","TYPE","exports"],"sources":["webpack-compilation-done-event.ts"],"sourcesContent":["/* eslint-disable max-classes-per-file */\nimport type { Stats } from 'webpack';\nimport { BitBaseEvent } from '@teambit/pubsub';\n\nclass WebpackCompilationDoneEventData {\n constructor(\n readonly stats: Stats,\n readonly devServerID: string\n ) {}\n}\n\n/**\n * @deprecated not published by anything in this aspect (nor by `@teambit/webpack.webpack-bundler`/\n * `@teambit/webpack.webpack-dev-server`, its replacements). Kept only for backward-compatible imports.\n */\nexport class WebpackCompilationDoneEvent extends BitBaseEvent<WebpackCompilationDoneEventData> {\n static readonly TYPE = 'webpack-compilation-done';\n\n constructor(\n readonly timestamp: number,\n readonly stats: Stats,\n readonly devServerID: string\n ) {\n super(\n WebpackCompilationDoneEvent.TYPE,\n '0.0.1',\n timestamp,\n new WebpackCompilationDoneEventData(stats, devServerID)\n );\n }\n}\n"],"mappings":";;;;;;AAEA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA+C,SAAAE,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,CAAAC,cAAA,CAAAL,CAAA,EAAAC,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAT,CAAA,CAAAC,CAAA,IAAAC,CAAA,EAAAF,CAAA;AAAA,SAAAG,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAF,CAAA,GAAAE,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAb,CAAA,QAAAU,CAAA,GAAAV,CAAA,CAAAc,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAAAe,MAAA,GAAAC,MAAA,EAAAf,CAAA,KAF/C;AAIA,MAAMgB,+BAA+B,CAAC;EACpCC,WAAWA,CACAC,KAAY,EACZC,WAAmB,EAC5B;IAAA,KAFSD,KAAY,GAAZA,KAAY;IAAA,KACZC,WAAmB,GAAnBA,WAAmB;EAC3B;AACL;;AAEA;AACA;AACA;AACA;AACO,MAAMC,2BAA2B,SAASC,sBAAY,CAAkC;EAG7FJ,WAAWA,CACAK,SAAiB,EACjBJ,KAAY,EACZC,WAAmB,EAC5B;IACA,KAAK,CACHC,2BAA2B,CAACG,IAAI,EAChC,OAAO,EACPD,SAAS,EACT,IAAIN,+BAA+B,CAACE,KAAK,EAAEC,WAAW,CACxD,CAAC;IAAC,KATOG,SAAiB,GAAjBA,SAAiB;IAAA,KACjBJ,KAAY,GAAZA,KAAY;IAAA,KACZC,WAAmB,GAAnBA,WAAmB;EAQ9B;AACF;AAACK,OAAA,CAAAJ,2BAAA,GAAAA,2BAAA;AAAAvB,eAAA,CAfYuB,2BAA2B,UACf,0BAA0B","ignoreList":[]}
|
|
@@ -2,6 +2,10 @@ import { BitBaseEvent } from '@teambit/pubsub';
|
|
|
2
2
|
type Params = {
|
|
3
3
|
devServerID: string;
|
|
4
4
|
};
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated not published by anything in this aspect (nor by `@teambit/webpack.webpack-bundler`/
|
|
7
|
+
* `@teambit/webpack.webpack-dev-server`, its replacements). Kept only for backward-compatible imports.
|
|
8
|
+
*/
|
|
5
9
|
export declare class WebpackCompilationStartedEvent extends BitBaseEvent<Params> {
|
|
6
10
|
readonly timestamp: any;
|
|
7
11
|
readonly params: Params;
|
|
@@ -14,6 +14,10 @@ function _pubsub() {
|
|
|
14
14
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
15
15
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
16
16
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /* eslint-disable max-classes-per-file */
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated not published by anything in this aspect (nor by `@teambit/webpack.webpack-bundler`/
|
|
19
|
+
* `@teambit/webpack.webpack-dev-server`, its replacements). Kept only for backward-compatible imports.
|
|
20
|
+
*/
|
|
17
21
|
class WebpackCompilationStartedEvent extends _pubsub().BitBaseEvent {
|
|
18
22
|
constructor(timestamp, params) {
|
|
19
23
|
super(WebpackCompilationStartedEvent.TYPE, '0.0.1', timestamp, params);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_pubsub","data","require","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","WebpackCompilationStartedEvent","BitBaseEvent","constructor","timestamp","params","TYPE","exports"],"sources":["webpack-compilation-started-event.ts"],"sourcesContent":["/* eslint-disable max-classes-per-file */\nimport { BitBaseEvent } from '@teambit/pubsub';\n\ntype Params = {\n devServerID: string;\n};\n\nexport class WebpackCompilationStartedEvent extends BitBaseEvent<Params> {\n static readonly TYPE = 'webpack-compilation-started';\n\n constructor(\n readonly timestamp,\n readonly params: Params\n ) {\n super(WebpackCompilationStartedEvent.TYPE, '0.0.1', timestamp, params);\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA+C,SAAAE,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,CAAAC,cAAA,CAAAL,CAAA,EAAAC,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAT,CAAA,CAAAC,CAAA,IAAAC,CAAA,EAAAF,CAAA;AAAA,SAAAG,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAF,CAAA,GAAAE,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAb,CAAA,QAAAU,CAAA,GAAAV,CAAA,CAAAc,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAAAe,MAAA,GAAAC,MAAA,EAAAf,CAAA,KAD/C;
|
|
1
|
+
{"version":3,"names":["_pubsub","data","require","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","WebpackCompilationStartedEvent","BitBaseEvent","constructor","timestamp","params","TYPE","exports"],"sources":["webpack-compilation-started-event.ts"],"sourcesContent":["/* eslint-disable max-classes-per-file */\nimport { BitBaseEvent } from '@teambit/pubsub';\n\ntype Params = {\n devServerID: string;\n};\n\n/**\n * @deprecated not published by anything in this aspect (nor by `@teambit/webpack.webpack-bundler`/\n * `@teambit/webpack.webpack-dev-server`, its replacements). Kept only for backward-compatible imports.\n */\nexport class WebpackCompilationStartedEvent extends BitBaseEvent<Params> {\n static readonly TYPE = 'webpack-compilation-started';\n\n constructor(\n readonly timestamp,\n readonly params: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AAA,CATYmB,8BAA8B,UAClB,6BAA6B","ignoreList":[]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated component previews/apps no longer build through this aspect - the react/node/aspect
|
|
3
|
+
* envs bundle with `@teambit/webpack.webpack-bundler` and `@teambit/webpack.webpack-dev-server`
|
|
4
|
+
* directly (see
|
|
5
|
+
* https://bit.cloud/teambit/webpack/~change-requests/decouple-webpack-bundler-from-webpack-aspect).
|
|
6
|
+
* Everything below is kept only for backward-compatible `from '@teambit/webpack'` imports; see each
|
|
7
|
+
* export's own `@deprecated` note for where to source it from instead.
|
|
8
|
+
*/
|
|
1
9
|
export type { WebpackMain, WebpackConfigTransformer, WebpackConfigTransformContext, WebpackConfigDevServerTransformContext, GlobalWebpackConfigTransformContext, WebpackConfigDevServerTransformer, } from './webpack.main.runtime';
|
|
2
10
|
export { runTransformersWithContext } from './run-transformer';
|
|
3
11
|
export { WebpackAspect } from './webpack.aspect';
|
|
@@ -5,7 +13,13 @@ export { WebpackDevServer } from './webpack.dev-server';
|
|
|
5
13
|
export { WebpackBundler } from './webpack.bundler';
|
|
6
14
|
export type { WebpackConfigWithDevServer } from './webpack.dev-server';
|
|
7
15
|
export { WebpackCompilationDoneEvent, WebpackCompilationStartedEvent } from './events';
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated import directly from `webpack` instead.
|
|
18
|
+
*/
|
|
8
19
|
export type { Configuration } from 'webpack';
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated import directly from `@teambit/webpack.modules.config-mutator` instead.
|
|
22
|
+
*/
|
|
9
23
|
export { WebpackConfigMutator } from '@teambit/webpack.modules.config-mutator';
|
|
10
24
|
export { WebpackBitReporterPlugin } from './plugins/webpack-bit-reporter-plugin';
|
|
11
25
|
export { fallbacks } from './config/webpack-fallbacks';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_runTransformer","data","require","_webpack","_webpack2","_webpack3","_events","_webpackModules","_webpackBitReporterPlugin","_webpackFallbacks","_webpackFallbacksAliases","_webpackFallbacksProvidePluginConfig","_transformers"],"sources":["index.ts"],"sourcesContent":["export type {\n WebpackMain,\n WebpackConfigTransformer,\n WebpackConfigTransformContext,\n WebpackConfigDevServerTransformContext,\n GlobalWebpackConfigTransformContext,\n WebpackConfigDevServerTransformer,\n} from './webpack.main.runtime';\nexport { runTransformersWithContext } from './run-transformer';\nexport { WebpackAspect } from './webpack.aspect';\nexport { WebpackDevServer } from './webpack.dev-server';\nexport { WebpackBundler } from './webpack.bundler';\nexport type { WebpackConfigWithDevServer } from './webpack.dev-server';\nexport { WebpackCompilationDoneEvent, WebpackCompilationStartedEvent } from './events';\nexport type { Configuration } from 'webpack';\nexport { WebpackConfigMutator } from '@teambit/webpack.modules.config-mutator';\nexport { WebpackBitReporterPlugin } from './plugins/webpack-bit-reporter-plugin';\nexport { fallbacks } from './config/webpack-fallbacks';\nexport { fallbacksAliases } from './config/webpack-fallbacks-aliases';\nexport { fallbacksProvidePluginConfig } from './config/webpack-fallbacks-provide-plugin-config';\nexport {\n GenerateBodyInjectionTransformer,\n BodyInjectionOptions,\n generateAddAliasesFromPeersTransformer,\n generateExposePeersTransformer,\n generateExternalsTransformer,\n GenerateHeadInjectionTransformer,\n HeadInjectionOptions,\n} from './transformers';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"names":["_runTransformer","data","require","_webpack","_webpack2","_webpack3","_events","_webpackModules","_webpackBitReporterPlugin","_webpackFallbacks","_webpackFallbacksAliases","_webpackFallbacksProvidePluginConfig","_transformers"],"sources":["index.ts"],"sourcesContent":["/**\n * @deprecated component previews/apps no longer build through this aspect - the react/node/aspect\n * envs bundle with `@teambit/webpack.webpack-bundler` and `@teambit/webpack.webpack-dev-server`\n * directly (see\n * https://bit.cloud/teambit/webpack/~change-requests/decouple-webpack-bundler-from-webpack-aspect).\n * Everything below is kept only for backward-compatible `from '@teambit/webpack'` imports; see each\n * export's own `@deprecated` note for where to source it from instead.\n */\nexport type {\n WebpackMain,\n WebpackConfigTransformer,\n WebpackConfigTransformContext,\n WebpackConfigDevServerTransformContext,\n GlobalWebpackConfigTransformContext,\n WebpackConfigDevServerTransformer,\n} from './webpack.main.runtime';\nexport { runTransformersWithContext } from './run-transformer';\nexport { WebpackAspect } from './webpack.aspect';\nexport { WebpackDevServer } from './webpack.dev-server';\nexport { WebpackBundler } from './webpack.bundler';\nexport type { WebpackConfigWithDevServer } from './webpack.dev-server';\nexport { WebpackCompilationDoneEvent, WebpackCompilationStartedEvent } from './events';\n/**\n * @deprecated import directly from `webpack` instead.\n */\nexport type { Configuration } from 'webpack';\n/**\n * @deprecated import directly from `@teambit/webpack.modules.config-mutator` instead.\n */\nexport { WebpackConfigMutator } from '@teambit/webpack.modules.config-mutator';\nexport { WebpackBitReporterPlugin } from './plugins/webpack-bit-reporter-plugin';\nexport { fallbacks } from './config/webpack-fallbacks';\nexport { fallbacksAliases } from './config/webpack-fallbacks-aliases';\nexport { fallbacksProvidePluginConfig } from './config/webpack-fallbacks-provide-plugin-config';\nexport {\n GenerateBodyInjectionTransformer,\n BodyInjectionOptions,\n generateAddAliasesFromPeersTransformer,\n generateExposePeersTransformer,\n generateExternalsTransformer,\n GenerateHeadInjectionTransformer,\n HeadInjectionOptions,\n} from './transformers';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,SAAAA,gBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,eAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAA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AAAU,aAAA,YAAAA,CAAA;IAAA,OAAAX,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA","ignoreList":[]}
|
|
@@ -1 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated thin re-export kept for backward-compatible `from '@teambit/webpack'` imports;
|
|
3
|
+
* import directly from `@teambit/webpack.plugins.webpack-bit-reporter-plugin` instead.
|
|
4
|
+
*/
|
|
1
5
|
export { WebpackBitReporterPlugin } from '@teambit/webpack.plugins.webpack-bit-reporter-plugin';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_webpackPlugins","data","require"],"sources":["webpack-bit-reporter-plugin.ts"],"sourcesContent":["export { WebpackBitReporterPlugin } from '@teambit/webpack.plugins.webpack-bit-reporter-plugin';\n"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"names":["_webpackPlugins","data","require"],"sources":["webpack-bit-reporter-plugin.ts"],"sourcesContent":["/**\n * @deprecated thin re-export kept for backward-compatible `from '@teambit/webpack'` imports;\n * import directly from `@teambit/webpack.plugins.webpack-bit-reporter-plugin` instead.\n */\nexport { WebpackBitReporterPlugin } from '@teambit/webpack.plugins.webpack-bit-reporter-plugin';\n"],"mappings":";;;;;;;;;;;AAIA,SAAAA,gBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,eAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.webpack_webpack@1.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.webpack_webpack@1.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.webpack_webpack@1.0.1106/dist/webpack.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.webpack_webpack@1.0.1106/dist/webpack.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import type { WebpackConfigMutator } from '@teambit/webpack.modules.config-mutator';
|
|
2
2
|
import type { WebpackConfigDevServerTransformer, WebpackConfigTransformer } from './webpack.main.runtime';
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated equivalent to `@teambit/webpack.webpack-bundler`'s `runTransformers`. Kept only for
|
|
5
|
+
* backward-compatible `from '@teambit/webpack'` imports.
|
|
6
|
+
*/
|
|
3
7
|
export declare function runTransformersWithContext(config: WebpackConfigMutator, transformers: Array<WebpackConfigTransformer | WebpackConfigDevServerTransformer> | undefined, context: any): WebpackConfigMutator;
|
package/dist/run-transformer.js
CHANGED
|
@@ -4,6 +4,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.runTransformersWithContext = runTransformersWithContext;
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated equivalent to `@teambit/webpack.webpack-bundler`'s `runTransformers`. Kept only for
|
|
9
|
+
* backward-compatible `from '@teambit/webpack'` imports.
|
|
10
|
+
*/
|
|
7
11
|
function runTransformersWithContext(config, transformers = [],
|
|
8
12
|
// context: WebpackConfigTransformContext | WebpackConfigDevServerTransformContext
|
|
9
13
|
context) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["runTransformersWithContext","config","transformers","context","Array","isArray","newConfig","reduce","acc","transformer"],"sources":["run-transformer.ts"],"sourcesContent":["import type { WebpackConfigMutator } from '@teambit/webpack.modules.config-mutator';\nimport type { WebpackConfigDevServerTransformer, WebpackConfigTransformer } from './webpack.main.runtime';\n\nexport function runTransformersWithContext(\n config: WebpackConfigMutator,\n transformers: Array<WebpackConfigTransformer | WebpackConfigDevServerTransformer> = [],\n // context: WebpackConfigTransformContext | WebpackConfigDevServerTransformContext\n context: any\n): WebpackConfigMutator {\n if (!Array.isArray(transformers)) return config;\n const newConfig = transformers.reduce((acc, transformer) => {\n return transformer(acc, context);\n }, config);\n return newConfig;\n}\n"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"names":["runTransformersWithContext","config","transformers","context","Array","isArray","newConfig","reduce","acc","transformer"],"sources":["run-transformer.ts"],"sourcesContent":["import type { WebpackConfigMutator } from '@teambit/webpack.modules.config-mutator';\nimport type { WebpackConfigDevServerTransformer, WebpackConfigTransformer } from './webpack.main.runtime';\n\n/**\n * @deprecated equivalent to `@teambit/webpack.webpack-bundler`'s `runTransformers`. Kept only for\n * backward-compatible `from '@teambit/webpack'` imports.\n */\nexport function runTransformersWithContext(\n config: WebpackConfigMutator,\n transformers: Array<WebpackConfigTransformer | WebpackConfigDevServerTransformer> = [],\n // context: WebpackConfigTransformContext | WebpackConfigDevServerTransformContext\n context: any\n): WebpackConfigMutator {\n if (!Array.isArray(transformers)) return config;\n const newConfig = transformers.reduce((acc, transformer) => {\n return transformer(acc, context);\n }, config);\n return newConfig;\n}\n"],"mappings":";;;;;;AAGA;AACA;AACA;AACA;AACO,SAASA,0BAA0BA,CACxCC,MAA4B,EAC5BC,YAAiF,GAAG,EAAE;AACtF;AACAC,OAAY,EACU;EACtB,IAAI,CAACC,KAAK,CAACC,OAAO,CAACH,YAAY,CAAC,EAAE,OAAOD,MAAM;EAC/C,MAAMK,SAAS,GAAGJ,YAAY,CAACK,MAAM,CAAC,CAACC,GAAG,EAAEC,WAAW,KAAK;IAC1D,OAAOA,WAAW,CAACD,GAAG,EAAEL,OAAO,CAAC;EAClC,CAAC,EAAEF,MAAM,CAAC;EACV,OAAOK,SAAS;AAClB","ignoreList":[]}
|
|
@@ -10,5 +10,8 @@ export type BodyInjectionOptions = {
|
|
|
10
10
|
* since, the html plugin is configured via the webpack aspect, expose it from here ensure the same instance
|
|
11
11
|
* @param options
|
|
12
12
|
* @returns
|
|
13
|
+
* @deprecated the webpack aspect no longer builds the base config for react/node/aspect envs, so
|
|
14
|
+
* this is no longer guaranteed to share an `html-webpack-plugin` instance with the bundler that
|
|
15
|
+
* actually built the config (`@teambit/webpack.webpack-bundler`). Kept only for backward-compatible imports.
|
|
13
16
|
*/
|
|
14
17
|
export declare function GenerateBodyInjectionTransformer(options: BodyInjectionOptions): WebpackConfigTransformer;
|
|
@@ -19,6 +19,9 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
19
19
|
* since, the html plugin is configured via the webpack aspect, expose it from here ensure the same instance
|
|
20
20
|
* @param options
|
|
21
21
|
* @returns
|
|
22
|
+
* @deprecated the webpack aspect no longer builds the base config for react/node/aspect envs, so
|
|
23
|
+
* this is no longer guaranteed to share an `html-webpack-plugin` instance with the bundler that
|
|
24
|
+
* actually built the config (`@teambit/webpack.webpack-bundler`). Kept only for backward-compatible imports.
|
|
22
25
|
*/
|
|
23
26
|
function GenerateBodyInjectionTransformer(options) {
|
|
24
27
|
return config => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_injectBodyWebpackPlugin","data","_interopRequireDefault","require","e","__esModule","default","GenerateBodyInjectionTransformer","options","config","plugin","InjectBodyPlugin","addPlugin"],"sources":["inject-body.ts"],"sourcesContent":["import InjectBodyPlugin from 'inject-body-webpack-plugin';\nimport type { WebpackConfigTransformer } from '../webpack.main.runtime';\n\nexport type BodyInjectionOptions = {\n content: string;\n position?: 'start' | 'end';\n};\n\n/**\n * A transformer that allow you to inject content into your html body\n * We expose it from here, as it uses the inject-body-webpack-plugin which register to the html plugin hooks\n * which means it depends on the fact that it has the same html plugin instance\n * since, the html plugin is configured via the webpack aspect, expose it from here ensure the same instance\n * @param options\n * @returns\n */\nexport function GenerateBodyInjectionTransformer(options: BodyInjectionOptions): WebpackConfigTransformer {\n return (config) => {\n // @ts-ignore - https://github.com/Jaid/inject-body-webpack-plugin/issues/12\n const plugin = new InjectBodyPlugin(options);\n\n return config.addPlugin(plugin);\n };\n}\n"],"mappings":";;;;;;AAAA,SAAAA,yBAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,wBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0D,SAAAC,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAQ1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,gCAAgCA,CAACC,OAA6B,EAA4B;EACxG,OAAQC,MAAM,IAAK;IACjB;IACA,MAAMC,MAAM,GAAG,KAAIC,kCAAgB,EAACH,OAAO,CAAC;IAE5C,OAAOC,MAAM,CAACG,SAAS,CAACF,MAAM,CAAC;EACjC,CAAC;AACH","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_injectBodyWebpackPlugin","data","_interopRequireDefault","require","e","__esModule","default","GenerateBodyInjectionTransformer","options","config","plugin","InjectBodyPlugin","addPlugin"],"sources":["inject-body.ts"],"sourcesContent":["import InjectBodyPlugin from 'inject-body-webpack-plugin';\nimport type { WebpackConfigTransformer } from '../webpack.main.runtime';\n\nexport type BodyInjectionOptions = {\n content: string;\n position?: 'start' | 'end';\n};\n\n/**\n * A transformer that allow you to inject content into your html body\n * We expose it from here, as it uses the inject-body-webpack-plugin which register to the html plugin hooks\n * which means it depends on the fact that it has the same html plugin instance\n * since, the html plugin is configured via the webpack aspect, expose it from here ensure the same instance\n * @param options\n * @returns\n * @deprecated the webpack aspect no longer builds the base config for react/node/aspect envs, so\n * this is no longer guaranteed to share an `html-webpack-plugin` instance with the bundler that\n * actually built the config (`@teambit/webpack.webpack-bundler`). Kept only for backward-compatible imports.\n */\nexport function GenerateBodyInjectionTransformer(options: BodyInjectionOptions): WebpackConfigTransformer {\n return (config) => {\n // @ts-ignore - https://github.com/Jaid/inject-body-webpack-plugin/issues/12\n const plugin = new InjectBodyPlugin(options);\n\n return config.addPlugin(plugin);\n };\n}\n"],"mappings":";;;;;;AAAA,SAAAA,yBAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,wBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0D,SAAAC,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAQ1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,gCAAgCA,CAACC,OAA6B,EAA4B;EACxG,OAAQC,MAAM,IAAK;IACjB;IACA,MAAMC,MAAM,GAAG,KAAIC,kCAAgB,EAACH,OAAO,CAAC;IAE5C,OAAOC,MAAM,CAACG,SAAS,CAACF,MAAM,CAAC;EACjC,CAAC;AACH","ignoreList":[]}
|
|
@@ -10,5 +10,8 @@ export type HeadInjectionOptions = {
|
|
|
10
10
|
* since, the html plugin is configured via the webpack aspect, expose it from here ensure the same instance
|
|
11
11
|
* @param options
|
|
12
12
|
* @returns
|
|
13
|
+
* @deprecated the webpack aspect no longer builds the base config for react/node/aspect envs, so
|
|
14
|
+
* this is no longer guaranteed to share an `html-webpack-plugin` instance with the bundler that
|
|
15
|
+
* actually built the config (`@teambit/webpack.webpack-bundler`). Kept only for backward-compatible imports.
|
|
13
16
|
*/
|
|
14
17
|
export declare function GenerateHeadInjectionTransformer(options: HeadInjectionOptions): WebpackConfigTransformer;
|
|
@@ -18,6 +18,9 @@ function _webpackPlugins() {
|
|
|
18
18
|
* since, the html plugin is configured via the webpack aspect, expose it from here ensure the same instance
|
|
19
19
|
* @param options
|
|
20
20
|
* @returns
|
|
21
|
+
* @deprecated the webpack aspect no longer builds the base config for react/node/aspect envs, so
|
|
22
|
+
* this is no longer guaranteed to share an `html-webpack-plugin` instance with the bundler that
|
|
23
|
+
* actually built the config (`@teambit/webpack.webpack-bundler`). Kept only for backward-compatible imports.
|
|
21
24
|
*/
|
|
22
25
|
function GenerateHeadInjectionTransformer(options) {
|
|
23
26
|
return config => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_webpackPlugins","data","require","GenerateHeadInjectionTransformer","options","config","plugin","InjectHeadPlugin","addPlugin"],"sources":["inject-head.ts"],"sourcesContent":["import { InjectHeadPlugin } from '@teambit/webpack.plugins.inject-head-webpack-plugin';\nimport type { WebpackConfigTransformer } from '../webpack.main.runtime';\n\nexport type HeadInjectionOptions = {\n content: string;\n position?: 'start' | 'end';\n};\n\n/**\n * A transformer that allow you to inject content into your html head\n * We expose it from here, as it uses the inject-head-webpack-plugin which register to the html plugin hooks\n * which means it depends on the fact that it has the same html plugin instance\n * since, the html plugin is configured via the webpack aspect, expose it from here ensure the same instance\n * @param options\n * @returns\n */\nexport function GenerateHeadInjectionTransformer(options: HeadInjectionOptions): WebpackConfigTransformer {\n return (config) => {\n const plugin = new InjectHeadPlugin(options);\n return config.addPlugin(plugin);\n };\n}\n"],"mappings":";;;;;;AAAA,SAAAA,gBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,eAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,gCAAgCA,CAACC,OAA6B,EAA4B;EACxG,OAAQC,MAAM,IAAK;IACjB,MAAMC,MAAM,GAAG,KAAIC,kCAAgB,EAACH,OAAO,CAAC;IAC5C,OAAOC,MAAM,CAACG,SAAS,CAACF,MAAM,CAAC;EACjC,CAAC;AACH","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_webpackPlugins","data","require","GenerateHeadInjectionTransformer","options","config","plugin","InjectHeadPlugin","addPlugin"],"sources":["inject-head.ts"],"sourcesContent":["import { InjectHeadPlugin } from '@teambit/webpack.plugins.inject-head-webpack-plugin';\nimport type { WebpackConfigTransformer } from '../webpack.main.runtime';\n\nexport type HeadInjectionOptions = {\n content: string;\n position?: 'start' | 'end';\n};\n\n/**\n * A transformer that allow you to inject content into your html head\n * We expose it from here, as it uses the inject-head-webpack-plugin which register to the html plugin hooks\n * which means it depends on the fact that it has the same html plugin instance\n * since, the html plugin is configured via the webpack aspect, expose it from here ensure the same instance\n * @param options\n * @returns\n * @deprecated the webpack aspect no longer builds the base config for react/node/aspect envs, so\n * this is no longer guaranteed to share an `html-webpack-plugin` instance with the bundler that\n * actually built the config (`@teambit/webpack.webpack-bundler`). Kept only for backward-compatible imports.\n */\nexport function GenerateHeadInjectionTransformer(options: HeadInjectionOptions): WebpackConfigTransformer {\n return (config) => {\n const plugin = new InjectHeadPlugin(options);\n return config.addPlugin(plugin);\n };\n}\n"],"mappings":";;;;;;AAAA,SAAAA,gBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,eAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,gCAAgCA,CAACC,OAA6B,EAA4B;EACxG,OAAQC,MAAM,IAAK;IACjB,MAAMC,MAAM,GAAG,KAAIC,kCAAgB,EAACH,OAAO,CAAC;IAC5C,OAAOC,MAAM,CAACG,SAAS,CAACF,MAAM,CAAC;EACjC,CAAC;AACH","ignoreList":[]}
|
|
@@ -3,10 +3,16 @@ import type { Logger } from '@teambit/logger';
|
|
|
3
3
|
import { generateAddAliasesFromPeersTransformer } from '@teambit/webpack.transformers.generate-add-aliases-from-peers';
|
|
4
4
|
import { generateExternalsTransformer } from '@teambit/webpack.transformers.generate-externals';
|
|
5
5
|
import type { WebpackConfigTransformContext } from '../webpack.main.runtime';
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated these are thin re-exports kept for backward-compatible `from '@teambit/webpack'`
|
|
8
|
+
* imports; import them directly from `@teambit/webpack.transformers.generate-add-aliases-from-peers`
|
|
9
|
+
* and `@teambit/webpack.transformers.generate-externals` instead.
|
|
10
|
+
*/
|
|
6
11
|
export { generateAddAliasesFromPeersTransformer, generateExternalsTransformer };
|
|
7
12
|
/**
|
|
8
13
|
* Generate a transformer that expose all the peers as global via the expose loader
|
|
9
14
|
* @param peers
|
|
10
15
|
* @returns
|
|
16
|
+
* @deprecated unused internally; will be removed in a follow-up.
|
|
11
17
|
*/
|
|
12
18
|
export declare function generateExposePeersTransformer(peers: string[], logger: Logger): (config: WebpackConfigMutator, context: WebpackConfigTransformContext) => WebpackConfigMutator;
|
|
@@ -37,11 +37,18 @@ function _getExposedRules() {
|
|
|
37
37
|
};
|
|
38
38
|
return data;
|
|
39
39
|
}
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated these are thin re-exports kept for backward-compatible `from '@teambit/webpack'`
|
|
42
|
+
* imports; import them directly from `@teambit/webpack.transformers.generate-add-aliases-from-peers`
|
|
43
|
+
* and `@teambit/webpack.transformers.generate-externals` instead.
|
|
44
|
+
*/
|
|
45
|
+
|
|
40
46
|
// [dead code] - no longer used
|
|
41
47
|
/**
|
|
42
48
|
* Generate a transformer that expose all the peers as global via the expose loader
|
|
43
49
|
* @param peers
|
|
44
50
|
* @returns
|
|
51
|
+
* @deprecated unused internally; will be removed in a follow-up.
|
|
45
52
|
*/
|
|
46
53
|
function generateExposePeersTransformer(peers, logger) {
|
|
47
54
|
return (config, context) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_webpackTransformers","data","require","_webpackTransformers2","_getExposedRules","generateExposePeersTransformer","peers","logger","config","context","hostRootDir","target","exposedRules","getExposedRules","addModuleRules"],"sources":["transformers.ts"],"sourcesContent":["import type { WebpackConfigMutator } from '@teambit/webpack.modules.config-mutator';\nimport type { Logger } from '@teambit/logger';\nimport { generateAddAliasesFromPeersTransformer } from '@teambit/webpack.transformers.generate-add-aliases-from-peers';\nimport { generateExternalsTransformer } from '@teambit/webpack.transformers.generate-externals';\nimport { getExposedRules } from './get-exposed-rules';\nimport type { WebpackConfigTransformContext } from '../webpack.main.runtime';\n\nexport { generateAddAliasesFromPeersTransformer, generateExternalsTransformer };\n\n// [dead code] - no longer used\n/**\n * Generate a transformer that expose all the peers as global via the expose loader\n * @param peers\n * @returns\n */\nexport function generateExposePeersTransformer(peers: string[], logger: Logger) {\n return (config: WebpackConfigMutator, context: WebpackConfigTransformContext): WebpackConfigMutator => {\n const hostRootDir = context.target?.hostRootDir || context.hostRootDir;\n const exposedRules = getExposedRules(peers, logger, hostRootDir);\n config.addModuleRules(exposedRules);\n return config;\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAEA,SAAAA,qBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,oBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,sBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,qBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,iBAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,gBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;
|
|
1
|
+
{"version":3,"names":["_webpackTransformers","data","require","_webpackTransformers2","_getExposedRules","generateExposePeersTransformer","peers","logger","config","context","hostRootDir","target","exposedRules","getExposedRules","addModuleRules"],"sources":["transformers.ts"],"sourcesContent":["import type { WebpackConfigMutator } from '@teambit/webpack.modules.config-mutator';\nimport type { Logger } from '@teambit/logger';\nimport { generateAddAliasesFromPeersTransformer } from '@teambit/webpack.transformers.generate-add-aliases-from-peers';\nimport { generateExternalsTransformer } from '@teambit/webpack.transformers.generate-externals';\nimport { getExposedRules } from './get-exposed-rules';\nimport type { WebpackConfigTransformContext } from '../webpack.main.runtime';\n\n/**\n * @deprecated these are thin re-exports kept for backward-compatible `from '@teambit/webpack'`\n * imports; import them directly from `@teambit/webpack.transformers.generate-add-aliases-from-peers`\n * and `@teambit/webpack.transformers.generate-externals` instead.\n */\nexport { generateAddAliasesFromPeersTransformer, generateExternalsTransformer };\n\n// [dead code] - no longer used\n/**\n * Generate a transformer that expose all the peers as global via the expose loader\n * @param peers\n * @returns\n * @deprecated unused internally; will be removed in a follow-up.\n */\nexport function generateExposePeersTransformer(peers: string[], logger: Logger) {\n return (config: WebpackConfigMutator, context: WebpackConfigTransformContext): WebpackConfigMutator => {\n const hostRootDir = context.target?.hostRootDir || context.hostRootDir;\n const exposedRules = getExposedRules(peers, logger, hostRootDir);\n config.addModuleRules(exposedRules);\n return config;\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAEA,SAAAA,qBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,oBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,sBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,qBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,iBAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,gBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASI,8BAA8BA,CAACC,KAAe,EAAEC,MAAc,EAAE;EAC9E,OAAO,CAACC,MAA4B,EAAEC,OAAsC,KAA2B;IACrG,MAAMC,WAAW,GAAGD,OAAO,CAACE,MAAM,EAAED,WAAW,IAAID,OAAO,CAACC,WAAW;IACtE,MAAME,YAAY,GAAG,IAAAC,kCAAe,EAACP,KAAK,EAAEC,MAAM,EAAEG,WAAW,CAAC;IAChEF,MAAM,CAACM,cAAc,CAACF,YAAY,CAAC;IACnC,OAAOJ,MAAM;EACf,CAAC;AACH","ignoreList":[]}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import type { Bundler, BundlerResult, Target, BundlerContextMetaData } from '@teambit/bundler';
|
|
2
2
|
import type { Logger } from '@teambit/logger';
|
|
3
3
|
import type { Configuration } from 'webpack';
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated duplicated by `@teambit/webpack.webpack-bundler`'s own `WebpackBundler`, which is
|
|
6
|
+
* what the react/node/aspect envs actually build with now. Use that package instead - depending on
|
|
7
|
+
* both pulls in two independently-resolved webpack instances.
|
|
8
|
+
*/
|
|
4
9
|
export declare class WebpackBundler implements Bundler {
|
|
5
10
|
/**
|
|
6
11
|
* targets to bundle.
|
package/dist/webpack.bundler.js
CHANGED
|
@@ -33,6 +33,11 @@ function _path() {
|
|
|
33
33
|
return data;
|
|
34
34
|
}
|
|
35
35
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated duplicated by `@teambit/webpack.webpack-bundler`'s own `WebpackBundler`, which is
|
|
38
|
+
* what the react/node/aspect envs actually build with now. Use that package instead - depending on
|
|
39
|
+
* both pulls in two independently-resolved webpack instances.
|
|
40
|
+
*/
|
|
36
41
|
class WebpackBundler {
|
|
37
42
|
constructor(
|
|
38
43
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_bitError","data","require","_lodash","_pMapSeries","_interopRequireDefault","_path","e","__esModule","default","WebpackBundler","constructor","targets","configs","logger","webpack","metaData","run","startTime","Date","now","compilers","map","config","initiator","envId","initiatorMessage","envIdMessage","longProcessLogger","createLongProcessLogger","length","componentOutput","mapSeries","compiler","components","getComponents","outputPath","componentsLengthMessage","fullMessage","debug","Math","round","process","memoryUsage","heapUsed","ids","component","id","toString","join","logProgress","result","Promise","resolve","err","stats","error","errors","stack","BitError","info","toJson","all","entrypoints","warnings","assets","chunkGroupAuxiliary","relatedAssets","cachedAssets","assetsMap","getAssets","entriesAssetsMap","getEntriesAssetsMap","Object","values","assetsByChunkName","getErrors","compilation","outputOptions","path","endTime","close","cache","purge","end","fieldsToShow","webpackError","lines","fieldName","undefined","errorMessage","compact","reduce","acc","asset","name","size","compressedSize","getCompressedSize","entriesMap","keys","entries","forEach","entryVal","compressedAssetsSize","compressedAuxiliaryAssetsSize","auxiliaryAssets","related","isEmpty","gzipped","find","relatedAsset","type","substring","lastIndexOf","sep","target","targetCandidate","Error","exports"],"sources":["webpack.bundler.ts"],"sourcesContent":["import { BitError } from '@teambit/bit-error';\nimport type { Bundler, BundlerResult, Asset, Target, EntriesAssetsMap, BundlerContextMetaData } from '@teambit/bundler';\nimport type { Logger } from '@teambit/logger';\nimport { compact, isEmpty } from 'lodash';\nimport mapSeries from 'p-map-series';\nimport type { Compiler, Configuration, StatsCompilation, StatsAsset } from 'webpack';\nimport { sep } from 'path';\n\ntype AssetsMap = { [assetId: string]: Asset };\nexport class WebpackBundler implements Bundler {\n constructor(\n /**\n * targets to bundle.\n */\n private targets: Target[],\n\n /**\n * webpack configuration.\n */\n private configs: Configuration[],\n\n private logger: Logger,\n\n private webpack,\n\n private metaData?: BundlerContextMetaData | undefined\n ) {}\n\n async run(): Promise<BundlerResult[]> {\n const startTime = Date.now();\n const compilers = this.configs.map((config: any) => this.webpack(config));\n\n const initiator = this.metaData?.initiator;\n const envId = this.metaData?.envId;\n const initiatorMessage = initiator ? `process initiated by: ${initiator}.` : '';\n const envIdMessage = envId ? `config created by env: ${envId}.` : '';\n\n const longProcessLogger = this.logger.createLongProcessLogger('running Webpack bundler', compilers.length);\n\n // Process compilers sequentially to control memory usage\n // For better memory management, webpack compilers are run one at a time\n // and cleaned up after each run to prevent memory accumulation\n const componentOutput = await mapSeries(compilers, async (compiler: Compiler) => {\n const components = this.getComponents(compiler.outputPath);\n const componentsLengthMessage = `running on ${components.length} components`;\n const fullMessage = `${initiatorMessage} ${envIdMessage} ${componentsLengthMessage}`;\n this.logger.debug(\n `${fullMessage} memory usage: ${Math.round((process.memoryUsage().heapUsed / 1024 / 1024 / 1024) * 100) / 100} GB`\n );\n const ids = components.map((component) => component.id.toString()).join(', ');\n longProcessLogger.logProgress(`${fullMessage}`);\n this.logger.debug(`${fullMessage}\\ncomponents ids: ${ids}`);\n\n const result = await new Promise<any>((resolve) => {\n // TODO: split to multiple processes to reduce time and configure concurrent builds.\n // @see https://github.com/trivago/parallel-webpack\n return compiler.run((err, stats) => {\n if (err) {\n this.logger.error('get error from webpack compiler, full error:', err);\n\n return resolve({\n errors: [`${err.toString()}\\n${err.stack}`],\n components,\n });\n }\n if (!stats) throw new BitError('unknown build error');\n // const info = stats.toJson();\n\n const info = stats.toJson({\n all: false,\n entrypoints: true,\n warnings: true,\n errors: true,\n assets: true,\n chunkGroupAuxiliary: true,\n relatedAssets: true,\n cachedAssets: true,\n });\n const assetsMap = this.getAssets(info);\n const entriesAssetsMap = this.getEntriesAssetsMap(info, assetsMap);\n\n return resolve({\n assets: Object.values(assetsMap),\n assetsByChunkName: info.assetsByChunkName,\n entriesAssetsMap,\n errors: this.getErrors(info),\n outputPath: stats.compilation.outputOptions.path,\n components,\n warnings: info.warnings,\n startTime,\n endTime: Date.now(),\n });\n });\n });\n\n try {\n // Close the compiler to free up file watchers and resources\n await new Promise<void>((resolve) => {\n compiler.close(() => {\n resolve();\n });\n });\n if (compiler.cache) {\n // Force purge of webpack's internal cache\n (compiler as any).cache?.purge?.();\n }\n } catch (error) {\n this.logger.debug('Error during compiler cleanup:', error);\n }\n\n return result;\n });\n longProcessLogger.end();\n return componentOutput as BundlerResult[];\n }\n\n private getErrors(stats: StatsCompilation): Error[] {\n if (!stats.errors) return [];\n const fieldsToShow = ['message', 'moduleId', 'moduleName', 'moduleIdentifier', 'loc'];\n return stats.errors.map((webpackError) => {\n const lines = fieldsToShow.map((fieldName) => {\n if (webpackError[fieldName]) {\n return `${fieldName}: ${webpackError[fieldName]}`;\n }\n return undefined;\n });\n const errorMessage = compact(lines).join('\\n');\n return new BitError(errorMessage);\n });\n }\n\n private getAssets(stats: StatsCompilation): AssetsMap {\n if (!stats.assets) return {};\n return stats.assets.reduce((acc, asset) => {\n acc[asset.name] = {\n name: asset.name,\n size: asset.size,\n compressedSize: this.getCompressedSize(asset),\n };\n return acc;\n }, {});\n }\n\n private getEntriesAssetsMap(stats: StatsCompilation, assetsMap: AssetsMap): EntriesAssetsMap {\n const entriesMap = stats.entrypoints;\n if (!entriesMap || !Object.keys(assetsMap).length) return {};\n Object.entries(entriesMap).forEach(([, entryVal]) => {\n let compressedAssetsSize = 0;\n let compressedAuxiliaryAssetsSize = 0;\n entryVal.assets?.forEach((asset) => {\n const compressedSize = assetsMap[asset.name]?.compressedSize;\n if (compressedSize) {\n // @ts-ignore\n asset.compressedSize = compressedSize;\n compressedAssetsSize += compressedSize;\n }\n });\n entryVal.auxiliaryAssets?.forEach((asset) => {\n const compressedSize = assetsMap[asset.name]?.compressedSize;\n if (compressedSize) {\n // @ts-ignore\n asset.compressedSize = compressedSize;\n compressedAuxiliaryAssetsSize += compressedSize;\n }\n });\n entryVal.compressedAssetsSize = compressedAssetsSize;\n entryVal.compressedAuxiliaryAssetsSize = compressedAuxiliaryAssetsSize;\n });\n return entriesMap as any as EntriesAssetsMap;\n }\n\n private getCompressedSize(asset: StatsAsset): number | undefined {\n if (!asset.related || isEmpty(asset.related)) return undefined;\n const gzipped = asset.related.find((relatedAsset) => {\n return relatedAsset.type === 'gzipped';\n });\n if (!gzipped) return undefined;\n return gzipped.size;\n }\n\n private getComponents(outputPath: string) {\n const path = outputPath.substring(0, outputPath.lastIndexOf(sep));\n const target = this.targets.find((targetCandidate) => path === targetCandidate.outputPath);\n\n if (!target) throw new Error(`Could not find component id for path \"${path}\"`);\n return target.components;\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,UAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,SAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,I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UAAU;EACnB;EAEQD,iBAAiBA,CAACJ,KAAiB,EAAsB;IAC/D,IAAI,CAACA,KAAK,CAACa,OAAO,IAAI,IAAAC,iBAAO,EAACd,KAAK,CAACa,OAAO,CAAC,EAAE,OAAOlB,SAAS;IAC9D,MAAMoB,OAAO,GAAGf,KAAK,CAACa,OAAO,CAACG,IAAI,CAAEC,YAAY,IAAK;MACnD,OAAOA,YAAY,CAACC,IAAI,KAAK,SAAS;IACxC,CAAC,CAAC;IACF,IAAI,CAACH,OAAO,EAAE,OAAOpB,SAAS;IAC9B,OAAOoB,OAAO,CAACb,IAAI;EACrB;EAEQ7D,aAAaA,CAACC,UAAkB,EAAE;IACxC,MAAM2C,IAAI,GAAG3C,UAAU,CAAC6E,SAAS,CAAC,CAAC,EAAE7E,UAAU,CAAC8E,WAAW,CAACC,WAAG,CAAC,CAAC;IACjE,MAAMC,MAAM,GAAG,IAAI,CAACxG,OAAO,CAACkG,IAAI,CAAEO,eAAe,IAAKtC,IAAI,KAAKsC,eAAe,CAACjF,UAAU,CAAC;IAE1F,IAAI,CAACgF,MAAM,EAAE,MAAM,IAAIE,KAAK,CAAC,yCAAyCvC,IAAI,GAAG,CAAC;IAC9E,OAAOqC,MAAM,CAAClF,UAAU;EAC1B;AACF;AAACqF,OAAA,CAAA7G,cAAA,GAAAA,cAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_bitError","data","require","_lodash","_pMapSeries","_interopRequireDefault","_path","e","__esModule","default","WebpackBundler","constructor","targets","configs","logger","webpack","metaData","run","startTime","Date","now","compilers","map","config","initiator","envId","initiatorMessage","envIdMessage","longProcessLogger","createLongProcessLogger","length","componentOutput","mapSeries","compiler","components","getComponents","outputPath","componentsLengthMessage","fullMessage","debug","Math","round","process","memoryUsage","heapUsed","ids","component","id","toString","join","logProgress","result","Promise","resolve","err","stats","error","errors","stack","BitError","info","toJson","all","entrypoints","warnings","assets","chunkGroupAuxiliary","relatedAssets","cachedAssets","assetsMap","getAssets","entriesAssetsMap","getEntriesAssetsMap","Object","values","assetsByChunkName","getErrors","compilation","outputOptions","path","endTime","close","cache","purge","end","fieldsToShow","webpackError","lines","fieldName","undefined","errorMessage","compact","reduce","acc","asset","name","size","compressedSize","getCompressedSize","entriesMap","keys","entries","forEach","entryVal","compressedAssetsSize","compressedAuxiliaryAssetsSize","auxiliaryAssets","related","isEmpty","gzipped","find","relatedAsset","type","substring","lastIndexOf","sep","target","targetCandidate","Error","exports"],"sources":["webpack.bundler.ts"],"sourcesContent":["import { BitError } from '@teambit/bit-error';\nimport type { Bundler, BundlerResult, Asset, Target, EntriesAssetsMap, BundlerContextMetaData } from '@teambit/bundler';\nimport type { Logger } from '@teambit/logger';\nimport { compact, isEmpty } from 'lodash';\nimport mapSeries from 'p-map-series';\nimport type { Compiler, Configuration, StatsCompilation, StatsAsset } from 'webpack';\nimport { sep } from 'path';\n\ntype AssetsMap = { [assetId: string]: Asset };\n\n/**\n * @deprecated duplicated by `@teambit/webpack.webpack-bundler`'s own `WebpackBundler`, which is\n * what the react/node/aspect envs actually build with now. Use that package instead - depending on\n * both pulls in two independently-resolved webpack instances.\n */\nexport class WebpackBundler implements Bundler {\n constructor(\n /**\n * targets to bundle.\n */\n private targets: Target[],\n\n /**\n * webpack configuration.\n */\n private configs: Configuration[],\n\n private logger: Logger,\n\n private webpack,\n\n private metaData?: BundlerContextMetaData | undefined\n ) {}\n\n async run(): Promise<BundlerResult[]> {\n const startTime = Date.now();\n const compilers = this.configs.map((config: any) => this.webpack(config));\n\n const initiator = this.metaData?.initiator;\n const envId = this.metaData?.envId;\n const initiatorMessage = initiator ? `process initiated by: ${initiator}.` : '';\n const envIdMessage = envId ? `config created by env: ${envId}.` : '';\n\n const longProcessLogger = this.logger.createLongProcessLogger('running Webpack bundler', compilers.length);\n\n // Process compilers sequentially to control memory usage\n // For better memory management, webpack compilers are run one at a time\n // and cleaned up after each run to prevent memory accumulation\n const componentOutput = await mapSeries(compilers, async (compiler: Compiler) => {\n const components = this.getComponents(compiler.outputPath);\n const componentsLengthMessage = `running on ${components.length} components`;\n const fullMessage = `${initiatorMessage} ${envIdMessage} ${componentsLengthMessage}`;\n this.logger.debug(\n `${fullMessage} memory usage: ${Math.round((process.memoryUsage().heapUsed / 1024 / 1024 / 1024) * 100) / 100} GB`\n );\n const ids = components.map((component) => component.id.toString()).join(', ');\n longProcessLogger.logProgress(`${fullMessage}`);\n this.logger.debug(`${fullMessage}\\ncomponents ids: ${ids}`);\n\n const result = await new Promise<any>((resolve) => {\n // TODO: split to multiple processes to reduce time and configure concurrent builds.\n // @see https://github.com/trivago/parallel-webpack\n return compiler.run((err, stats) => {\n if (err) {\n this.logger.error('get error from webpack compiler, full error:', err);\n\n return resolve({\n errors: [`${err.toString()}\\n${err.stack}`],\n components,\n });\n }\n if (!stats) throw new BitError('unknown build error');\n // const info = stats.toJson();\n\n const info = stats.toJson({\n all: false,\n entrypoints: true,\n warnings: true,\n errors: true,\n assets: true,\n chunkGroupAuxiliary: true,\n relatedAssets: true,\n cachedAssets: true,\n });\n const assetsMap = this.getAssets(info);\n const entriesAssetsMap = this.getEntriesAssetsMap(info, assetsMap);\n\n return resolve({\n assets: Object.values(assetsMap),\n assetsByChunkName: info.assetsByChunkName,\n entriesAssetsMap,\n errors: this.getErrors(info),\n outputPath: stats.compilation.outputOptions.path,\n components,\n warnings: info.warnings,\n startTime,\n endTime: Date.now(),\n });\n });\n });\n\n try {\n // Close the compiler to free up file watchers and resources\n await new Promise<void>((resolve) => {\n compiler.close(() => {\n resolve();\n });\n });\n if (compiler.cache) {\n // Force purge of webpack's internal cache\n (compiler as any).cache?.purge?.();\n }\n } catch (error) {\n this.logger.debug('Error during compiler cleanup:', error);\n }\n\n return result;\n });\n longProcessLogger.end();\n return componentOutput as BundlerResult[];\n }\n\n private getErrors(stats: StatsCompilation): Error[] {\n if (!stats.errors) return [];\n const fieldsToShow = ['message', 'moduleId', 'moduleName', 'moduleIdentifier', 'loc'];\n return stats.errors.map((webpackError) => {\n const lines = fieldsToShow.map((fieldName) => {\n if (webpackError[fieldName]) {\n return `${fieldName}: ${webpackError[fieldName]}`;\n }\n return undefined;\n });\n const errorMessage = compact(lines).join('\\n');\n return new BitError(errorMessage);\n });\n }\n\n private getAssets(stats: StatsCompilation): AssetsMap {\n if (!stats.assets) return {};\n return stats.assets.reduce((acc, asset) => {\n acc[asset.name] = {\n name: asset.name,\n size: asset.size,\n compressedSize: this.getCompressedSize(asset),\n };\n return acc;\n }, {});\n }\n\n private getEntriesAssetsMap(stats: StatsCompilation, assetsMap: AssetsMap): EntriesAssetsMap {\n const entriesMap = stats.entrypoints;\n if (!entriesMap || !Object.keys(assetsMap).length) return {};\n Object.entries(entriesMap).forEach(([, entryVal]) => {\n let compressedAssetsSize = 0;\n let compressedAuxiliaryAssetsSize = 0;\n entryVal.assets?.forEach((asset) => {\n const compressedSize = assetsMap[asset.name]?.compressedSize;\n if (compressedSize) {\n // @ts-ignore\n asset.compressedSize = compressedSize;\n compressedAssetsSize += compressedSize;\n }\n });\n entryVal.auxiliaryAssets?.forEach((asset) => {\n const compressedSize = assetsMap[asset.name]?.compressedSize;\n if (compressedSize) {\n // @ts-ignore\n asset.compressedSize = compressedSize;\n compressedAuxiliaryAssetsSize += compressedSize;\n }\n });\n entryVal.compressedAssetsSize = compressedAssetsSize;\n entryVal.compressedAuxiliaryAssetsSize = compressedAuxiliaryAssetsSize;\n });\n return entriesMap as any as EntriesAssetsMap;\n }\n\n private getCompressedSize(asset: StatsAsset): number | undefined {\n if (!asset.related || isEmpty(asset.related)) return undefined;\n const gzipped = asset.related.find((relatedAsset) => {\n return relatedAsset.type === 'gzipped';\n });\n if (!gzipped) return undefined;\n return gzipped.size;\n }\n\n private getComponents(outputPath: string) {\n const path = outputPath.substring(0, outputPath.lastIndexOf(sep));\n const target = this.targets.find((targetCandidate) => path === targetCandidate.outputPath);\n\n if (!target) throw new Error(`Could not find component id for path \"${path}\"`);\n return target.components;\n }\n}\n"],"mappings":";;;;;;AAAA,SA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MACF,CAAC,CAAC;MACFM,QAAQ,CAACC,oBAAoB,GAAGA,oBAAoB;MACpDD,QAAQ,CAACE,6BAA6B,GAAGA,6BAA6B;IACxE,CAAC,CAAC;IACF,OAAON,UAAU;EACnB;EAEQD,iBAAiBA,CAACJ,KAAiB,EAAsB;IAC/D,IAAI,CAACA,KAAK,CAACa,OAAO,IAAI,IAAAC,iBAAO,EAACd,KAAK,CAACa,OAAO,CAAC,EAAE,OAAOlB,SAAS;IAC9D,MAAMoB,OAAO,GAAGf,KAAK,CAACa,OAAO,CAACG,IAAI,CAAEC,YAAY,IAAK;MACnD,OAAOA,YAAY,CAACC,IAAI,KAAK,SAAS;IACxC,CAAC,CAAC;IACF,IAAI,CAACH,OAAO,EAAE,OAAOpB,SAAS;IAC9B,OAAOoB,OAAO,CAACb,IAAI;EACrB;EAEQ7D,aAAaA,CAACC,UAAkB,EAAE;IACxC,MAAM2C,IAAI,GAAG3C,UAAU,CAAC6E,SAAS,CAAC,CAAC,EAAE7E,UAAU,CAAC8E,WAAW,CAACC,WAAG,CAAC,CAAC;IACjE,MAAMC,MAAM,GAAG,IAAI,CAACxG,OAAO,CAACkG,IAAI,CAAEO,eAAe,IAAKtC,IAAI,KAAKsC,eAAe,CAACjF,UAAU,CAAC;IAE1F,IAAI,CAACgF,MAAM,EAAE,MAAM,IAAIE,KAAK,CAAC,yCAAyCvC,IAAI,GAAG,CAAC;IAC9E,OAAOqC,MAAM,CAAClF,UAAU;EAC1B;AACF;AAACqF,OAAA,CAAA7G,cAAA,GAAAA,cAAA","ignoreList":[]}
|
|
@@ -6,6 +6,11 @@ export interface WebpackConfigWithDevServer extends Configuration {
|
|
|
6
6
|
devServer: WDS.Configuration;
|
|
7
7
|
favicon?: string;
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* @deprecated duplicated by `@teambit/webpack.webpack-dev-server`'s own `WebpackDevServer`, which is
|
|
11
|
+
* what the react/node/aspect envs actually build with now. Use that package instead - depending on
|
|
12
|
+
* both pulls in two independently-resolved webpack instances.
|
|
13
|
+
*/
|
|
9
14
|
export declare class WebpackDevServer implements DevServer {
|
|
10
15
|
private config;
|
|
11
16
|
private webpack;
|
|
@@ -40,6 +40,11 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
40
40
|
// between versions, leads to errors such as:
|
|
41
41
|
// error TS2430: Interface 'WebpackConfigWithDevServer' incorrectly extends interface 'Configuration'.
|
|
42
42
|
|
|
43
|
+
/**
|
|
44
|
+
* @deprecated duplicated by `@teambit/webpack.webpack-dev-server`'s own `WebpackDevServer`, which is
|
|
45
|
+
* what the react/node/aspect envs actually build with now. Use that package instead - depending on
|
|
46
|
+
* both pulls in two independently-resolved webpack instances.
|
|
47
|
+
*/
|
|
43
48
|
class WebpackDevServer {
|
|
44
49
|
constructor(config, webpack,
|
|
45
50
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_path","data","require","_findRoot","_interopRequireDefault","_util","_webpack","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","WebpackDevServer","constructor","config","webpack","webpackDevServer","WebpackAspect","id","WsDevServer","getCompiler","version","root","findRoot","packageJsonPath","join","packageJson","displayConfig","inspect","depth","listen","port","devServer","Error","addSignalListener","addDevServerEntrypoints","webpackDs","start","server","process","on","exit","exports"],"sources":["webpack.dev-server.ts"],"sourcesContent":["import { join } from 'path';\nimport type { DevServer } from '@teambit/bundler';\nimport findRoot from 'find-root';\nimport type { Server } from 'http';\nimport type { webpack as webpackCompiler, Configuration } from 'webpack';\nimport type * as WDS from 'webpack-dev-server';\nimport { inspect } from 'util';\nimport { WebpackAspect } from './webpack.aspect';\n\n//@ts-ignore - ignoring ts errors here because WDS.Configuration is a complex type that might break\n// between versions, leads to errors such as:\n// error TS2430: Interface 'WebpackConfigWithDevServer' incorrectly extends interface 'Configuration'.\nexport interface WebpackConfigWithDevServer extends Configuration {\n devServer: WDS.Configuration;\n favicon?: string;\n}\nexport class WebpackDevServer implements DevServer {\n private readonly WsDevServer: typeof WDS;\n constructor(\n private config: WebpackConfigWithDevServer,\n private webpack: typeof webpackCompiler,\n /**\n * path to the webpack-dev-server module or instance of webpack-dev-server.\n * this accept getting an instance for backward compatibility.\n */\n private webpackDevServer: string | typeof WDS\n ) {\n if (typeof this.webpackDevServer === 'string') {\n // eslint-disable-next-line import/no-dynamic-require, global-require\n this.WsDevServer = require(this.webpackDevServer);\n } else {\n this.WsDevServer = this.webpackDevServer;\n }\n }\n\n private getCompiler(): any {\n return this.webpack(this.config as any);\n }\n\n id = WebpackAspect.id;\n\n displayName = 'Webpack dev server';\n\n version(): string {\n if (typeof this.webpackDevServer !== 'string') {\n return 'unknown';\n }\n // Resolve version from the webpack-dev-server package.json\n try {\n const root = findRoot(this.webpackDevServer);\n const packageJsonPath = join(root, 'package.json');\n // eslint-disable-next-line import/no-dynamic-require, global-require\n const packageJson = require(packageJsonPath);\n return packageJson.version;\n } catch {\n return 'unknown';\n }\n }\n\n displayConfig(): string {\n return inspect(this.config, { depth: 10 });\n }\n\n async listen(port: number): Promise<Server> {\n if (!this.config.devServer) {\n throw new Error('Missing devServer configuration for webpack');\n }\n // Prevent different port between the config port and the listen arg port\n this.config.devServer.port = port;\n\n // Adding signal listeners to make sure we immediately close the process on sigint / sigterm (otherwise webpack dev server closing will take time)\n this.addSignalListener();\n\n // Compatibility check for Webpack dev server v3 (e.g. for Angular v8)\n if (typeof (this.WsDevServer as any).addDevServerEntrypoints !== 'undefined') {\n const webpackDs = new (this.WsDevServer as any)(this.getCompiler(), this.config.devServer);\n return webpackDs.listen(port);\n }\n\n // @ts-ignore in the capsules it throws an error about compatibilities issues between webpack.compiler and webpackDevServer/webpack/compiler\n const webpackDs: WDS = new this.WsDevServer(this.config.devServer, this.getCompiler());\n await webpackDs.start();\n\n // @ts-ignore\n return webpackDs.server;\n }\n\n private addSignalListener() {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U,MAAA,CAAAC,WAAA,kBAAAhB,CAAA,QAAAa,CAAA,GAAAb,CAAA,CAAAiB,IAAA,CAAAZ,CAAA,EAAAD,CAAA,uCAAAS,CAAA,SAAAA,CAAA,YAAAK,SAAA,yEAAAd,CAAA,GAAAe,MAAA,GAAAC,MAAA,EAAAf,CAAA;AAEjD;AACA;AACA;;
|
|
1
|
+
{"version":3,"names":["_path","data","require","_findRoot","_interopRequireDefault","_util","_webpack","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","WebpackDevServer","constructor","config","webpack","webpackDevServer","WebpackAspect","id","WsDevServer","getCompiler","version","root","findRoot","packageJsonPath","join","packageJson","displayConfig","inspect","depth","listen","port","devServer","Error","addSignalListener","addDevServerEntrypoints","webpackDs","start","server","process","on","exit","exports"],"sources":["webpack.dev-server.ts"],"sourcesContent":["import { join } from 'path';\nimport type { DevServer } from '@teambit/bundler';\nimport findRoot from 'find-root';\nimport type { Server } from 'http';\nimport type { webpack as webpackCompiler, Configuration } from 'webpack';\nimport type * as WDS from 'webpack-dev-server';\nimport { inspect } from 'util';\nimport { WebpackAspect } from './webpack.aspect';\n\n//@ts-ignore - ignoring ts errors here because WDS.Configuration is a complex type that might break\n// between versions, leads to errors such as:\n// error TS2430: Interface 'WebpackConfigWithDevServer' incorrectly extends interface 'Configuration'.\nexport interface WebpackConfigWithDevServer extends Configuration {\n devServer: WDS.Configuration;\n favicon?: string;\n}\n\n/**\n * @deprecated duplicated by `@teambit/webpack.webpack-dev-server`'s own `WebpackDevServer`, which is\n * what the react/node/aspect envs actually build with now. Use that package instead - depending on\n * both pulls in two independently-resolved webpack instances.\n */\nexport class WebpackDevServer implements DevServer {\n private readonly WsDevServer: typeof WDS;\n constructor(\n private config: WebpackConfigWithDevServer,\n private webpack: typeof webpackCompiler,\n /**\n * path to the webpack-dev-server module or instance of webpack-dev-server.\n * this accept getting an instance for backward compatibility.\n */\n private webpackDevServer: string | typeof WDS\n ) {\n if (typeof this.webpackDevServer === 'string') {\n // eslint-disable-next-line import/no-dynamic-require, global-require\n this.WsDevServer = require(this.webpackDevServer);\n } else {\n this.WsDevServer = this.webpackDevServer;\n }\n }\n\n private getCompiler(): any {\n return this.webpack(this.config as any);\n }\n\n id = WebpackAspect.id;\n\n displayName = 'Webpack dev server';\n\n version(): string {\n if (typeof this.webpackDevServer !== 'string') {\n return 'unknown';\n }\n // Resolve version from the webpack-dev-server package.json\n try {\n const root = findRoot(this.webpackDevServer);\n const packageJsonPath = join(root, 'package.json');\n // eslint-disable-next-line import/no-dynamic-require, global-require\n const packageJson = require(packageJsonPath);\n return packageJson.version;\n } catch {\n return 'unknown';\n }\n }\n\n displayConfig(): string {\n return inspect(this.config, { depth: 10 });\n }\n\n async listen(port: number): Promise<Server> {\n if (!this.config.devServer) {\n throw new Error('Missing devServer configuration for webpack');\n }\n // Prevent different port between the config port and the listen arg port\n this.config.devServer.port = port;\n\n // Adding signal listeners to make sure we immediately close the process on sigint / sigterm (otherwise webpack dev server closing will take time)\n this.addSignalListener();\n\n // Compatibility check for Webpack dev server v3 (e.g. for Angular v8)\n if (typeof (this.WsDevServer as any).addDevServerEntrypoints !== 'undefined') {\n const webpackDs = new (this.WsDevServer as any)(this.getCompiler(), this.config.devServer);\n return webpackDs.listen(port);\n }\n\n // @ts-ignore in the capsules it throws an error about compatibilities issues between webpack.compiler and webpackDevServer/webpack/compiler\n const webpackDs: WDS = new this.WsDevServer(this.config.devServer, this.getCompiler());\n await webpackDs.start();\n\n // @ts-ignore\n return webpackDs.server;\n }\n\n private addSignalListener() {\n process.on('SIGTERM', () => {\n process.exit();\n });\n\n process.on('SIGINT', () => {\n process.exit();\n });\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAA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AAmB;IAC1C,IAAI,CAAC,IAAI,CAACjB,MAAM,CAACkB,SAAS,EAAE;MAC1B,MAAM,IAAIC,KAAK,CAAC,6CAA6C,CAAC;IAChE;IACA;IACA,IAAI,CAACnB,MAAM,CAACkB,SAAS,CAACD,IAAI,GAAGA,IAAI;;IAEjC;IACA,IAAI,CAACG,iBAAiB,CAAC,CAAC;;IAExB;IACA,IAAI,OAAQ,IAAI,CAACf,WAAW,CAASgB,uBAAuB,KAAK,WAAW,EAAE;MAC5E,MAAMC,SAAS,GAAG,IAAK,IAAI,CAACjB,WAAW,CAAS,IAAI,CAACC,WAAW,CAAC,CAAC,EAAE,IAAI,CAACN,MAAM,CAACkB,SAAS,CAAC;MAC1F,OAAOI,SAAS,CAACN,MAAM,CAACC,IAAI,CAAC;IAC/B;;IAEA;IACA,MAAMK,SAAc,GAAG,IAAI,IAAI,CAACjB,WAAW,CAAC,IAAI,CAACL,MAAM,CAACkB,SAAS,EAAE,IAAI,CAACZ,WAAW,CAAC,CAAC,CAAC;IACtF,MAAMgB,SAAS,CAACC,KAAK,CAAC,CAAC;;IAEvB;IACA,OAAOD,SAAS,CAACE,MAAM;EACzB;EAEQJ,iBAAiBA,CAAA,EAAG;IAC1BK,OAAO,CAACC,EAAE,CAAC,SAAS,EAAE,MAAM;MAC1BD,OAAO,CAACE,IAAI,CAAC,CAAC;IAChB,CAAC,CAAC;IAEFF,OAAO,CAACC,EAAE,CAAC,QAAQ,EAAE,MAAM;MACzBD,OAAO,CAACE,IAAI,CAAC,CAAC;IAChB,CAAC,CAAC;EACJ;AACF;AAACC,OAAA,CAAA9B,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -5,10 +5,22 @@ import type { Logger, LoggerMain } from '@teambit/logger';
|
|
|
5
5
|
import type { Workspace } from '@teambit/workspace';
|
|
6
6
|
import { WebpackConfigMutator } from '@teambit/webpack.modules.config-mutator';
|
|
7
7
|
import { WebpackBundler } from './webpack.bundler';
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated the bundler/dev-server that build component previews/apps no longer go through this
|
|
10
|
+
* aspect - the react/node/aspect envs bundle with `@teambit/webpack.webpack-bundler` directly (see
|
|
11
|
+
* https://bit.cloud/teambit/webpack/~change-requests/decouple-webpack-bundler-from-webpack-aspect).
|
|
12
|
+
* Source this type from `@teambit/webpack.webpack-bundler` instead.
|
|
13
|
+
*/
|
|
8
14
|
export type WebpackConfigTransformContext = GlobalWebpackConfigTransformContext & {
|
|
9
15
|
target: Target;
|
|
10
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated source from `@teambit/webpack.webpack-bundler` instead; see `WebpackConfigTransformContext`.
|
|
19
|
+
*/
|
|
11
20
|
export type WebpackConfigDevServerTransformContext = GlobalWebpackConfigTransformContext & DevServerContext;
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated source from `@teambit/webpack.webpack-bundler` instead; see `WebpackConfigTransformContext`.
|
|
23
|
+
*/
|
|
12
24
|
export type GlobalWebpackConfigTransformContext = {
|
|
13
25
|
mode: BundlerMode;
|
|
14
26
|
/**
|
|
@@ -23,8 +35,24 @@ export type GlobalWebpackConfigTransformContext = {
|
|
|
23
35
|
*/
|
|
24
36
|
hostRootDir?: string;
|
|
25
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* @deprecated source from `@teambit/webpack.webpack-bundler` instead; see `WebpackConfigTransformContext`.
|
|
40
|
+
* Constructing this against `@teambit/webpack`'s own `WebpackConfigMutator` re-export and applying
|
|
41
|
+
* it to a config built by `@teambit/webpack.webpack-bundler` mixes two independently-resolved
|
|
42
|
+
* webpack instances.
|
|
43
|
+
*/
|
|
26
44
|
export type WebpackConfigTransformer = (config: WebpackConfigMutator, context: WebpackConfigTransformContext) => WebpackConfigMutator;
|
|
45
|
+
/**
|
|
46
|
+
* @deprecated source from `@teambit/webpack.webpack-dev-server` instead; see `WebpackConfigTransformContext`.
|
|
47
|
+
*/
|
|
27
48
|
export type WebpackConfigDevServerTransformer = (config: WebpackConfigMutator, context: WebpackConfigDevServerTransformContext) => WebpackConfigMutator;
|
|
49
|
+
/**
|
|
50
|
+
* @deprecated component previews/apps no longer build through this aspect - the react/node/aspect
|
|
51
|
+
* envs bundle with `@teambit/webpack.webpack-bundler` and `@teambit/webpack.webpack-dev-server`
|
|
52
|
+
* directly (see
|
|
53
|
+
* https://bit.cloud/teambit/webpack/~change-requests/decouple-webpack-bundler-from-webpack-aspect).
|
|
54
|
+
* `createBundler`/`createDevServer` will be removed in a follow-up; use those packages instead.
|
|
55
|
+
*/
|
|
28
56
|
export declare class WebpackMain {
|
|
29
57
|
/**
|
|
30
58
|
* Pubsub extension.
|
|
@@ -61,9 +89,16 @@ export declare class WebpackMain {
|
|
|
61
89
|
logger: Logger);
|
|
62
90
|
/**
|
|
63
91
|
* create an instance of bit-compliant webpack dev server for a set of components
|
|
92
|
+
* @deprecated use `@teambit/webpack.webpack-dev-server`'s `WebpackDevServer.from`/`.create` instead.
|
|
64
93
|
*/
|
|
65
94
|
createDevServer(context: DevServerContext, transformers?: WebpackConfigTransformer[], webpackModulePath?: string, webpackDevServerModulePath?: string): DevServer;
|
|
95
|
+
/**
|
|
96
|
+
* @deprecated thin wrapper around `webpack-merge`; call it directly instead.
|
|
97
|
+
*/
|
|
66
98
|
mergeConfig(target: any, source: any): any;
|
|
99
|
+
/**
|
|
100
|
+
* @deprecated use `@teambit/webpack.webpack-bundler`'s `WebpackBundler.from`/`.create` instead.
|
|
101
|
+
*/
|
|
67
102
|
createBundler(context: BundlerContext, transformers?: WebpackConfigTransformer[], initialConfigs?: webpack.Configuration[], webpackModuleOrPath?: string | any): WebpackBundler;
|
|
68
103
|
private createConfigs;
|
|
69
104
|
private generateTransformers;
|
|
@@ -114,6 +114,39 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
|
|
|
114
114
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
115
115
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } // We want to import it to make sure bit recognizes it as a dependency
|
|
116
116
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
117
|
+
/**
|
|
118
|
+
* @deprecated the bundler/dev-server that build component previews/apps no longer go through this
|
|
119
|
+
* aspect - the react/node/aspect envs bundle with `@teambit/webpack.webpack-bundler` directly (see
|
|
120
|
+
* https://bit.cloud/teambit/webpack/~change-requests/decouple-webpack-bundler-from-webpack-aspect).
|
|
121
|
+
* Source this type from `@teambit/webpack.webpack-bundler` instead.
|
|
122
|
+
*/
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* @deprecated source from `@teambit/webpack.webpack-bundler` instead; see `WebpackConfigTransformContext`.
|
|
126
|
+
*/
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* @deprecated source from `@teambit/webpack.webpack-bundler` instead; see `WebpackConfigTransformContext`.
|
|
130
|
+
*/
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* @deprecated source from `@teambit/webpack.webpack-bundler` instead; see `WebpackConfigTransformContext`.
|
|
134
|
+
* Constructing this against `@teambit/webpack`'s own `WebpackConfigMutator` re-export and applying
|
|
135
|
+
* it to a config built by `@teambit/webpack.webpack-bundler` mixes two independently-resolved
|
|
136
|
+
* webpack instances.
|
|
137
|
+
*/
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* @deprecated source from `@teambit/webpack.webpack-dev-server` instead; see `WebpackConfigTransformContext`.
|
|
141
|
+
*/
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* @deprecated component previews/apps no longer build through this aspect - the react/node/aspect
|
|
145
|
+
* envs bundle with `@teambit/webpack.webpack-bundler` and `@teambit/webpack.webpack-dev-server`
|
|
146
|
+
* directly (see
|
|
147
|
+
* https://bit.cloud/teambit/webpack/~change-requests/decouple-webpack-bundler-from-webpack-aspect).
|
|
148
|
+
* `createBundler`/`createDevServer` will be removed in a follow-up; use those packages instead.
|
|
149
|
+
*/
|
|
117
150
|
class WebpackMain {
|
|
118
151
|
constructor(
|
|
119
152
|
/**
|
|
@@ -140,6 +173,7 @@ class WebpackMain {
|
|
|
140
173
|
|
|
141
174
|
/**
|
|
142
175
|
* create an instance of bit-compliant webpack dev server for a set of components
|
|
176
|
+
* @deprecated use `@teambit/webpack.webpack-dev-server`'s `WebpackDevServer.from`/`.create` instead.
|
|
143
177
|
*/
|
|
144
178
|
createDevServer(context, transformers = [], webpackModulePath, webpackDevServerModulePath) {
|
|
145
179
|
const config = this.createDevServerConfig(context.entry, this.workspace.path, context.id, context.rootPath, context.publicPath, this.workspace.getComponentPathsRegExps(), context.title);
|
|
@@ -152,9 +186,17 @@ class WebpackMain {
|
|
|
152
186
|
const afterMutation = (0, _runTransformer().runTransformersWithContext)(configMutator.clone(), [...internalTransformers, ...transformers], transformerContext);
|
|
153
187
|
return new (_webpack5().WebpackDevServer)(afterMutation.raw, this.getWebpackInstance(webpackModulePath, _webpack().default), wdsPath);
|
|
154
188
|
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* @deprecated thin wrapper around `webpack-merge`; call it directly instead.
|
|
192
|
+
*/
|
|
155
193
|
mergeConfig(target, source) {
|
|
156
194
|
return (0, _webpackMerge().merge)(target, source);
|
|
157
195
|
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* @deprecated use `@teambit/webpack.webpack-bundler`'s `WebpackBundler.from`/`.create` instead.
|
|
199
|
+
*/
|
|
158
200
|
createBundler(context, transformers = [], initialConfigs, webpackModuleOrPath) {
|
|
159
201
|
const transformerContext = {
|
|
160
202
|
mode: 'prod',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_webpack","data","_interopRequireDefault","require","_pubsub","_bundler","_cli","_logger","_workspace","_webpackMerge","_webpackModules","_transformers","_webpackDev","_webpack2","_webpack3","_webpack4","_webpack5","_runTransformer","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","WebpackMain","constructor","pubsub","workspace","bundler","logger","createDevServer","context","transformers","webpackModulePath","webpackDevServerModulePath","config","createDevServerConfig","entry","path","id","rootPath","publicPath","getComponentPathsRegExps","title","wdsPath","resolve","configMutator","WebpackConfigMutator","transformerContext","assign","mode","internalTransformers","generateTransformers","undefined","afterMutation","runTransformersWithContext","clone","WebpackDevServer","raw","getWebpackInstance","webpack","mergeConfig","target","source","merge","createBundler","initialConfigs","webpackModuleOrPath","isEnvTemplate","metaData","configs","createConfigs","targets","baseConfigFactory","WebpackBundler","factory","bundlerContext","map","baseConfig","_bundlerContext","devServerContext","hostDeps","hostDependencies","aliasHostDependencies","peerAliasesTransformer","generateAddAliasesFromPeersTransformer","push","externalizeHostDependencies","externalsTransformer","generateExternalsTransformer","webpackOrPath","fallback","devServerID","publicRoot","componentPathsRegExps","devServerConfigFactory","provider","logPublisher","createLogger","WebpackAspect","exports","MainRuntime","PubsubAspect","WorkspaceAspect","BundlerAspect","LoggerAspect","addRuntime"],"sources":["webpack.main.runtime.ts"],"sourcesContent":["import type { Configuration } from 'webpack';\nimport webpack from 'webpack';\nimport type { PubsubMain } from '@teambit/pubsub';\nimport { PubsubAspect } from '@teambit/pubsub';\nimport type { BundlerContext, BundlerMain, DevServer, DevServerContext, BundlerMode, Target } from '@teambit/bundler';\nimport { BundlerAspect } from '@teambit/bundler';\nimport { MainRuntime } from '@teambit/cli';\nimport type { Logger, LoggerMain } from '@teambit/logger';\nimport { LoggerAspect } from '@teambit/logger';\nimport type { Workspace } from '@teambit/workspace';\nimport { WorkspaceAspect } from '@teambit/workspace';\nimport { merge } from 'webpack-merge';\n// We want to import it to make sure bit recognizes it as a dependency\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport WsDevServer from 'webpack-dev-server';\nimport { WebpackConfigMutator } from '@teambit/webpack.modules.config-mutator';\n\nimport { generateAddAliasesFromPeersTransformer, generateExternalsTransformer } from './transformers';\nimport { configFactory as devServerConfigFactory } from './config/webpack.dev.config';\nimport { configFactory as baseConfigFactory } from './config/webpack.config';\n\nimport { WebpackAspect } from './webpack.aspect';\nimport { WebpackBundler } from './webpack.bundler';\nimport { WebpackDevServer } from './webpack.dev-server';\nimport { runTransformersWithContext } from './run-transformer';\n\nexport type WebpackConfigTransformContext = GlobalWebpackConfigTransformContext & {\n target: Target;\n};\n\nexport type WebpackConfigDevServerTransformContext = GlobalWebpackConfigTransformContext & DevServerContext;\n\nexport type GlobalWebpackConfigTransformContext = {\n mode: BundlerMode;\n /**\n * Whether the config is for an env template bundling\n */\n isEnvTemplate?: boolean;\n /**\n * A path for the host root dir\n * Host root dir is usually the env root dir\n * This can be used in different bundle options which run require.resolve\n * for example when configuring webpack aliases or webpack expose loader on the peers deps\n */\n hostRootDir?: string;\n};\n\nexport type WebpackConfigTransformer = (\n config: WebpackConfigMutator,\n context: WebpackConfigTransformContext\n) => WebpackConfigMutator;\n\nexport type WebpackConfigDevServerTransformer = (\n config: WebpackConfigMutator,\n context: WebpackConfigDevServerTransformContext\n) => WebpackConfigMutator;\n\nexport class WebpackMain {\n constructor(\n /**\n * Pubsub extension.\n */\n public pubsub: PubsubMain,\n\n /**\n * workspace extension.\n */\n private workspace: Workspace,\n\n /**\n * bundler extension.\n */\n private bundler: BundlerMain,\n\n /**\n * Logger extension\n */\n public logger: Logger\n ) {}\n\n /**\n * create an instance of bit-compliant webpack dev server for a set of components\n */\n createDevServer(\n context: DevServerContext,\n transformers: WebpackConfigTransformer[] = [],\n webpackModulePath?: string,\n webpackDevServerModulePath?: string\n ): DevServer {\n const config = this.createDevServerConfig(\n context.entry,\n this.workspace.path,\n context.id,\n context.rootPath,\n context.publicPath,\n this.workspace.getComponentPathsRegExps(),\n context.title\n ) as any;\n const wdsPath = webpackDevServerModulePath || require.resolve('webpack-dev-server');\n const configMutator = new WebpackConfigMutator(config);\n const transformerContext: WebpackConfigDevServerTransformContext = Object.assign(context, { mode: 'dev' as const });\n const internalTransformers = this.generateTransformers(undefined, transformerContext);\n\n const afterMutation = runTransformersWithContext(\n configMutator.clone(),\n [...internalTransformers, ...transformers],\n transformerContext\n );\n return new WebpackDevServer(afterMutation.raw, this.getWebpackInstance(webpackModulePath, webpack), wdsPath);\n }\n\n mergeConfig(target: any, source: any): any {\n return merge(target, source);\n }\n\n createBundler(\n context: BundlerContext,\n transformers: WebpackConfigTransformer[] = [],\n initialConfigs?: webpack.Configuration[],\n webpackModuleOrPath?: string | any\n ) {\n const transformerContext: GlobalWebpackConfigTransformContext = {\n mode: 'prod',\n isEnvTemplate: context.metaData?.isEnvTemplate,\n };\n // eslint-disable-next-line max-len\n const configs =\n initialConfigs ||\n this.createConfigs(context.targets, baseConfigFactory, transformers, transformerContext, context);\n return new WebpackBundler(\n context.targets,\n configs,\n this.logger,\n this.getWebpackInstance(webpackModuleOrPath, webpack),\n context.metaData\n );\n }\n\n private createConfigs(\n targets: Target[],\n factory: (target: Target, context: BundlerContext) => Configuration,\n transformers: WebpackConfigTransformer[] = [],\n transformerContext: GlobalWebpackConfigTransformContext,\n bundlerContext: BundlerContext\n ) {\n return targets.map((target) => {\n const baseConfig = factory(target, bundlerContext);\n const configMutator = new WebpackConfigMutator(baseConfig);\n const context = Object.assign({}, transformerContext, { target });\n const internalTransformers = this.generateTransformers(context, undefined, target);\n const afterMutation = runTransformersWithContext(\n configMutator.clone(),\n [...internalTransformers, ...transformers],\n context\n );\n return afterMutation.raw;\n });\n }\n\n private generateTransformers(\n _bundlerContext?: WebpackConfigTransformContext,\n devServerContext?: WebpackConfigDevServerTransformContext,\n target?: Target\n ): Array<WebpackConfigTransformer> {\n const transformers: WebpackConfigTransformer[] = [];\n // TODO: handle dev server\n const hostDeps = target?.hostDependencies || devServerContext?.hostDependencies;\n if (hostDeps) {\n if (target?.aliasHostDependencies || devServerContext?.aliasHostDependencies) {\n const peerAliasesTransformer = generateAddAliasesFromPeersTransformer(hostDeps, this.logger);\n transformers.push(peerAliasesTransformer);\n }\n if (target?.externalizeHostDependencies || devServerContext?.externalizeHostDependencies) {\n const externalsTransformer = generateExternalsTransformer(hostDeps);\n transformers.push(externalsTransformer);\n }\n }\n return transformers;\n }\n\n private getWebpackInstance(webpackOrPath?: any | string, fallback?: any) {\n if (!webpackOrPath) {\n return fallback;\n }\n if (typeof webpackOrPath === 'string') {\n // eslint-disable-next-line import/no-dynamic-require, global-require\n return require(webpackOrPath);\n }\n return webpackOrPath;\n }\n\n private createDevServerConfig(\n entry: string[],\n rootPath: string,\n devServerID: string,\n publicRoot: string,\n publicPath: string,\n componentPathsRegExps: RegExp[],\n title?: string\n ) {\n return devServerConfigFactory(\n devServerID,\n rootPath,\n entry,\n publicRoot,\n publicPath,\n componentPathsRegExps,\n this.pubsub,\n title\n );\n }\n\n static slots = [];\n\n static runtime = MainRuntime;\n static dependencies = [PubsubAspect, WorkspaceAspect, BundlerAspect, LoggerAspect];\n\n static async provider([pubsub, workspace, bundler, logger]: [PubsubMain, Workspace, BundlerMain, LoggerMain]) {\n const logPublisher = logger.createLogger(WebpackAspect.id);\n return new WebpackMain(pubsub, workspace, bundler, logPublisher);\n }\n}\n\nWebpackAspect.addRuntime(WebpackMain);\n"],"mappings":";;;;;;AACA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAI,SAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAJ,IA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EACXpD,QAAQ,EACRH,KAAK,EACLwD,UAAU,EACVpD,UAAU,EACVqD,qBAAqB,EACrB,IAAI,CAACpE,MAAM,EACXiB,KACF,CAAC;EACH;EAOA,aAAaqD,QAAQA,CAAC,CAACtE,MAAM,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,CAAmD,EAAE;IAC5G,MAAMoE,YAAY,GAAGpE,MAAM,CAACqE,YAAY,CAACC,yBAAa,CAAC5D,EAAE,CAAC;IAC1D,OAAO,IAAIf,WAAW,CAACE,MAAM,EAAEC,SAAS,EAAEC,OAAO,EAAEqE,YAAY,CAAC;EAClE;AACF;AAACG,OAAA,CAAA5E,WAAA,GAAAA,WAAA;AAAAlB,eAAA,CApKYkB,WAAW,WA2JP,EAAE;AAAAlB,eAAA,CA3JNkB,WAAW,aA6JL6E,kBAAW;AAAA/F,eAAA,CA7JjBkB,WAAW,kBA8JA,CAAC8E,sBAAY,EAAEC,4BAAe,EAAEC,wBAAa,EAAEC,sBAAY,CAAC;AAQpFN,yBAAa,CAACO,UAAU,CAAClF,WAAW,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_webpack","data","_interopRequireDefault","require","_pubsub","_bundler","_cli","_logger","_workspace","_webpackMerge","_webpackModules","_transformers","_webpackDev","_webpack2","_webpack3","_webpack4","_webpack5","_runTransformer","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","WebpackMain","constructor","pubsub","workspace","bundler","logger","createDevServer","context","transformers","webpackModulePath","webpackDevServerModulePath","config","createDevServerConfig","entry","path","id","rootPath","publicPath","getComponentPathsRegExps","title","wdsPath","resolve","configMutator","WebpackConfigMutator","transformerContext","assign","mode","internalTransformers","generateTransformers","undefined","afterMutation","runTransformersWithContext","clone","WebpackDevServer","raw","getWebpackInstance","webpack","mergeConfig","target","source","merge","createBundler","initialConfigs","webpackModuleOrPath","isEnvTemplate","metaData","configs","createConfigs","targets","baseConfigFactory","WebpackBundler","factory","bundlerContext","map","baseConfig","_bundlerContext","devServerContext","hostDeps","hostDependencies","aliasHostDependencies","peerAliasesTransformer","generateAddAliasesFromPeersTransformer","push","externalizeHostDependencies","externalsTransformer","generateExternalsTransformer","webpackOrPath","fallback","devServerID","publicRoot","componentPathsRegExps","devServerConfigFactory","provider","logPublisher","createLogger","WebpackAspect","exports","MainRuntime","PubsubAspect","WorkspaceAspect","BundlerAspect","LoggerAspect","addRuntime"],"sources":["webpack.main.runtime.ts"],"sourcesContent":["import type { Configuration } from 'webpack';\nimport webpack from 'webpack';\nimport type { PubsubMain } from '@teambit/pubsub';\nimport { PubsubAspect } from '@teambit/pubsub';\nimport type { BundlerContext, BundlerMain, DevServer, DevServerContext, BundlerMode, Target } from '@teambit/bundler';\nimport { BundlerAspect } from '@teambit/bundler';\nimport { MainRuntime } from '@teambit/cli';\nimport type { Logger, LoggerMain } from '@teambit/logger';\nimport { LoggerAspect } from '@teambit/logger';\nimport type { Workspace } from '@teambit/workspace';\nimport { WorkspaceAspect } from '@teambit/workspace';\nimport { merge } from 'webpack-merge';\n// We want to import it to make sure bit recognizes it as a dependency\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport WsDevServer from 'webpack-dev-server';\nimport { WebpackConfigMutator } from '@teambit/webpack.modules.config-mutator';\n\nimport { generateAddAliasesFromPeersTransformer, generateExternalsTransformer } from './transformers';\nimport { configFactory as devServerConfigFactory } from './config/webpack.dev.config';\nimport { configFactory as baseConfigFactory } from './config/webpack.config';\n\nimport { WebpackAspect } from './webpack.aspect';\nimport { WebpackBundler } from './webpack.bundler';\nimport { WebpackDevServer } from './webpack.dev-server';\nimport { runTransformersWithContext } from './run-transformer';\n\n/**\n * @deprecated the bundler/dev-server that build component previews/apps no longer go through this\n * aspect - the react/node/aspect envs bundle with `@teambit/webpack.webpack-bundler` directly (see\n * https://bit.cloud/teambit/webpack/~change-requests/decouple-webpack-bundler-from-webpack-aspect).\n * Source this type from `@teambit/webpack.webpack-bundler` instead.\n */\nexport type WebpackConfigTransformContext = GlobalWebpackConfigTransformContext & {\n target: Target;\n};\n\n/**\n * @deprecated source from `@teambit/webpack.webpack-bundler` instead; see `WebpackConfigTransformContext`.\n */\nexport type WebpackConfigDevServerTransformContext = GlobalWebpackConfigTransformContext & DevServerContext;\n\n/**\n * @deprecated source from `@teambit/webpack.webpack-bundler` instead; see `WebpackConfigTransformContext`.\n */\nexport type GlobalWebpackConfigTransformContext = {\n mode: BundlerMode;\n /**\n * Whether the config is for an env template bundling\n */\n isEnvTemplate?: boolean;\n /**\n * A path for the host root dir\n * Host root dir is usually the env root dir\n * This can be used in different bundle options which run require.resolve\n * for example when configuring webpack aliases or webpack expose loader on the peers deps\n */\n hostRootDir?: string;\n};\n\n/**\n * @deprecated source from `@teambit/webpack.webpack-bundler` instead; see `WebpackConfigTransformContext`.\n * Constructing this against `@teambit/webpack`'s own `WebpackConfigMutator` re-export and applying\n * it to a config built by `@teambit/webpack.webpack-bundler` mixes two independently-resolved\n * webpack instances.\n */\nexport type WebpackConfigTransformer = (\n config: WebpackConfigMutator,\n context: WebpackConfigTransformContext\n) => WebpackConfigMutator;\n\n/**\n * @deprecated source from `@teambit/webpack.webpack-dev-server` instead; see `WebpackConfigTransformContext`.\n */\nexport type WebpackConfigDevServerTransformer = (\n config: WebpackConfigMutator,\n context: WebpackConfigDevServerTransformContext\n) => WebpackConfigMutator;\n\n/**\n * @deprecated component previews/apps no longer build through this aspect - the react/node/aspect\n * envs bundle with `@teambit/webpack.webpack-bundler` and `@teambit/webpack.webpack-dev-server`\n * directly (see\n * https://bit.cloud/teambit/webpack/~change-requests/decouple-webpack-bundler-from-webpack-aspect).\n * `createBundler`/`createDevServer` will be removed in a follow-up; use those packages instead.\n */\nexport class WebpackMain {\n constructor(\n /**\n * Pubsub extension.\n */\n public pubsub: PubsubMain,\n\n /**\n * workspace extension.\n */\n private workspace: Workspace,\n\n /**\n * bundler extension.\n */\n private bundler: BundlerMain,\n\n /**\n * Logger extension\n */\n public logger: Logger\n ) {}\n\n /**\n * create an instance of bit-compliant webpack dev server for a set of components\n * @deprecated use `@teambit/webpack.webpack-dev-server`'s `WebpackDevServer.from`/`.create` instead.\n */\n createDevServer(\n context: DevServerContext,\n transformers: WebpackConfigTransformer[] = [],\n webpackModulePath?: string,\n webpackDevServerModulePath?: string\n ): DevServer {\n const config = this.createDevServerConfig(\n context.entry,\n this.workspace.path,\n context.id,\n context.rootPath,\n context.publicPath,\n this.workspace.getComponentPathsRegExps(),\n context.title\n ) as any;\n const wdsPath = webpackDevServerModulePath || require.resolve('webpack-dev-server');\n const configMutator = new WebpackConfigMutator(config);\n const transformerContext: WebpackConfigDevServerTransformContext = Object.assign(context, { mode: 'dev' as const });\n const internalTransformers = this.generateTransformers(undefined, transformerContext);\n\n const afterMutation = runTransformersWithContext(\n configMutator.clone(),\n [...internalTransformers, ...transformers],\n transformerContext\n );\n return new WebpackDevServer(afterMutation.raw, this.getWebpackInstance(webpackModulePath, webpack), wdsPath);\n }\n\n /**\n * @deprecated thin wrapper around `webpack-merge`; call it directly instead.\n */\n mergeConfig(target: any, source: any): any {\n return merge(target, source);\n }\n\n /**\n * @deprecated use `@teambit/webpack.webpack-bundler`'s `WebpackBundler.from`/`.create` instead.\n */\n createBundler(\n context: BundlerContext,\n transformers: WebpackConfigTransformer[] = [],\n initialConfigs?: webpack.Configuration[],\n webpackModuleOrPath?: string | any\n ) {\n const transformerContext: GlobalWebpackConfigTransformContext = {\n mode: 'prod',\n isEnvTemplate: context.metaData?.isEnvTemplate,\n };\n // eslint-disable-next-line max-len\n const configs =\n initialConfigs ||\n this.createConfigs(context.targets, baseConfigFactory, transformers, transformerContext, context);\n return new WebpackBundler(\n context.targets,\n configs,\n this.logger,\n this.getWebpackInstance(webpackModuleOrPath, webpack),\n context.metaData\n );\n }\n\n private createConfigs(\n targets: Target[],\n factory: (target: Target, context: BundlerContext) => Configuration,\n transformers: WebpackConfigTransformer[] = [],\n transformerContext: GlobalWebpackConfigTransformContext,\n bundlerContext: BundlerContext\n ) {\n return targets.map((target) => {\n const baseConfig = factory(target, bundlerContext);\n const configMutator = new WebpackConfigMutator(baseConfig);\n const context = Object.assign({}, transformerContext, { target });\n const internalTransformers = this.generateTransformers(context, undefined, target);\n const afterMutation = runTransformersWithContext(\n configMutator.clone(),\n [...internalTransformers, ...transformers],\n context\n );\n return afterMutation.raw;\n });\n }\n\n private generateTransformers(\n _bundlerContext?: WebpackConfigTransformContext,\n devServerContext?: WebpackConfigDevServerTransformContext,\n target?: Target\n ): Array<WebpackConfigTransformer> {\n const transformers: WebpackConfigTransformer[] = [];\n // TODO: handle dev server\n const hostDeps = target?.hostDependencies || devServerContext?.hostDependencies;\n if (hostDeps) {\n if (target?.aliasHostDependencies || devServerContext?.aliasHostDependencies) {\n const peerAliasesTransformer = generateAddAliasesFromPeersTransformer(hostDeps, this.logger);\n transformers.push(peerAliasesTransformer);\n }\n if (target?.externalizeHostDependencies || devServerContext?.externalizeHostDependencies) {\n const externalsTransformer = generateExternalsTransformer(hostDeps);\n transformers.push(externalsTransformer);\n }\n }\n return transformers;\n }\n\n private getWebpackInstance(webpackOrPath?: any | string, fallback?: any) {\n if (!webpackOrPath) {\n return fallback;\n }\n if (typeof webpackOrPath === 'string') {\n // eslint-disable-next-line import/no-dynamic-require, global-require\n return require(webpackOrPath);\n }\n return webpackOrPath;\n }\n\n private createDevServerConfig(\n entry: string[],\n rootPath: string,\n devServerID: string,\n publicRoot: string,\n publicPath: string,\n componentPathsRegExps: RegExp[],\n title?: string\n ) {\n return devServerConfigFactory(\n devServerID,\n rootPath,\n entry,\n publicRoot,\n publicPath,\n componentPathsRegExps,\n this.pubsub,\n title\n );\n }\n\n static slots = [];\n\n static runtime = MainRuntime;\n static dependencies = [PubsubAspect, WorkspaceAspect, BundlerAspect, LoggerAspect];\n\n static async provider([pubsub, workspace, bundler, logger]: [PubsubMain, Workspace, BundlerMain, LoggerMain]) {\n const logPublisher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BAAY,EAAEC,4BAAe,EAAEC,wBAAa,EAAEC,sBAAY,CAAC;AAQpFN,yBAAa,CAACO,UAAU,CAAClF,WAAW,CAAC","ignoreList":[]}
|
|
@@ -9,6 +9,10 @@ class WebpackCompilationDoneEventData {
|
|
|
9
9
|
) {}
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated not published by anything in this aspect (nor by `@teambit/webpack.webpack-bundler`/
|
|
14
|
+
* `@teambit/webpack.webpack-dev-server`, its replacements). Kept only for backward-compatible imports.
|
|
15
|
+
*/
|
|
12
16
|
export class WebpackCompilationDoneEvent extends BitBaseEvent<WebpackCompilationDoneEventData> {
|
|
13
17
|
static readonly TYPE = 'webpack-compilation-done';
|
|
14
18
|
|
|
@@ -5,6 +5,10 @@ type Params = {
|
|
|
5
5
|
devServerID: string;
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated not published by anything in this aspect (nor by `@teambit/webpack.webpack-bundler`/
|
|
10
|
+
* `@teambit/webpack.webpack-dev-server`, its replacements). Kept only for backward-compatible imports.
|
|
11
|
+
*/
|
|
8
12
|
export class WebpackCompilationStartedEvent extends BitBaseEvent<Params> {
|
|
9
13
|
static readonly TYPE = 'webpack-compilation-started';
|
|
10
14
|
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/webpack",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1106",
|
|
4
4
|
"homepage": "https://bit.cloud/teambit/webpack/webpack",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.webpack",
|
|
8
8
|
"name": "webpack",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.1106"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"webpack": "5.97.1",
|
|
@@ -49,15 +49,15 @@
|
|
|
49
49
|
"@teambit/logger": "0.0.1460",
|
|
50
50
|
"@teambit/cli": "0.0.1367",
|
|
51
51
|
"@teambit/toolbox.path.path": "0.0.21",
|
|
52
|
-
"@teambit/webpack.plugins.webpack-bit-reporter-plugin": "0.1.0",
|
|
53
52
|
"@teambit/webpack.modules.generate-expose-loaders": "0.0.42",
|
|
54
53
|
"@teambit/webpack.plugins.inject-head-webpack-plugin": "0.0.35",
|
|
55
54
|
"@teambit/webpack.modules.resolve-peer": "0.1.0",
|
|
56
55
|
"@teambit/webpack.transformers.generate-add-aliases-from-peers": "0.1.0",
|
|
57
56
|
"@teambit/webpack.transformers.generate-externals": "0.1.0",
|
|
58
|
-
"@teambit/
|
|
59
|
-
"@teambit/
|
|
60
|
-
"@teambit/
|
|
57
|
+
"@teambit/webpack.plugins.webpack-bit-reporter-plugin": "0.1.0",
|
|
58
|
+
"@teambit/bundler": "1.0.1106",
|
|
59
|
+
"@teambit/pubsub": "1.0.1106",
|
|
60
|
+
"@teambit/workspace": "1.0.1106"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@types/webpack": "5.28.5",
|
|
@@ -1 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated thin re-export kept for backward-compatible `from '@teambit/webpack'` imports;
|
|
3
|
+
* import directly from `@teambit/webpack.plugins.webpack-bit-reporter-plugin` instead.
|
|
4
|
+
*/
|
|
1
5
|
export { WebpackBitReporterPlugin } from '@teambit/webpack.plugins.webpack-bit-reporter-plugin';
|
|
@@ -13,6 +13,9 @@ export type BodyInjectionOptions = {
|
|
|
13
13
|
* since, the html plugin is configured via the webpack aspect, expose it from here ensure the same instance
|
|
14
14
|
* @param options
|
|
15
15
|
* @returns
|
|
16
|
+
* @deprecated the webpack aspect no longer builds the base config for react/node/aspect envs, so
|
|
17
|
+
* this is no longer guaranteed to share an `html-webpack-plugin` instance with the bundler that
|
|
18
|
+
* actually built the config (`@teambit/webpack.webpack-bundler`). Kept only for backward-compatible imports.
|
|
16
19
|
*/
|
|
17
20
|
export function GenerateBodyInjectionTransformer(options: BodyInjectionOptions): WebpackConfigTransformer {
|
|
18
21
|
return (config) => {
|
|
@@ -13,6 +13,9 @@ export type HeadInjectionOptions = {
|
|
|
13
13
|
* since, the html plugin is configured via the webpack aspect, expose it from here ensure the same instance
|
|
14
14
|
* @param options
|
|
15
15
|
* @returns
|
|
16
|
+
* @deprecated the webpack aspect no longer builds the base config for react/node/aspect envs, so
|
|
17
|
+
* this is no longer guaranteed to share an `html-webpack-plugin` instance with the bundler that
|
|
18
|
+
* actually built the config (`@teambit/webpack.webpack-bundler`). Kept only for backward-compatible imports.
|
|
16
19
|
*/
|
|
17
20
|
export function GenerateHeadInjectionTransformer(options: HeadInjectionOptions): WebpackConfigTransformer {
|
|
18
21
|
return (config) => {
|
|
@@ -5,6 +5,11 @@ import { generateExternalsTransformer } from '@teambit/webpack.transformers.gene
|
|
|
5
5
|
import { getExposedRules } from './get-exposed-rules';
|
|
6
6
|
import type { WebpackConfigTransformContext } from '../webpack.main.runtime';
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated these are thin re-exports kept for backward-compatible `from '@teambit/webpack'`
|
|
10
|
+
* imports; import them directly from `@teambit/webpack.transformers.generate-add-aliases-from-peers`
|
|
11
|
+
* and `@teambit/webpack.transformers.generate-externals` instead.
|
|
12
|
+
*/
|
|
8
13
|
export { generateAddAliasesFromPeersTransformer, generateExternalsTransformer };
|
|
9
14
|
|
|
10
15
|
// [dead code] - no longer used
|
|
@@ -12,6 +17,7 @@ export { generateAddAliasesFromPeersTransformer, generateExternalsTransformer };
|
|
|
12
17
|
* Generate a transformer that expose all the peers as global via the expose loader
|
|
13
18
|
* @param peers
|
|
14
19
|
* @returns
|
|
20
|
+
* @deprecated unused internally; will be removed in a follow-up.
|
|
15
21
|
*/
|
|
16
22
|
export function generateExposePeersTransformer(peers: string[], logger: Logger) {
|
|
17
23
|
return (config: WebpackConfigMutator, context: WebpackConfigTransformContext): WebpackConfigMutator => {
|