@teambit/webpack 1.0.543 → 1.0.544
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.
@@ -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.544/dist/webpack.composition.js';
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.webpack_webpack@1.0.544/dist/webpack.docs.mdx';
|
3
3
|
|
4
4
|
export const compositions = [compositions_0];
|
5
5
|
export const overview = [overview_0];
|
@@ -19,13 +19,6 @@ function _enhancedResolve() {
|
|
19
19
|
};
|
20
20
|
return data;
|
21
21
|
}
|
22
|
-
function _resolve() {
|
23
|
-
const data = _interopRequireDefault(require("resolve"));
|
24
|
-
_resolve = function () {
|
25
|
-
return data;
|
26
|
-
};
|
27
|
-
return data;
|
28
|
-
}
|
29
22
|
function _findRoot() {
|
30
23
|
const data = _interopRequireDefault(require("find-root"));
|
31
24
|
_findRoot = function () {
|
@@ -49,11 +42,10 @@ function resolvePeerToDirOrFile(peerName, logger, hostRootDir) {
|
|
49
42
|
paths: [process.cwd(), __dirname]
|
50
43
|
};
|
51
44
|
if (hostRootDir) {
|
52
|
-
options.basedir = hostRootDir;
|
53
45
|
// resolve the host root dir to its real location, as require.resolve is preserve symlink, so we get wrong result otherwise
|
54
46
|
options.paths.unshift((0, _fs().realpathSync)(hostRootDir));
|
55
47
|
}
|
56
|
-
resolved =
|
48
|
+
resolved = require.resolve(peerName, options);
|
57
49
|
const folder = (0, _findRoot().default)(resolved);
|
58
50
|
return folder;
|
59
51
|
} catch {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_fs","data","_interopRequireWildcard","require","_enhancedResolve","
|
1
|
+
{"version":3,"names":["_fs","data","_interopRequireWildcard","require","_enhancedResolve","_findRoot","_interopRequireDefault","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","resolvePeerToDirOrFile","peerName","logger","hostRootDir","resolved","options","paths","process","cwd","__dirname","unshift","realpathSync","resolve","folder","findRoot","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 {\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,SAAAA,IAAA;EAAA,MAAAC,IAAA,GAAAC,uBAAA,CAAAC,OAAA;EAAAH,GAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,iBAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,gBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,UAAA;EAAA,MAAAJ,IAAA,GAAAK,sBAAA,CAAAH,OAAA;EAAAE,SAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAiC,SAAAK,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAD,wBAAA,YAAAA,CAAAH,CAAA,WAAAA,CAAA,GAAAM,CAAA,GAAAD,CAAA,KAAAL,CAAA;AAAA,SAAAL,wBAAAK,CAAA,EAAAK,CAAA,SAAAA,CAAA,IAAAL,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAE,OA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M;EACf,CAAC,CAAC,MAAM;IACN,IAAIT,QAAQ,EAAE;MACZF,MAAM,CAACa,IAAI,CAAC,+BAA+Bd,QAAQ,gBAAgBG,QAAQ,8BAA8B,CAAC;IAC5G,CAAC,MAAM;MACLF,MAAM,CAACa,IAAI,CAAC,qBAAqBd,QAAQ,8BAA8B,CAAC;IAC1E;IACA,OAAOG,QAAQ;EACjB;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASY,iBAAiBA,CAACC,IAAY,EAAEf,MAAc,EAAEC,WAAoB,EAAsB;EACxG,MAAMe,SAAS,GAAGlB,sBAAsB,CAACiB,IAAI,EAAEf,MAAM,EAAEC,WAAW,CAAC;EACnE,IAAI,CAACe,SAAS,EAAE,OAAOC,SAAS;EAChC,MAAMC,QAAQ,GAAGC,cAAc,CAAC,CAAC;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,cAAcA,CAAA,EAAG;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","ignoreList":[]}
|
package/package.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "@teambit/webpack",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.544",
|
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.544"
|
10
10
|
},
|
11
11
|
"dependencies": {
|
12
12
|
"webpack": "5.97.1",
|
@@ -44,16 +44,15 @@
|
|
44
44
|
"expose-loader": "3.1.0",
|
45
45
|
"inject-body-webpack-plugin": "1.3.0",
|
46
46
|
"enhanced-resolve": "4.5.0",
|
47
|
-
"resolve": "1.20.0",
|
48
47
|
"@teambit/harmony": "0.4.6",
|
49
48
|
"@teambit/bit-error": "0.0.404",
|
50
49
|
"@teambit/preview.cli.dev-server-events-listener": "0.0.1",
|
51
50
|
"@teambit/webpack.modules.config-mutator": "0.0.172",
|
52
|
-
"@teambit/bundler": "1.0.
|
53
|
-
"@teambit/logger": "0.0.
|
54
|
-
"@teambit/cli": "0.0.
|
55
|
-
"@teambit/pubsub": "1.0.
|
56
|
-
"@teambit/workspace": "1.0.
|
51
|
+
"@teambit/bundler": "1.0.544",
|
52
|
+
"@teambit/logger": "0.0.1214",
|
53
|
+
"@teambit/cli": "0.0.1121",
|
54
|
+
"@teambit/pubsub": "1.0.544",
|
55
|
+
"@teambit/workspace": "1.0.544",
|
57
56
|
"@teambit/toolbox.path.path": "0.0.8",
|
58
57
|
"@teambit/webpack.modules.generate-expose-loaders": "0.0.21",
|
59
58
|
"@teambit/webpack.modules.generate-externals": "0.0.21",
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import fs, { realpathSync } from 'fs';
|
2
2
|
import { ResolverFactory, CachedInputFileSystem } from 'enhanced-resolve';
|
3
|
-
import resolve from 'resolve';
|
4
3
|
import findRoot from 'find-root';
|
5
4
|
import { Logger } from '@teambit/logger';
|
6
5
|
|
@@ -12,20 +11,16 @@ import { Logger } from '@teambit/logger';
|
|
12
11
|
export function resolvePeerToDirOrFile(peerName: string, logger: Logger, hostRootDir?: string): string | undefined {
|
13
12
|
let resolved;
|
14
13
|
try {
|
15
|
-
const options
|
16
|
-
basedir?: string;
|
17
|
-
paths: string[];
|
18
|
-
} = {
|
14
|
+
const options = {
|
19
15
|
// resolve the host root dir to its real location, as require.resolve is preserve symlink, so we get wrong result otherwise
|
20
16
|
paths: [process.cwd(), __dirname],
|
21
17
|
};
|
22
18
|
if (hostRootDir) {
|
23
|
-
options.basedir = hostRootDir;
|
24
19
|
// resolve the host root dir to its real location, as require.resolve is preserve symlink, so we get wrong result otherwise
|
25
20
|
options.paths.unshift(realpathSync(hostRootDir));
|
26
21
|
}
|
27
22
|
|
28
|
-
resolved = resolve
|
23
|
+
resolved = require.resolve(peerName, options);
|
29
24
|
const folder = findRoot(resolved);
|
30
25
|
return folder;
|
31
26
|
} catch {
|