@teambit/webpack 0.0.881 → 0.0.882
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/dist/config/html.js +2 -2
- package/dist/config/html.js.map +1 -1
- package/dist/config/webpack-fallbacks-aliases.js.map +1 -1
- package/dist/config/webpack-fallbacks-provide-plugin-config.js.map +1 -1
- package/dist/config/webpack-fallbacks.js +7 -28
- package/dist/config/webpack-fallbacks.js.map +1 -1
- package/dist/config/webpack.config.js +1 -45
- package/dist/config/webpack.config.js.map +1 -1
- package/dist/config/webpack.dev.config.js +14 -58
- package/dist/config/webpack.dev.config.js.map +1 -1
- package/dist/events/index.js +0 -4
- package/dist/events/index.js.map +1 -1
- package/dist/events/webpack-compilation-done-event.js +1 -12
- package/dist/events/webpack-compilation-done-event.js.map +1 -1
- package/dist/events/webpack-compilation-started-event.js +1 -10
- package/dist/events/webpack-compilation-started-event.js.map +1 -1
- package/dist/index.js +0 -35
- package/dist/index.js.map +1 -1
- package/dist/plugins/webpack-bit-reporter-plugin.js +4 -16
- package/dist/plugins/webpack-bit-reporter-plugin.js.map +1 -1
- package/dist/transformers/get-exposed-rules.js +0 -18
- package/dist/transformers/get-exposed-rules.js.map +1 -1
- package/dist/transformers/get-externals.js +0 -10
- package/dist/transformers/get-externals.js.map +1 -1
- package/dist/transformers/index.js +0 -9
- package/dist/transformers/index.js.map +1 -1
- package/dist/transformers/inject-body.js +0 -5
- package/dist/transformers/inject-body.js.map +1 -1
- package/dist/transformers/inject-head.js +0 -4
- package/dist/transformers/inject-head.js.map +1 -1
- package/dist/transformers/resolve-peer.js +2 -22
- package/dist/transformers/resolve-peer.js.map +1 -1
- package/dist/transformers/transformers.js +5 -20
- package/dist/transformers/transformers.js.map +1 -1
- package/dist/webpack.aspect.js +0 -5
- package/dist/webpack.aspect.js.map +1 -1
- package/dist/webpack.bundler.js +2 -33
- package/dist/webpack.bundler.js.map +1 -1
- package/dist/webpack.composition.js +0 -6
- package/dist/webpack.composition.js.map +1 -1
- package/dist/webpack.dev-server.js +8 -25
- package/dist/webpack.dev-server.js.map +1 -1
- package/dist/webpack.main.runtime.js +9 -74
- package/dist/webpack.main.runtime.js.map +1 -1
- package/package-tar/teambit-webpack-0.0.882.tgz +0 -0
- package/package.json +5 -5
- package/{preview-1666409808293.js → preview-1666496165706.js} +2 -2
- package/package-tar/teambit-webpack-0.0.881.tgz +0 -0
|
@@ -4,17 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.GenerateHeadInjectionTransformer = GenerateHeadInjectionTransformer;
|
|
7
|
-
|
|
8
7
|
function _webpackPlugins() {
|
|
9
8
|
const data = require("@teambit/webpack.plugins.inject-head-webpack-plugin");
|
|
10
|
-
|
|
11
9
|
_webpackPlugins = function () {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
/**
|
|
19
15
|
* A transformer that allow you to inject content into your html head
|
|
20
16
|
* We expose it from here, as it uses the inject-head-webpack-plugin which register to the html plugin hooks
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["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 '@teambit/webpack';\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":"
|
|
1
|
+
{"version":3,"names":["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 '@teambit/webpack';\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;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,gCAAgC,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"}
|
|
@@ -1,47 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.resolvePeerToDirOrFile = resolvePeerToDirOrFile;
|
|
9
8
|
exports.resolvePeerToFile = resolvePeerToFile;
|
|
10
|
-
|
|
11
9
|
function _fs() {
|
|
12
10
|
const data = _interopRequireWildcard(require("fs"));
|
|
13
|
-
|
|
14
11
|
_fs = function () {
|
|
15
12
|
return data;
|
|
16
13
|
};
|
|
17
|
-
|
|
18
14
|
return data;
|
|
19
15
|
}
|
|
20
|
-
|
|
21
16
|
function _enhancedResolve() {
|
|
22
17
|
const data = require("enhanced-resolve");
|
|
23
|
-
|
|
24
18
|
_enhancedResolve = function () {
|
|
25
19
|
return data;
|
|
26
20
|
};
|
|
27
|
-
|
|
28
21
|
return data;
|
|
29
22
|
}
|
|
30
|
-
|
|
31
23
|
function _findRoot() {
|
|
32
24
|
const data = _interopRequireDefault(require("find-root"));
|
|
33
|
-
|
|
34
25
|
_findRoot = function () {
|
|
35
26
|
return data;
|
|
36
27
|
};
|
|
37
|
-
|
|
38
28
|
return data;
|
|
39
29
|
}
|
|
40
|
-
|
|
41
30
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
42
|
-
|
|
43
31
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
44
|
-
|
|
45
32
|
/**
|
|
46
33
|
* Get the package folder, and in case it's not found get the resolved file path
|
|
47
34
|
* @param peerName
|
|
@@ -49,18 +36,15 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
49
36
|
*/
|
|
50
37
|
function resolvePeerToDirOrFile(peerName, logger, hostRootDir) {
|
|
51
38
|
let resolved;
|
|
52
|
-
|
|
53
39
|
try {
|
|
54
40
|
const options = {
|
|
55
41
|
// resolve the host root dir to its real location, as require.resolve is preserve symlink, so we get wrong result otherwise
|
|
56
42
|
paths: [process.cwd(), __dirname]
|
|
57
43
|
};
|
|
58
|
-
|
|
59
44
|
if (hostRootDir) {
|
|
60
45
|
// resolve the host root dir to its real location, as require.resolve is preserve symlink, so we get wrong result otherwise
|
|
61
46
|
options.paths.unshift((0, _fs().realpathSync)(hostRootDir));
|
|
62
47
|
}
|
|
63
|
-
|
|
64
48
|
resolved = require.resolve(peerName, options);
|
|
65
49
|
const folder = (0, _findRoot().default)(resolved);
|
|
66
50
|
return folder;
|
|
@@ -70,18 +54,16 @@ function resolvePeerToDirOrFile(peerName, logger, hostRootDir) {
|
|
|
70
54
|
} else {
|
|
71
55
|
logger.warn(`Couldn't resolve "${peerName}" to add it as webpack alias`);
|
|
72
56
|
}
|
|
73
|
-
|
|
74
57
|
return resolved;
|
|
75
58
|
}
|
|
76
59
|
}
|
|
60
|
+
|
|
77
61
|
/**
|
|
78
62
|
* Make sure to resolve the peer path correctly
|
|
79
63
|
* we first resolve it to its dir (to be aligned with the aliases transformer)
|
|
80
64
|
* Then we resolve it to specific file, using enhanced resolve to make sure we resolve it using the correct main fields order
|
|
81
65
|
* @param peer
|
|
82
66
|
*/
|
|
83
|
-
|
|
84
|
-
|
|
85
67
|
function resolvePeerToFile(peer, logger, hostRootDir) {
|
|
86
68
|
const dirOrFile = resolvePeerToDirOrFile(peer, logger, hostRootDir);
|
|
87
69
|
if (!dirOrFile) return undefined;
|
|
@@ -89,13 +71,12 @@ function resolvePeerToFile(peer, logger, hostRootDir) {
|
|
|
89
71
|
const resolvedFile = resolver.resolveSync({}, '', dirOrFile);
|
|
90
72
|
return resolvedFile;
|
|
91
73
|
}
|
|
74
|
+
|
|
92
75
|
/**
|
|
93
76
|
* Generate a resolver that will read first the module field then the main field
|
|
94
77
|
* to make it compatible with webpack behavior
|
|
95
78
|
* @returns
|
|
96
79
|
*/
|
|
97
|
-
|
|
98
|
-
|
|
99
80
|
function createResolver() {
|
|
100
81
|
// create a resolver
|
|
101
82
|
const myResolver = _enhancedResolve().ResolverFactory.createResolver({
|
|
@@ -103,7 +84,6 @@ function createResolver() {
|
|
|
103
84
|
useSyncFileSystemCalls: true,
|
|
104
85
|
mainFields: ['browser', 'module', 'main']
|
|
105
86
|
});
|
|
106
|
-
|
|
107
87
|
return myResolver;
|
|
108
88
|
}
|
|
109
89
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["resolvePeerToDirOrFile","peerName","logger","hostRootDir","resolved","options","paths","process","cwd","__dirname","unshift","realpathSync","require","resolve","folder","findRoot","e","warn","resolvePeerToFile","peer","dirOrFile","undefined","resolver","createResolver","resolvedFile","resolveSync","myResolver","ResolverFactory","fileSystem","CachedInputFileSystem","fs","useSyncFileSystemCalls","mainFields"],"sources":["resolve-peer.ts"],"sourcesContent":["import fs, { realpathSync } from 'fs';\nimport { ResolverFactory, CachedInputFileSystem } from 'enhanced-resolve';\nimport findRoot from 'find-root';\nimport { Logger } from '@teambit/logger';\n\n/**\n * Get the package folder, and in case it's not found get the resolved file path\n * @param peerName\n * @returns\n */\nexport function resolvePeerToDirOrFile(peerName: string, logger: Logger, hostRootDir?: string): string | undefined {\n let resolved;\n try {\n const options = {\n // resolve the host root dir to its real location, as require.resolve is preserve symlink, so we get wrong result otherwise\n paths: [process.cwd(), __dirname],\n };\n if (hostRootDir) {\n // resolve the host root dir to its real location, as require.resolve is preserve symlink, so we get wrong result otherwise\n options.paths.unshift(realpathSync(hostRootDir));\n }\n\n resolved = require.resolve(peerName, options);\n const folder = findRoot(resolved);\n return folder;\n } catch (e) {\n if (resolved) {\n logger.warn(`Couldn't find root dir for \"${peerName}\" from path \"${resolved}\" to add it as webpack alias`);\n } else {\n logger.warn(`Couldn't resolve \"${peerName}\" to add it as webpack alias`);\n }\n return resolved;\n }\n}\n\n/**\n * Make sure to resolve the peer path correctly\n * we first resolve it to its dir (to be aligned with the aliases transformer)\n * Then we resolve it to specific file, using enhanced resolve to make sure we resolve it using the correct main fields order\n * @param peer\n */\nexport function resolvePeerToFile(peer: string, logger: Logger, hostRootDir?: string): string | undefined {\n const dirOrFile = resolvePeerToDirOrFile(peer, logger, hostRootDir);\n if (!dirOrFile) return undefined;\n const resolver = createResolver();\n const resolvedFile = resolver.resolveSync({}, '', dirOrFile);\n return resolvedFile;\n}\n\n/**\n * Generate a resolver that will read first the module field then the main field\n * to make it compatible with webpack behavior\n * @returns\n */\nfunction createResolver() {\n // create a resolver\n const myResolver = ResolverFactory.createResolver({\n fileSystem: new CachedInputFileSystem(fs, 4000),\n useSyncFileSystemCalls: true,\n mainFields: ['browser', 'module', 'main'],\n });\n return myResolver;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["resolvePeerToDirOrFile","peerName","logger","hostRootDir","resolved","options","paths","process","cwd","__dirname","unshift","realpathSync","require","resolve","folder","findRoot","e","warn","resolvePeerToFile","peer","dirOrFile","undefined","resolver","createResolver","resolvedFile","resolveSync","myResolver","ResolverFactory","fileSystem","CachedInputFileSystem","fs","useSyncFileSystemCalls","mainFields"],"sources":["resolve-peer.ts"],"sourcesContent":["import fs, { realpathSync } from 'fs';\nimport { ResolverFactory, CachedInputFileSystem } from 'enhanced-resolve';\nimport findRoot from 'find-root';\nimport { Logger } from '@teambit/logger';\n\n/**\n * Get the package folder, and in case it's not found get the resolved file path\n * @param peerName\n * @returns\n */\nexport function resolvePeerToDirOrFile(peerName: string, logger: Logger, hostRootDir?: string): string | undefined {\n let resolved;\n try {\n const options = {\n // resolve the host root dir to its real location, as require.resolve is preserve symlink, so we get wrong result otherwise\n paths: [process.cwd(), __dirname],\n };\n if (hostRootDir) {\n // resolve the host root dir to its real location, as require.resolve is preserve symlink, so we get wrong result otherwise\n options.paths.unshift(realpathSync(hostRootDir));\n }\n\n resolved = require.resolve(peerName, options);\n const folder = findRoot(resolved);\n return folder;\n } catch (e) {\n if (resolved) {\n logger.warn(`Couldn't find root dir for \"${peerName}\" from path \"${resolved}\" to add it as webpack alias`);\n } else {\n logger.warn(`Couldn't resolve \"${peerName}\" to add it as webpack alias`);\n }\n return resolved;\n }\n}\n\n/**\n * Make sure to resolve the peer path correctly\n * we first resolve it to its dir (to be aligned with the aliases transformer)\n * Then we resolve it to specific file, using enhanced resolve to make sure we resolve it using the correct main fields order\n * @param peer\n */\nexport function resolvePeerToFile(peer: string, logger: Logger, hostRootDir?: string): string | undefined {\n const dirOrFile = resolvePeerToDirOrFile(peer, logger, hostRootDir);\n if (!dirOrFile) return undefined;\n const resolver = createResolver();\n const resolvedFile = resolver.resolveSync({}, '', dirOrFile);\n return resolvedFile;\n}\n\n/**\n * Generate a resolver that will read first the module field then the main field\n * to make it compatible with webpack behavior\n * @returns\n */\nfunction createResolver() {\n // create a resolver\n const myResolver = ResolverFactory.createResolver({\n fileSystem: new CachedInputFileSystem(fs, 4000),\n useSyncFileSystemCalls: true,\n mainFields: ['browser', 'module', 'main'],\n });\n return myResolver;\n}\n"],"mappings":";;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAiC;AAAA;AAGjC;AACA;AACA;AACA;AACA;AACO,SAASA,sBAAsB,CAACC,QAAgB,EAAEC,MAAc,EAAEC,WAAoB,EAAsB;EACjH,IAAIC,QAAQ;EACZ,IAAI;IACF,MAAMC,OAAO,GAAG;MACd;MACAC,KAAK,EAAE,CAACC,OAAO,CAACC,GAAG,EAAE,EAAEC,SAAS;IAClC,CAAC;IACD,IAAIN,WAAW,EAAE;MACf;MACAE,OAAO,CAACC,KAAK,CAACI,OAAO,CAAC,IAAAC,kBAAY,EAACR,WAAW,CAAC,CAAC;IAClD;IAEAC,QAAQ,GAAGQ,OAAO,CAACC,OAAO,CAACZ,QAAQ,EAAEI,OAAO,CAAC;IAC7C,MAAMS,MAAM,GAAG,IAAAC,mBAAQ,EAACX,QAAQ,CAAC;IACjC,OAAOU,MAAM;EACf,CAAC,CAAC,OAAOE,CAAC,EAAE;IACV,IAAIZ,QAAQ,EAAE;MACZF,MAAM,CAACe,IAAI,CAAE,+BAA8BhB,QAAS,gBAAeG,QAAS,8BAA6B,CAAC;IAC5G,CAAC,MAAM;MACLF,MAAM,CAACe,IAAI,CAAE,qBAAoBhB,QAAS,8BAA6B,CAAC;IAC1E;IACA,OAAOG,QAAQ;EACjB;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASc,iBAAiB,CAACC,IAAY,EAAEjB,MAAc,EAAEC,WAAoB,EAAsB;EACxG,MAAMiB,SAAS,GAAGpB,sBAAsB,CAACmB,IAAI,EAAEjB,MAAM,EAAEC,WAAW,CAAC;EACnE,IAAI,CAACiB,SAAS,EAAE,OAAOC,SAAS;EAChC,MAAMC,QAAQ,GAAGC,cAAc,EAAE;EACjC,MAAMC,YAAY,GAAGF,QAAQ,CAACG,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,EAAEL,SAAS,CAAC;EAC5D,OAAOI,YAAY;AACrB;;AAEA;AACA;AACA;AACA;AACA;AACA,SAASD,cAAc,GAAG;EACxB;EACA,MAAMG,UAAU,GAAGC,kCAAe,CAACJ,cAAc,CAAC;IAChDK,UAAU,EAAE,KAAIC,wCAAqB,EAACC,aAAE,EAAE,IAAI,CAAC;IAC/CC,sBAAsB,EAAE,IAAI;IAC5BC,UAAU,EAAE,CAAC,SAAS,EAAE,QAAQ,EAAE,MAAM;EAC1C,CAAC,CAAC;EACF,OAAON,UAAU;AACnB"}
|
|
@@ -6,41 +6,30 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.generateAddAliasesFromPeersTransformer = generateAddAliasesFromPeersTransformer;
|
|
7
7
|
exports.generateExposePeersTransformer = generateExposePeersTransformer;
|
|
8
8
|
exports.generateExternalsTransformer = generateExternalsTransformer;
|
|
9
|
-
|
|
10
9
|
function _getExposedRules() {
|
|
11
10
|
const data = require("./get-exposed-rules");
|
|
12
|
-
|
|
13
11
|
_getExposedRules = function () {
|
|
14
12
|
return data;
|
|
15
13
|
};
|
|
16
|
-
|
|
17
14
|
return data;
|
|
18
15
|
}
|
|
19
|
-
|
|
20
16
|
function _resolvePeer() {
|
|
21
17
|
const data = require("./resolve-peer");
|
|
22
|
-
|
|
23
18
|
_resolvePeer = function () {
|
|
24
19
|
return data;
|
|
25
20
|
};
|
|
26
|
-
|
|
27
21
|
return data;
|
|
28
22
|
}
|
|
29
|
-
|
|
30
23
|
function _getExternals() {
|
|
31
24
|
const data = require("./get-externals");
|
|
32
|
-
|
|
33
25
|
_getExternals = function () {
|
|
34
26
|
return data;
|
|
35
27
|
};
|
|
36
|
-
|
|
37
28
|
return data;
|
|
38
29
|
}
|
|
39
|
-
|
|
40
30
|
function generateAddAliasesFromPeersTransformer(peers, logger) {
|
|
41
31
|
return (config, context) => {
|
|
42
32
|
var _context$target;
|
|
43
|
-
|
|
44
33
|
const hostRootDir = ((_context$target = context.target) === null || _context$target === void 0 ? void 0 : _context$target.hostRootDir) || context.hostRootDir;
|
|
45
34
|
const peerAliases = peers.reduce((acc, peerName) => {
|
|
46
35
|
// gets the correct module folder of the package.
|
|
@@ -51,46 +40,42 @@ function generateAddAliasesFromPeersTransformer(peers, logger) {
|
|
|
51
40
|
// for example, if we used "react-dom": require.resolve("react-dom"),
|
|
52
41
|
// it would try to resolve "react-dom/test-utils" as:
|
|
53
42
|
// node_modules/react-dom/index.js/test-utils
|
|
54
|
-
const resolved = (0, _resolvePeer().resolvePeerToDirOrFile)(peerName, logger, hostRootDir);
|
|
43
|
+
const resolved = (0, _resolvePeer().resolvePeerToDirOrFile)(peerName, logger, hostRootDir);
|
|
44
|
+
// Sometime there are packages that only hold icons for example, so there is no main property in their package.json
|
|
55
45
|
// so they can't be resolved.
|
|
56
46
|
// in such cases do not add them to the aliases.
|
|
57
47
|
// We already log that cases in the resolvePeerToDirOrFile function.
|
|
58
|
-
|
|
59
48
|
if (resolved) {
|
|
60
49
|
acc[peerName] = resolved;
|
|
61
50
|
}
|
|
62
|
-
|
|
63
51
|
return acc;
|
|
64
52
|
}, {});
|
|
65
53
|
config.addAliases(peerAliases);
|
|
66
54
|
return config;
|
|
67
55
|
};
|
|
68
|
-
}
|
|
56
|
+
}
|
|
69
57
|
|
|
58
|
+
// [dead code] - no longer used
|
|
70
59
|
/**
|
|
71
60
|
* Generate a transformer that expose all the peers as global via the expose loader
|
|
72
61
|
* @param peers
|
|
73
62
|
* @returns
|
|
74
63
|
*/
|
|
75
|
-
|
|
76
|
-
|
|
77
64
|
function generateExposePeersTransformer(peers, logger) {
|
|
78
65
|
return (config, context) => {
|
|
79
66
|
var _context$target2;
|
|
80
|
-
|
|
81
67
|
const hostRootDir = ((_context$target2 = context.target) === null || _context$target2 === void 0 ? void 0 : _context$target2.hostRootDir) || context.hostRootDir;
|
|
82
68
|
const exposedRules = (0, _getExposedRules().getExposedRules)(peers, logger, hostRootDir);
|
|
83
69
|
config.addModuleRules(exposedRules);
|
|
84
70
|
return config;
|
|
85
71
|
};
|
|
86
72
|
}
|
|
73
|
+
|
|
87
74
|
/**
|
|
88
75
|
* Generate a transformer that expose all the peers as global via the expose loader
|
|
89
76
|
* @param peers
|
|
90
77
|
* @returns
|
|
91
78
|
*/
|
|
92
|
-
|
|
93
|
-
|
|
94
79
|
function generateExternalsTransformer(depes) {
|
|
95
80
|
return config => {
|
|
96
81
|
const externals = (0, _getExternals().getExternals)(depes);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["generateAddAliasesFromPeersTransformer","peers","logger","config","context","hostRootDir","target","peerAliases","reduce","acc","peerName","resolved","resolvePeerToDirOrFile","addAliases","generateExposePeersTransformer","exposedRules","getExposedRules","addModuleRules","generateExternalsTransformer","depes","externals","getExternals","addExternals"],"sources":["transformers.ts"],"sourcesContent":["import { WebpackConfigTransformContext } from '@teambit/webpack';\nimport { WebpackConfigMutator } from '@teambit/webpack.modules.config-mutator';\nimport { Logger } from '@teambit/logger';\nimport { getExposedRules } from './get-exposed-rules';\nimport { resolvePeerToDirOrFile } from './resolve-peer';\nimport { getExternals } from './get-externals';\n\nexport function generateAddAliasesFromPeersTransformer(peers: string[], logger: Logger) {\n return (config: WebpackConfigMutator, context: WebpackConfigTransformContext): WebpackConfigMutator => {\n const hostRootDir = context.target?.hostRootDir || context.hostRootDir;\n const peerAliases = peers.reduce((acc, peerName) => {\n // gets the correct module folder of the package.\n // this allows us to resolve internal files, for example:\n // node_modules/react-dom/test-utils\n //\n // we can't use require.resolve() because it resolves to a specific file.\n // for example, if we used \"react-dom\": require.resolve(\"react-dom\"),\n // it would try to resolve \"react-dom/test-utils\" as:\n // node_modules/react-dom/index.js/test-utils\n const resolved = resolvePeerToDirOrFile(peerName, logger, hostRootDir);\n // Sometime there are packages that only hold icons for example, so there is no main property in their package.json\n // so they can't be resolved.\n // in such cases do not add them to the aliases.\n // We already log that cases in the resolvePeerToDirOrFile function.\n if (resolved) {\n acc[peerName] = resolved;\n }\n return acc;\n }, {});\n\n config.addAliases(peerAliases);\n return config;\n };\n}\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\n/**\n * Generate a transformer that expose all the peers as global via the expose loader\n * @param peers\n * @returns\n */\nexport function generateExternalsTransformer(depes: string[]) {\n return (config: WebpackConfigMutator): WebpackConfigMutator => {\n const externals = getExternals(depes);\n config.addExternals(externals);\n return config;\n };\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["generateAddAliasesFromPeersTransformer","peers","logger","config","context","hostRootDir","target","peerAliases","reduce","acc","peerName","resolved","resolvePeerToDirOrFile","addAliases","generateExposePeersTransformer","exposedRules","getExposedRules","addModuleRules","generateExternalsTransformer","depes","externals","getExternals","addExternals"],"sources":["transformers.ts"],"sourcesContent":["import { WebpackConfigTransformContext } from '@teambit/webpack';\nimport { WebpackConfigMutator } from '@teambit/webpack.modules.config-mutator';\nimport { Logger } from '@teambit/logger';\nimport { getExposedRules } from './get-exposed-rules';\nimport { resolvePeerToDirOrFile } from './resolve-peer';\nimport { getExternals } from './get-externals';\n\nexport function generateAddAliasesFromPeersTransformer(peers: string[], logger: Logger) {\n return (config: WebpackConfigMutator, context: WebpackConfigTransformContext): WebpackConfigMutator => {\n const hostRootDir = context.target?.hostRootDir || context.hostRootDir;\n const peerAliases = peers.reduce((acc, peerName) => {\n // gets the correct module folder of the package.\n // this allows us to resolve internal files, for example:\n // node_modules/react-dom/test-utils\n //\n // we can't use require.resolve() because it resolves to a specific file.\n // for example, if we used \"react-dom\": require.resolve(\"react-dom\"),\n // it would try to resolve \"react-dom/test-utils\" as:\n // node_modules/react-dom/index.js/test-utils\n const resolved = resolvePeerToDirOrFile(peerName, logger, hostRootDir);\n // Sometime there are packages that only hold icons for example, so there is no main property in their package.json\n // so they can't be resolved.\n // in such cases do not add them to the aliases.\n // We already log that cases in the resolvePeerToDirOrFile function.\n if (resolved) {\n acc[peerName] = resolved;\n }\n return acc;\n }, {});\n\n config.addAliases(peerAliases);\n return config;\n };\n}\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\n/**\n * Generate a transformer that expose all the peers as global via the expose loader\n * @param peers\n * @returns\n */\nexport function generateExternalsTransformer(depes: string[]) {\n return (config: WebpackConfigMutator): WebpackConfigMutator => {\n const externals = getExternals(depes);\n config.addExternals(externals);\n return config;\n };\n}\n"],"mappings":";;;;;;;;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,SAASA,sCAAsC,CAACC,KAAe,EAAEC,MAAc,EAAE;EACtF,OAAO,CAACC,MAA4B,EAAEC,OAAsC,KAA2B;IAAA;IACrG,MAAMC,WAAW,GAAG,oBAAAD,OAAO,CAACE,MAAM,oDAAd,gBAAgBD,WAAW,KAAID,OAAO,CAACC,WAAW;IACtE,MAAME,WAAW,GAAGN,KAAK,CAACO,MAAM,CAAC,CAACC,GAAG,EAAEC,QAAQ,KAAK;MAClD;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA,MAAMC,QAAQ,GAAG,IAAAC,qCAAsB,EAACF,QAAQ,EAAER,MAAM,EAAEG,WAAW,CAAC;MACtE;MACA;MACA;MACA;MACA,IAAIM,QAAQ,EAAE;QACZF,GAAG,CAACC,QAAQ,CAAC,GAAGC,QAAQ;MAC1B;MACA,OAAOF,GAAG;IACZ,CAAC,EAAE,CAAC,CAAC,CAAC;IAENN,MAAM,CAACU,UAAU,CAACN,WAAW,CAAC;IAC9B,OAAOJ,MAAM;EACf,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASW,8BAA8B,CAACb,KAAe,EAAEC,MAAc,EAAE;EAC9E,OAAO,CAACC,MAA4B,EAAEC,OAAsC,KAA2B;IAAA;IACrG,MAAMC,WAAW,GAAG,qBAAAD,OAAO,CAACE,MAAM,qDAAd,iBAAgBD,WAAW,KAAID,OAAO,CAACC,WAAW;IACtE,MAAMU,YAAY,GAAG,IAAAC,kCAAe,EAACf,KAAK,EAAEC,MAAM,EAAEG,WAAW,CAAC;IAChEF,MAAM,CAACc,cAAc,CAACF,YAAY,CAAC;IACnC,OAAOZ,MAAM;EACf,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASe,4BAA4B,CAACC,KAAe,EAAE;EAC5D,OAAQhB,MAA4B,IAA2B;IAC7D,MAAMiB,SAAS,GAAG,IAAAC,4BAAY,EAACF,KAAK,CAAC;IACrChB,MAAM,CAACmB,YAAY,CAACF,SAAS,CAAC;IAC9B,OAAOjB,MAAM;EACf,CAAC;AACH"}
|
package/dist/webpack.aspect.js
CHANGED
|
@@ -4,21 +4,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.WebpackAspect = void 0;
|
|
7
|
-
|
|
8
7
|
function _harmony() {
|
|
9
8
|
const data = require("@teambit/harmony");
|
|
10
|
-
|
|
11
9
|
_harmony = function () {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
const WebpackAspect = _harmony().Aspect.create({
|
|
19
15
|
id: 'teambit.webpack/webpack'
|
|
20
16
|
});
|
|
21
|
-
|
|
22
17
|
exports.WebpackAspect = WebpackAspect;
|
|
23
18
|
|
|
24
19
|
//# sourceMappingURL=webpack.aspect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["WebpackAspect","Aspect","create","id"],"sources":["webpack.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const WebpackAspect = Aspect.create({\n id: 'teambit.webpack/webpack',\n});\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["WebpackAspect","Aspect","create","id"],"sources":["webpack.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const WebpackAspect = Aspect.create({\n id: 'teambit.webpack/webpack',\n});\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,aAAa,GAAGC,iBAAM,CAACC,MAAM,CAAC;EACzCC,EAAE,EAAE;AACN,CAAC,CAAC;AAAC"}
|
package/dist/webpack.bundler.js
CHANGED
|
@@ -1,56 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
require("core-js/modules/es.array.iterator.js");
|
|
6
|
-
|
|
7
5
|
require("core-js/modules/es.promise.js");
|
|
8
|
-
|
|
9
6
|
Object.defineProperty(exports, "__esModule", {
|
|
10
7
|
value: true
|
|
11
8
|
});
|
|
12
9
|
exports.WebpackBundler = void 0;
|
|
13
|
-
|
|
14
10
|
function _bitError() {
|
|
15
11
|
const data = require("@teambit/bit-error");
|
|
16
|
-
|
|
17
12
|
_bitError = function () {
|
|
18
13
|
return data;
|
|
19
14
|
};
|
|
20
|
-
|
|
21
15
|
return data;
|
|
22
16
|
}
|
|
23
|
-
|
|
24
17
|
function _lodash() {
|
|
25
18
|
const data = require("lodash");
|
|
26
|
-
|
|
27
19
|
_lodash = function () {
|
|
28
20
|
return data;
|
|
29
21
|
};
|
|
30
|
-
|
|
31
22
|
return data;
|
|
32
23
|
}
|
|
33
|
-
|
|
34
24
|
function _pMapSeries() {
|
|
35
25
|
const data = _interopRequireDefault(require("p-map-series"));
|
|
36
|
-
|
|
37
26
|
_pMapSeries = function () {
|
|
38
27
|
return data;
|
|
39
28
|
};
|
|
40
|
-
|
|
41
29
|
return data;
|
|
42
30
|
}
|
|
43
|
-
|
|
44
31
|
function _path() {
|
|
45
32
|
const data = require("path");
|
|
46
|
-
|
|
47
33
|
_path = function () {
|
|
48
34
|
return data;
|
|
49
35
|
};
|
|
50
|
-
|
|
51
36
|
return data;
|
|
52
37
|
}
|
|
53
|
-
|
|
54
38
|
class WebpackBundler {
|
|
55
39
|
constructor(
|
|
56
40
|
/**
|
|
@@ -67,10 +51,8 @@ class WebpackBundler {
|
|
|
67
51
|
this.webpack = webpack;
|
|
68
52
|
this.metaData = metaData;
|
|
69
53
|
}
|
|
70
|
-
|
|
71
54
|
async run() {
|
|
72
55
|
var _this$metaData, _this$metaData2;
|
|
73
|
-
|
|
74
56
|
const startTime = Date.now();
|
|
75
57
|
const compilers = this.configs.map(config => this.webpack(config));
|
|
76
58
|
const initiator = (_this$metaData = this.metaData) === null || _this$metaData === void 0 ? void 0 : _this$metaData.initiator;
|
|
@@ -96,8 +78,8 @@ class WebpackBundler {
|
|
|
96
78
|
components
|
|
97
79
|
});
|
|
98
80
|
}
|
|
99
|
-
|
|
100
|
-
|
|
81
|
+
if (!stats) throw new (_bitError().BitError)('unknown build error');
|
|
82
|
+
// const info = stats.toJson();
|
|
101
83
|
|
|
102
84
|
const info = stats.toJson({
|
|
103
85
|
all: false,
|
|
@@ -128,7 +110,6 @@ class WebpackBundler {
|
|
|
128
110
|
longProcessLogger.end();
|
|
129
111
|
return componentOutput;
|
|
130
112
|
}
|
|
131
|
-
|
|
132
113
|
getErrors(stats) {
|
|
133
114
|
if (!stats.errors) return [];
|
|
134
115
|
const fieldsToShow = ['message', 'moduleId', 'moduleName', 'moduleIdentifier', 'loc'];
|
|
@@ -137,14 +118,12 @@ class WebpackBundler {
|
|
|
137
118
|
if (webpackError[fieldName]) {
|
|
138
119
|
return `${fieldName}: ${webpackError[fieldName]}`;
|
|
139
120
|
}
|
|
140
|
-
|
|
141
121
|
return undefined;
|
|
142
122
|
});
|
|
143
123
|
const errorMessage = (0, _lodash().compact)(lines).join('\n');
|
|
144
124
|
return new (_bitError().BitError)(errorMessage);
|
|
145
125
|
});
|
|
146
126
|
}
|
|
147
|
-
|
|
148
127
|
getAssets(stats) {
|
|
149
128
|
if (!stats.assets) return {};
|
|
150
129
|
return stats.assets.reduce((acc, asset) => {
|
|
@@ -156,20 +135,16 @@ class WebpackBundler {
|
|
|
156
135
|
return acc;
|
|
157
136
|
}, {});
|
|
158
137
|
}
|
|
159
|
-
|
|
160
138
|
getEntriesAssetsMap(stats, assetsMap) {
|
|
161
139
|
const entriesMap = stats.entrypoints;
|
|
162
140
|
if (!entriesMap || !Object.keys(assetsMap).length) return {};
|
|
163
141
|
Object.entries(entriesMap).forEach(([, entryVal]) => {
|
|
164
142
|
var _entryVal$assets, _entryVal$auxiliaryAs;
|
|
165
|
-
|
|
166
143
|
let compressedAssetsSize = 0;
|
|
167
144
|
let compressedAuxiliaryAssetsSize = 0;
|
|
168
145
|
(_entryVal$assets = entryVal.assets) === null || _entryVal$assets === void 0 ? void 0 : _entryVal$assets.forEach(asset => {
|
|
169
146
|
var _assetsMap$asset$name;
|
|
170
|
-
|
|
171
147
|
const compressedSize = (_assetsMap$asset$name = assetsMap[asset.name]) === null || _assetsMap$asset$name === void 0 ? void 0 : _assetsMap$asset$name.compressedSize;
|
|
172
|
-
|
|
173
148
|
if (compressedSize) {
|
|
174
149
|
// @ts-ignore
|
|
175
150
|
asset.compressedSize = compressedSize;
|
|
@@ -178,9 +153,7 @@ class WebpackBundler {
|
|
|
178
153
|
});
|
|
179
154
|
(_entryVal$auxiliaryAs = entryVal.auxiliaryAssets) === null || _entryVal$auxiliaryAs === void 0 ? void 0 : _entryVal$auxiliaryAs.forEach(asset => {
|
|
180
155
|
var _assetsMap$asset$name2;
|
|
181
|
-
|
|
182
156
|
const compressedSize = (_assetsMap$asset$name2 = assetsMap[asset.name]) === null || _assetsMap$asset$name2 === void 0 ? void 0 : _assetsMap$asset$name2.compressedSize;
|
|
183
|
-
|
|
184
157
|
if (compressedSize) {
|
|
185
158
|
// @ts-ignore
|
|
186
159
|
asset.compressedSize = compressedSize;
|
|
@@ -192,7 +165,6 @@ class WebpackBundler {
|
|
|
192
165
|
});
|
|
193
166
|
return entriesMap;
|
|
194
167
|
}
|
|
195
|
-
|
|
196
168
|
getCompressedSize(asset) {
|
|
197
169
|
if (!asset.related || (0, _lodash().isEmpty)(asset.related)) return undefined;
|
|
198
170
|
const gzipped = asset.related.find(relatedAsset => {
|
|
@@ -201,16 +173,13 @@ class WebpackBundler {
|
|
|
201
173
|
if (!gzipped) return undefined;
|
|
202
174
|
return gzipped.size;
|
|
203
175
|
}
|
|
204
|
-
|
|
205
176
|
getComponents(outputPath) {
|
|
206
177
|
const path = outputPath.substring(0, outputPath.lastIndexOf(_path().sep));
|
|
207
178
|
const target = this.targets.find(targetCandidate => path === targetCandidate.outputPath);
|
|
208
179
|
if (!target) throw new Error(`Could not find component id for path "${path}"`);
|
|
209
180
|
return target.components;
|
|
210
181
|
}
|
|
211
|
-
|
|
212
182
|
}
|
|
213
|
-
|
|
214
183
|
exports.WebpackBundler = WebpackBundler;
|
|
215
184
|
|
|
216
185
|
//# sourceMappingURL=webpack.bundler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["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","ids","component","id","toString","join","logProgress","debug","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","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"],"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 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 const componentOutput = await mapSeries(compilers, (compiler: Compiler) => {\n const components = this.getComponents(compiler.outputPath);\n const componentsLengthMessage = `running on ${components.length} components`;\n const fullMessage = `${initiatorMessage} ${envIdMessage} ${componentsLengthMessage}`;\n const ids = components.map((component) => component.id.toString()).join(', ');\n longProcessLogger.logProgress(`${fullMessage}`);\n this.logger.debug(`${fullMessage}\\ncomponents ids: ${ids}`);\n return new Promise((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 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;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGO,MAAMA,cAAN,CAAwC;EAC7CC,WAAW;EACT;AACJ;AACA;EACYC,OAJC;EAMT;AACJ;AACA;EACYC,OATC,EAWDC,MAXC,EAaDC,OAbC,EAeDC,QAfC,EAgBT;IAAA,KAZQJ,OAYR,GAZQA,OAYR;IAAA,KAPQC,OAOR,GAPQA,OAOR;IAAA,KALQC,MAKR,GALQA,MAKR;IAAA,KAHQC,OAGR,GAHQA,OAGR;IAAA,KADQC,QACR,GADQA,QACR;EAAE;;EAEK,MAAHC,GAAG,GAA6B;IAAA;;IACpC,MAAMC,SAAS,GAAGC,IAAI,CAACC,GAAL,EAAlB;IACA,MAAMC,SAAS,GAAG,KAAKR,OAAL,CAAaS,GAAb,CAAkBC,MAAD,IAAiB,KAAKR,OAAL,CAAaQ,MAAb,CAAlC,CAAlB;IACA,MAAMC,SAAS,qBAAG,KAAKR,QAAR,mDAAG,eAAeQ,SAAjC;IACA,MAAMC,KAAK,sBAAG,KAAKT,QAAR,oDAAG,gBAAeS,KAA7B;IACA,MAAMC,gBAAgB,GAAGF,SAAS,GAAI,yBAAwBA,SAAU,GAAtC,GAA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f;IAEA,IAAI,CAACuE,MAAL,EAAa,MAAM,IAAIE,KAAJ,CAAW,yCAAwCpC,IAAK,GAAxD,CAAN;IACb,OAAOkC,MAAM,CAACzE,UAAd;EACD;;AAvJ4C"}
|
|
1
|
+
{"version":3,"names":["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","ids","component","id","toString","join","logProgress","debug","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","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"],"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 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 const componentOutput = await mapSeries(compilers, (compiler: Compiler) => {\n const components = this.getComponents(compiler.outputPath);\n const componentsLengthMessage = `running on ${components.length} components`;\n const fullMessage = `${initiatorMessage} ${envIdMessage} ${componentsLengthMessage}`;\n const ids = components.map((component) => component.id.toString()).join(', ');\n longProcessLogger.logProgress(`${fullMessage}`);\n this.logger.debug(`${fullMessage}\\ncomponents ids: ${ids}`);\n return new Promise((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 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;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAA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;UAClB;UACAH,KAAK,CAACG,cAAc,GAAGA,cAAc;UACrCQ,6BAA6B,IAAIR,cAAc;QACjD;MACF,CAAC,CAAC;MACFM,QAAQ,CAACC,oBAAoB,GAAGA,oBAAoB;MACpDD,QAAQ,CAACE,6BAA6B,GAAGA,6BAA6B;IACxE,CAAC,CAAC;IACF,OAAON,UAAU;EACnB;EAEQD,iBAAiB,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;EAEQpD,aAAa,CAACC,UAAkB,EAAE;IACxC,MAAMqC,IAAI,GAAGrC,UAAU,CAACoE,SAAS,CAAC,CAAC,EAAEpE,UAAU,CAACqE,WAAW,CAACC,WAAG,CAAC,CAAC;IACjE,MAAMC,MAAM,GAAG,IAAI,CAAC/F,OAAO,CAACyF,IAAI,CAAEO,eAAe,IAAKnC,IAAI,KAAKmC,eAAe,CAACxE,UAAU,CAAC;IAE1F,IAAI,CAACuE,MAAM,EAAE,MAAM,IAAIE,KAAK,CAAE,yCAAwCpC,IAAK,GAAE,CAAC;IAC9E,OAAOkC,MAAM,CAACzE,UAAU;EAC1B;AACF;AAAC"}
|
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.Logo = void 0;
|
|
9
|
-
|
|
10
8
|
function _react() {
|
|
11
9
|
const data = _interopRequireDefault(require("react"));
|
|
12
|
-
|
|
13
10
|
_react = function () {
|
|
14
11
|
return data;
|
|
15
12
|
};
|
|
16
|
-
|
|
17
13
|
return data;
|
|
18
14
|
}
|
|
19
|
-
|
|
20
15
|
const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
|
|
21
16
|
style: {
|
|
22
17
|
height: '100%',
|
|
@@ -29,7 +24,6 @@ const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
|
|
|
29
24
|
},
|
|
30
25
|
src: "https://static.bit.dev/brands/logo-webpack.svg"
|
|
31
26
|
}));
|
|
32
|
-
|
|
33
27
|
exports.Logo = Logo;
|
|
34
28
|
|
|
35
29
|
//# sourceMappingURL=webpack.composition.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Logo","height","display","justifyContent","width"],"sources":["webpack.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/brands/logo-webpack.svg\" />\n </div>\n);\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["Logo","height","display","justifyContent","width"],"sources":["webpack.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/brands/logo-webpack.svg\" />\n </div>\n);\n"],"mappings":";;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,IAAI,GAAG,mBAClB;EAAK,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAM;IAAEC,OAAO,EAAE,MAAM;IAAEC,cAAc,EAAE;EAAS;AAAE,gBACxE;EAAK,KAAK,EAAE;IAAEC,KAAK,EAAE;EAAG,CAAE;EAAC,GAAG,EAAC;AAAgD,EAAG,CAErF;AAAC"}
|