@module-federation/nextjs-mf 8.8.55 → 8.8.57
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/LICENSE +21 -0
- package/dist/_virtual/_rolldown/runtime.js +29 -0
- package/dist/_virtual/_rolldown/runtime.mjs +8 -0
- package/dist/client/UrlNode.js +89 -147
- package/dist/client/UrlNode.js.map +1 -1
- package/dist/client/UrlNode.mjs +91 -0
- package/dist/client/UrlNode.mjs.map +1 -0
- package/dist/src/federation-noop.d.mts +1 -0
- package/dist/src/federation-noop.d.ts +1 -0
- package/dist/src/federation-noop.js +17 -0
- package/dist/src/federation-noop.js.map +1 -1
- package/dist/src/federation-noop.mjs +23 -0
- package/dist/src/federation-noop.mjs.map +1 -0
- package/dist/src/index.d.mts +2 -0
- package/dist/src/index.d.ts +2 -3
- package/dist/src/index.js +13 -11
- package/dist/src/index.js.map +1 -1
- package/dist/src/index.mjs +8 -0
- package/dist/src/index.mjs.map +1 -0
- package/dist/src/internal.js +140 -243
- package/dist/src/internal.js.map +1 -1
- package/dist/src/internal.mjs +152 -0
- package/dist/src/internal.mjs.map +1 -0
- package/dist/src/loaders/fixImageLoader.d.mts +27 -0
- package/dist/src/loaders/fixImageLoader.d.ts +8 -3
- package/dist/src/loaders/fixImageLoader.js +91 -103
- package/dist/src/loaders/fixImageLoader.js.map +1 -1
- package/dist/src/loaders/fixImageLoader.mjs +101 -0
- package/dist/src/loaders/fixImageLoader.mjs.map +1 -0
- package/dist/src/loaders/fixUrlLoader.d.mts +16 -0
- package/dist/src/loaders/fixUrlLoader.d.ts +5 -2
- package/dist/src/loaders/fixUrlLoader.js +17 -19
- package/dist/src/loaders/fixUrlLoader.js.map +1 -1
- package/dist/src/loaders/fixUrlLoader.mjs +19 -0
- package/dist/src/loaders/fixUrlLoader.mjs.map +1 -0
- package/dist/src/loaders/helpers.js +72 -124
- package/dist/src/loaders/helpers.js.map +1 -1
- package/dist/src/loaders/helpers.mjs +79 -0
- package/dist/src/loaders/helpers.mjs.map +1 -0
- package/dist/src/loaders/nextPageMapLoader.d.mts +29 -0
- package/dist/src/loaders/nextPageMapLoader.d.ts +10 -5
- package/dist/src/loaders/nextPageMapLoader.js +126 -144
- package/dist/src/loaders/nextPageMapLoader.js.map +1 -1
- package/dist/src/loaders/nextPageMapLoader.mjs +143 -0
- package/dist/src/loaders/nextPageMapLoader.mjs.map +1 -0
- package/dist/src/logger.js +7 -7
- package/dist/src/logger.js.map +1 -1
- package/dist/src/logger.mjs +8 -0
- package/dist/src/logger.mjs.map +1 -0
- package/dist/src/plugins/CopyFederationPlugin.js +64 -71
- package/dist/src/plugins/CopyFederationPlugin.js.map +1 -1
- package/dist/src/plugins/CopyFederationPlugin.mjs +65 -0
- package/dist/src/plugins/CopyFederationPlugin.mjs.map +1 -0
- package/dist/src/plugins/NextFederationPlugin/apply-client-plugins.js +36 -53
- package/dist/src/plugins/NextFederationPlugin/apply-client-plugins.js.map +1 -1
- package/dist/src/plugins/NextFederationPlugin/apply-client-plugins.mjs +40 -0
- package/dist/src/plugins/NextFederationPlugin/apply-client-plugins.mjs.map +1 -0
- package/dist/src/plugins/NextFederationPlugin/apply-server-plugins.js +103 -121
- package/dist/src/plugins/NextFederationPlugin/apply-server-plugins.js.map +1 -1
- package/dist/src/plugins/NextFederationPlugin/apply-server-plugins.mjs +111 -0
- package/dist/src/plugins/NextFederationPlugin/apply-server-plugins.mjs.map +1 -0
- package/dist/src/plugins/NextFederationPlugin/index.d.mts +31 -0
- package/dist/src/plugins/NextFederationPlugin/index.d.ts +27 -23
- package/dist/src/plugins/NextFederationPlugin/index.js +147 -181
- package/dist/src/plugins/NextFederationPlugin/index.js.map +1 -1
- package/dist/src/plugins/NextFederationPlugin/index.mjs +150 -0
- package/dist/src/plugins/NextFederationPlugin/index.mjs.map +1 -0
- package/dist/src/plugins/NextFederationPlugin/next-fragments.d.mts +18 -0
- package/dist/src/plugins/NextFederationPlugin/next-fragments.d.ts +16 -18
- package/dist/src/plugins/NextFederationPlugin/next-fragments.js +62 -92
- package/dist/src/plugins/NextFederationPlugin/next-fragments.js.map +1 -1
- package/dist/src/plugins/NextFederationPlugin/next-fragments.mjs +68 -0
- package/dist/src/plugins/NextFederationPlugin/next-fragments.mjs.map +1 -0
- package/dist/src/plugins/NextFederationPlugin/set-options.js +17 -19
- package/dist/src/plugins/NextFederationPlugin/set-options.js.map +1 -1
- package/dist/src/plugins/NextFederationPlugin/set-options.mjs +19 -0
- package/dist/src/plugins/NextFederationPlugin/set-options.mjs.map +1 -0
- package/dist/src/plugins/NextFederationPlugin/validate-options.js +30 -38
- package/dist/src/plugins/NextFederationPlugin/validate-options.js.map +1 -1
- package/dist/src/plugins/NextFederationPlugin/validate-options.mjs +35 -0
- package/dist/src/plugins/NextFederationPlugin/validate-options.mjs.map +1 -0
- package/dist/src/plugins/container/InvertedContainerPlugin.js +22 -25
- package/dist/src/plugins/container/InvertedContainerPlugin.js.map +1 -1
- package/dist/src/plugins/container/InvertedContainerPlugin.mjs +23 -0
- package/dist/src/plugins/container/InvertedContainerPlugin.mjs.map +1 -0
- package/dist/src/plugins/container/InvertedContainerRuntimeModule.js +55 -67
- package/dist/src/plugins/container/InvertedContainerRuntimeModule.js.map +1 -1
- package/dist/src/plugins/container/InvertedContainerRuntimeModule.mjs +57 -0
- package/dist/src/plugins/container/InvertedContainerRuntimeModule.mjs.map +1 -0
- package/dist/src/plugins/container/runtimePlugin.d.mts +7 -0
- package/dist/src/plugins/container/runtimePlugin.d.ts +6 -2
- package/dist/src/plugins/container/runtimePlugin.js +167 -0
- package/dist/src/plugins/container/runtimePlugin.js.map +1 -1
- package/dist/src/plugins/container/runtimePlugin.mjs +166 -0
- package/dist/src/plugins/container/runtimePlugin.mjs.map +1 -0
- package/dist/utils/flushedChunks.d.mts +29 -0
- package/dist/utils/flushedChunks.d.ts +12 -5
- package/dist/utils/flushedChunks.js +32 -72
- package/dist/utils/flushedChunks.js.map +1 -1
- package/dist/utils/flushedChunks.mjs +35 -0
- package/dist/utils/flushedChunks.mjs.map +1 -0
- package/dist/utils/index.d.mts +14 -0
- package/dist/utils/index.d.ts +8 -14
- package/dist/utils/index.js +27 -62
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +22 -0
- package/dist/utils/index.mjs.map +1 -0
- package/package.json +29 -9
- package/dist/client/UrlNode.d.ts +0 -17
- package/dist/node.d.ts +0 -1
- package/dist/node.js +0 -18
- package/dist/node.js.map +0 -1
- package/dist/package.json +0 -80
- package/dist/src/federation-noop.cjs +0 -15
- package/dist/src/internal.d.ts +0 -50
- package/dist/src/loaders/helpers.d.ts +0 -17
- package/dist/src/logger.d.ts +0 -2
- package/dist/src/plugins/AddRuntimeRequirementToPromiseExternalPlugin.d.ts +0 -5
- package/dist/src/plugins/AddRuntimeRequirementToPromiseExternalPlugin.js +0 -19
- package/dist/src/plugins/AddRuntimeRequirementToPromiseExternalPlugin.js.map +0 -1
- package/dist/src/plugins/CopyFederationPlugin.d.ts +0 -20
- package/dist/src/plugins/NextFederationPlugin/apply-client-plugins.d.ts +0 -23
- package/dist/src/plugins/NextFederationPlugin/apply-server-plugins.d.ts +0 -36
- package/dist/src/plugins/NextFederationPlugin/regex-equal.d.ts +0 -14
- package/dist/src/plugins/NextFederationPlugin/regex-equal.js +0 -25
- package/dist/src/plugins/NextFederationPlugin/regex-equal.js.map +0 -1
- package/dist/src/plugins/NextFederationPlugin/remove-unnecessary-shared-keys.d.ts +0 -8
- package/dist/src/plugins/NextFederationPlugin/remove-unnecessary-shared-keys.js +0 -34
- package/dist/src/plugins/NextFederationPlugin/remove-unnecessary-shared-keys.js.map +0 -1
- package/dist/src/plugins/NextFederationPlugin/set-options.d.ts +0 -16
- package/dist/src/plugins/NextFederationPlugin/validate-options.d.ts +0 -25
- package/dist/src/plugins/container/InvertedContainerPlugin.d.ts +0 -5
- package/dist/src/plugins/container/InvertedContainerRuntimeModule.d.ts +0 -11
- package/dist/src/plugins/container/RemoveEagerModulesFromRuntimePlugin.d.ts +0 -39
- package/dist/src/plugins/container/RemoveEagerModulesFromRuntimePlugin.js +0 -78
- package/dist/src/plugins/container/RemoveEagerModulesFromRuntimePlugin.js.map +0 -1
- package/dist/src/plugins/container/runtimePlugin.cjs +0 -219
- package/dist/src/plugins/container/types.d.ts +0 -2
- package/dist/src/plugins/container/types.js +0 -3
- package/dist/src/plugins/container/types.js.map +0 -1
- package/dist/src/types.d.ts +0 -28
- package/dist/src/types.js +0 -3
- package/dist/src/types.js.map +0 -1
|
@@ -1,134 +1,82 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.injectRuleLoader = injectRuleLoader;
|
|
4
|
-
exports.hasLoader = hasLoader;
|
|
5
|
-
exports.findLoaderForResource = findLoaderForResource;
|
|
1
|
+
|
|
2
|
+
//#region src/loaders/helpers.ts
|
|
6
3
|
function injectRuleLoader(rule, loader = {}) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
4
|
+
if (rule !== "...") {
|
|
5
|
+
const _rule = rule;
|
|
6
|
+
if (_rule.loader) {
|
|
7
|
+
_rule.use = [loader, {
|
|
8
|
+
loader: _rule.loader,
|
|
9
|
+
options: _rule.options
|
|
10
|
+
}];
|
|
11
|
+
delete _rule.loader;
|
|
12
|
+
delete _rule.options;
|
|
13
|
+
} else if (_rule.use) _rule.use = [loader, ..._rule.use];
|
|
14
|
+
}
|
|
18
15
|
}
|
|
19
16
|
/**
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
* This function checks if the current module rule has a loader with the provided name.
|
|
18
|
+
*
|
|
19
|
+
* @param {RuleSetRule} rule - The current module rule.
|
|
20
|
+
* @param {string} loaderName - The name of the loader to check.
|
|
21
|
+
* @returns {boolean} Returns true if the current module rule has a loader with the provided name, otherwise false.
|
|
22
|
+
*/
|
|
26
23
|
function hasLoader(rule, loaderName) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
(loader.loader === loaderName ||
|
|
40
|
-
loader.loader.includes(`/${loaderName}/`))) {
|
|
41
|
-
return true;
|
|
42
|
-
}
|
|
43
|
-
else if (typeof loader === 'string') {
|
|
44
|
-
if (loader === loaderName || loader.includes(`/${loaderName}/`)) {
|
|
45
|
-
return true;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
return false;
|
|
24
|
+
if (rule !== "...") {
|
|
25
|
+
const _rule = rule;
|
|
26
|
+
if (_rule.loader === loaderName) return true;
|
|
27
|
+
else if (_rule.use && Array.isArray(_rule.use)) for (let i = 0; i < _rule.use.length; i++) {
|
|
28
|
+
const loader = _rule.use[i];
|
|
29
|
+
if (typeof loader !== "string" && typeof loader !== "function" && loader.loader && (loader.loader === loaderName || loader.loader.includes(`/${loaderName}/`))) return true;
|
|
30
|
+
else if (typeof loader === "string") {
|
|
31
|
+
if (loader === loaderName || loader.includes(`/${loaderName}/`)) return true;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return false;
|
|
52
36
|
}
|
|
53
37
|
function matchesCondition(condition, resource, currentPath) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
if ('exclude' in condition && condition.exclude) {
|
|
81
|
-
const excludes = Array.isArray(condition.exclude)
|
|
82
|
-
? condition.exclude
|
|
83
|
-
: [condition.exclude];
|
|
84
|
-
if (excludes.some((exclude) => matchesCondition(exclude, resource, currentPath))) {
|
|
85
|
-
return false;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
if ('and' in condition && condition.and) {
|
|
89
|
-
return condition.and.every((cond) => matchesCondition(cond, resource, currentPath));
|
|
90
|
-
}
|
|
91
|
-
if ('or' in condition && condition.or) {
|
|
92
|
-
return condition.or.some((cond) => matchesCondition(cond, resource, currentPath));
|
|
93
|
-
}
|
|
94
|
-
if ('not' in condition && condition.not) {
|
|
95
|
-
return !matchesCondition(condition.not, resource, currentPath);
|
|
96
|
-
}
|
|
97
|
-
if ('layer' in condition && condition.layer) {
|
|
98
|
-
if (!resource.layer ||
|
|
99
|
-
!matchesCondition(condition.layer, { path: resource.layer }, currentPath)) {
|
|
100
|
-
return false;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
if ('issuerLayer' in condition && condition.issuerLayer) {
|
|
104
|
-
if (!resource.issuerLayer ||
|
|
105
|
-
!matchesCondition(condition.issuerLayer, { path: resource.issuerLayer }, currentPath)) {
|
|
106
|
-
return false;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
return true;
|
|
38
|
+
if (condition instanceof RegExp) return condition.test(resource.path);
|
|
39
|
+
else if (typeof condition === "string") return resource.path.includes(condition);
|
|
40
|
+
else if (typeof condition === "function") return condition(resource.path);
|
|
41
|
+
else if (typeof condition === "object") {
|
|
42
|
+
if ("test" in condition && condition.test) {
|
|
43
|
+
if (!(Array.isArray(condition.test) ? condition.test : [condition.test]).some((test) => matchesCondition(test, resource, currentPath))) return false;
|
|
44
|
+
}
|
|
45
|
+
if ("include" in condition && condition.include) {
|
|
46
|
+
if (!(Array.isArray(condition.include) ? condition.include : [condition.include]).some((include) => matchesCondition(include, resource, currentPath))) return false;
|
|
47
|
+
}
|
|
48
|
+
if ("exclude" in condition && condition.exclude) {
|
|
49
|
+
if ((Array.isArray(condition.exclude) ? condition.exclude : [condition.exclude]).some((exclude) => matchesCondition(exclude, resource, currentPath))) return false;
|
|
50
|
+
}
|
|
51
|
+
if ("and" in condition && condition.and) return condition.and.every((cond) => matchesCondition(cond, resource, currentPath));
|
|
52
|
+
if ("or" in condition && condition.or) return condition.or.some((cond) => matchesCondition(cond, resource, currentPath));
|
|
53
|
+
if ("not" in condition && condition.not) return !matchesCondition(condition.not, resource, currentPath);
|
|
54
|
+
if ("layer" in condition && condition.layer) {
|
|
55
|
+
if (!resource.layer || !matchesCondition(condition.layer, { path: resource.layer }, currentPath)) return false;
|
|
56
|
+
}
|
|
57
|
+
if ("issuerLayer" in condition && condition.issuerLayer) {
|
|
58
|
+
if (!resource.issuerLayer || !matchesCondition(condition.issuerLayer, { path: resource.issuerLayer }, currentPath)) return false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return true;
|
|
111
62
|
}
|
|
112
63
|
function findLoaderForResource(rules, resource, path = []) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
else if (rule &&
|
|
128
|
-
matchesCondition(rule, resource, currentPath.join(' -> '))) {
|
|
129
|
-
lastMatchedRule = rule;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
return lastMatchedRule;
|
|
64
|
+
let lastMatchedRule = null;
|
|
65
|
+
for (let i = 0; i < rules.length; i++) {
|
|
66
|
+
const rule = rules[i];
|
|
67
|
+
const currentPath = [...path, `rules[${i}]`];
|
|
68
|
+
if (rule.oneOf) for (let j = 0; j < rule.oneOf.length; j++) {
|
|
69
|
+
const subRule = rule.oneOf[j];
|
|
70
|
+
const subPath = [...currentPath, `oneOf[${j}]`];
|
|
71
|
+
if (subRule && matchesCondition(subRule, resource, subPath.join("->"))) return subRule;
|
|
72
|
+
}
|
|
73
|
+
else if (rule && matchesCondition(rule, resource, currentPath.join(" -> "))) lastMatchedRule = rule;
|
|
74
|
+
}
|
|
75
|
+
return lastMatchedRule;
|
|
133
76
|
}
|
|
77
|
+
|
|
78
|
+
//#endregion
|
|
79
|
+
exports.findLoaderForResource = findLoaderForResource;
|
|
80
|
+
exports.hasLoader = hasLoader;
|
|
81
|
+
exports.injectRuleLoader = injectRuleLoader;
|
|
134
82
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","
|
|
1
|
+
{"version":3,"file":"helpers.js","names":[],"sources":["../../../src/loaders/helpers.ts"],"sourcesContent":["import type {\n RuleSetRule,\n RuleSetCondition,\n RuleSetConditionAbsolute,\n RuleSetUseItem,\n} from 'webpack';\n\nexport function injectRuleLoader(rule: any, loader: RuleSetUseItem = {}) {\n if (rule !== '...') {\n const _rule = rule as {\n loader?: string;\n use?: (RuleSetUseItem | string)[];\n options?: any;\n };\n if (_rule.loader) {\n _rule.use = [loader, { loader: _rule.loader, options: _rule.options }];\n delete _rule.loader;\n delete _rule.options;\n } else if (_rule.use) {\n _rule.use = [loader, ...(_rule.use as any[])];\n }\n }\n}\n\n/**\n * This function checks if the current module rule has a loader with the provided name.\n *\n * @param {RuleSetRule} rule - The current module rule.\n * @param {string} loaderName - The name of the loader to check.\n * @returns {boolean} Returns true if the current module rule has a loader with the provided name, otherwise false.\n */\nexport function hasLoader(rule: RuleSetRule, loaderName: string) {\n //@ts-ignore\n if (rule !== '...') {\n const _rule = rule as {\n loader?: string;\n use?: (RuleSetUseItem | string)[];\n options?: any;\n };\n if (_rule.loader === loaderName) {\n return true;\n } else if (_rule.use && Array.isArray(_rule.use)) {\n for (let i = 0; i < _rule.use.length; i++) {\n const loader = _rule.use[i];\n if (\n typeof loader !== 'string' &&\n typeof loader !== 'function' &&\n loader.loader &&\n (loader.loader === loaderName ||\n loader.loader.includes(`/${loaderName}/`))\n ) {\n return true;\n } else if (typeof loader === 'string') {\n if (loader === loaderName || loader.includes(`/${loaderName}/`)) {\n return true;\n }\n }\n }\n }\n }\n return false;\n}\n\ninterface Resource {\n path: string;\n layer?: string;\n issuerLayer?: string;\n}\n\nfunction matchesCondition(\n condition:\n | RuleSetCondition\n | RuleSetConditionAbsolute\n | RuleSetRule\n | undefined,\n resource: Resource,\n currentPath: string,\n): boolean {\n if (condition instanceof RegExp) {\n return condition.test(resource.path);\n } else if (typeof condition === 'string') {\n return resource.path.includes(condition);\n } else if (typeof condition === 'function') {\n return condition(resource.path);\n } else if (typeof condition === 'object') {\n if ('test' in condition && condition.test) {\n const tests = Array.isArray(condition.test)\n ? condition.test\n : [condition.test];\n if (\n !tests.some((test: RuleSetCondition) =>\n matchesCondition(test, resource, currentPath),\n )\n ) {\n return false;\n }\n }\n if ('include' in condition && condition.include) {\n const includes = Array.isArray(condition.include)\n ? condition.include\n : [condition.include];\n if (\n !includes.some((include: RuleSetCondition) =>\n matchesCondition(include, resource, currentPath),\n )\n ) {\n return false;\n }\n }\n if ('exclude' in condition && condition.exclude) {\n const excludes = Array.isArray(condition.exclude)\n ? condition.exclude\n : [condition.exclude];\n if (\n excludes.some((exclude: RuleSetCondition) =>\n matchesCondition(exclude, resource, currentPath),\n )\n ) {\n return false;\n }\n }\n if ('and' in condition && condition.and) {\n return condition.and.every((cond: RuleSetCondition) =>\n matchesCondition(cond, resource, currentPath),\n );\n }\n if ('or' in condition && condition.or) {\n return condition.or.some((cond: RuleSetCondition) =>\n matchesCondition(cond, resource, currentPath),\n );\n }\n if ('not' in condition && condition.not) {\n return !matchesCondition(condition.not, resource, currentPath);\n }\n if ('layer' in condition && condition.layer) {\n if (\n !resource.layer ||\n !matchesCondition(\n condition.layer,\n { path: resource.layer },\n currentPath,\n )\n ) {\n return false;\n }\n }\n if ('issuerLayer' in condition && condition.issuerLayer) {\n if (\n !resource.issuerLayer ||\n !matchesCondition(\n condition.issuerLayer,\n { path: resource.issuerLayer },\n currentPath,\n )\n ) {\n return false;\n }\n }\n }\n return true;\n}\n\nexport function findLoaderForResource(\n rules: RuleSetRule[],\n resource: Resource,\n path: string[] = [],\n): RuleSetRule | null {\n let lastMatchedRule: RuleSetRule | null = null;\n for (let i = 0; i < rules.length; i++) {\n const rule = rules[i];\n const currentPath = [...path, `rules[${i}]`];\n if (rule.oneOf) {\n for (let j = 0; j < rule.oneOf.length; j++) {\n const subRule = rule.oneOf[j];\n const subPath = [...currentPath, `oneOf[${j}]`];\n\n if (\n subRule &&\n matchesCondition(subRule, resource, subPath.join('->'))\n ) {\n return subRule;\n }\n }\n } else if (\n rule &&\n matchesCondition(rule, resource, currentPath.join(' -> '))\n ) {\n lastMatchedRule = rule;\n }\n }\n return lastMatchedRule;\n}\n"],"mappings":";;AAOA,SAAgB,iBAAiB,MAAW,SAAyB,EAAE,EAAE;AACvE,KAAI,SAAS,OAAO;EAClB,MAAM,QAAQ;AAKd,MAAI,MAAM,QAAQ;AAChB,SAAM,MAAM,CAAC,QAAQ;IAAE,QAAQ,MAAM;IAAQ,SAAS,MAAM;IAAS,CAAC;AACtE,UAAO,MAAM;AACb,UAAO,MAAM;aACJ,MAAM,IACf,OAAM,MAAM,CAAC,QAAQ,GAAI,MAAM,IAAc;;;;;;;;;;AAYnD,SAAgB,UAAU,MAAmB,YAAoB;AAE/D,KAAI,SAAS,OAAO;EAClB,MAAM,QAAQ;AAKd,MAAI,MAAM,WAAW,WACnB,QAAO;WACE,MAAM,OAAO,MAAM,QAAQ,MAAM,IAAI,CAC9C,MAAK,IAAI,IAAI,GAAG,IAAI,MAAM,IAAI,QAAQ,KAAK;GACzC,MAAM,SAAS,MAAM,IAAI;AACzB,OACE,OAAO,WAAW,YAClB,OAAO,WAAW,cAClB,OAAO,WACN,O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AAS,SACV,CAAC,iBACC,UAAU,OACV,EAAE,MAAM,SAAS,OAAO,EACxB,YACD,CAED,QAAO;;AAGX,MAAI,iBAAiB,aAAa,UAAU,aAC1C;OACE,CAAC,SAAS,eACV,CAAC,iBACC,UAAU,aACV,EAAE,MAAM,SAAS,aAAa,EAC9B,YACD,CAED,QAAO;;;AAIb,QAAO;;AAGT,SAAgB,sBACd,OACA,UACA,OAAiB,EAAE,EACC;CACpB,IAAI,kBAAsC;AAC1C,MAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;EACrC,MAAM,OAAO,MAAM;EACnB,MAAM,cAAc,CAAC,GAAG,MAAM,SAAS,EAAE,GAAG;AAC5C,MAAI,KAAK,MACP,MAAK,IAAI,IAAI,GAAG,IAAI,KAAK,MAAM,QAAQ,KAAK;GAC1C,MAAM,UAAU,KAAK,MAAM;GAC3B,MAAM,UAAU,CAAC,GAAG,aAAa,SAAS,EAAE,GAAG;AAE/C,OACE,WACA,iBAAiB,SAAS,UAAU,QAAQ,KAAK,KAAK,CAAC,CAEvD,QAAO;;WAIX,QACA,iBAAiB,MAAM,UAAU,YAAY,KAAK,OAAO,CAAC,CAE1D,mBAAkB;;AAGtB,QAAO"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
//#region src/loaders/helpers.ts
|
|
2
|
+
function injectRuleLoader(rule, loader = {}) {
|
|
3
|
+
if (rule !== "...") {
|
|
4
|
+
const _rule = rule;
|
|
5
|
+
if (_rule.loader) {
|
|
6
|
+
_rule.use = [loader, {
|
|
7
|
+
loader: _rule.loader,
|
|
8
|
+
options: _rule.options
|
|
9
|
+
}];
|
|
10
|
+
delete _rule.loader;
|
|
11
|
+
delete _rule.options;
|
|
12
|
+
} else if (_rule.use) _rule.use = [loader, ..._rule.use];
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* This function checks if the current module rule has a loader with the provided name.
|
|
17
|
+
*
|
|
18
|
+
* @param {RuleSetRule} rule - The current module rule.
|
|
19
|
+
* @param {string} loaderName - The name of the loader to check.
|
|
20
|
+
* @returns {boolean} Returns true if the current module rule has a loader with the provided name, otherwise false.
|
|
21
|
+
*/
|
|
22
|
+
function hasLoader(rule, loaderName) {
|
|
23
|
+
if (rule !== "...") {
|
|
24
|
+
const _rule = rule;
|
|
25
|
+
if (_rule.loader === loaderName) return true;
|
|
26
|
+
else if (_rule.use && Array.isArray(_rule.use)) for (let i = 0; i < _rule.use.length; i++) {
|
|
27
|
+
const loader = _rule.use[i];
|
|
28
|
+
if (typeof loader !== "string" && typeof loader !== "function" && loader.loader && (loader.loader === loaderName || loader.loader.includes(`/${loaderName}/`))) return true;
|
|
29
|
+
else if (typeof loader === "string") {
|
|
30
|
+
if (loader === loaderName || loader.includes(`/${loaderName}/`)) return true;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
function matchesCondition(condition, resource, currentPath) {
|
|
37
|
+
if (condition instanceof RegExp) return condition.test(resource.path);
|
|
38
|
+
else if (typeof condition === "string") return resource.path.includes(condition);
|
|
39
|
+
else if (typeof condition === "function") return condition(resource.path);
|
|
40
|
+
else if (typeof condition === "object") {
|
|
41
|
+
if ("test" in condition && condition.test) {
|
|
42
|
+
if (!(Array.isArray(condition.test) ? condition.test : [condition.test]).some((test) => matchesCondition(test, resource, currentPath))) return false;
|
|
43
|
+
}
|
|
44
|
+
if ("include" in condition && condition.include) {
|
|
45
|
+
if (!(Array.isArray(condition.include) ? condition.include : [condition.include]).some((include) => matchesCondition(include, resource, currentPath))) return false;
|
|
46
|
+
}
|
|
47
|
+
if ("exclude" in condition && condition.exclude) {
|
|
48
|
+
if ((Array.isArray(condition.exclude) ? condition.exclude : [condition.exclude]).some((exclude) => matchesCondition(exclude, resource, currentPath))) return false;
|
|
49
|
+
}
|
|
50
|
+
if ("and" in condition && condition.and) return condition.and.every((cond) => matchesCondition(cond, resource, currentPath));
|
|
51
|
+
if ("or" in condition && condition.or) return condition.or.some((cond) => matchesCondition(cond, resource, currentPath));
|
|
52
|
+
if ("not" in condition && condition.not) return !matchesCondition(condition.not, resource, currentPath);
|
|
53
|
+
if ("layer" in condition && condition.layer) {
|
|
54
|
+
if (!resource.layer || !matchesCondition(condition.layer, { path: resource.layer }, currentPath)) return false;
|
|
55
|
+
}
|
|
56
|
+
if ("issuerLayer" in condition && condition.issuerLayer) {
|
|
57
|
+
if (!resource.issuerLayer || !matchesCondition(condition.issuerLayer, { path: resource.issuerLayer }, currentPath)) return false;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
function findLoaderForResource(rules, resource, path = []) {
|
|
63
|
+
let lastMatchedRule = null;
|
|
64
|
+
for (let i = 0; i < rules.length; i++) {
|
|
65
|
+
const rule = rules[i];
|
|
66
|
+
const currentPath = [...path, `rules[${i}]`];
|
|
67
|
+
if (rule.oneOf) for (let j = 0; j < rule.oneOf.length; j++) {
|
|
68
|
+
const subRule = rule.oneOf[j];
|
|
69
|
+
const subPath = [...currentPath, `oneOf[${j}]`];
|
|
70
|
+
if (subRule && matchesCondition(subRule, resource, subPath.join("->"))) return subRule;
|
|
71
|
+
}
|
|
72
|
+
else if (rule && matchesCondition(rule, resource, currentPath.join(" -> "))) lastMatchedRule = rule;
|
|
73
|
+
}
|
|
74
|
+
return lastMatchedRule;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
//#endregion
|
|
78
|
+
export { findLoaderForResource, hasLoader, injectRuleLoader };
|
|
79
|
+
//# sourceMappingURL=helpers.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.mjs","names":[],"sources":["../../../src/loaders/helpers.ts"],"sourcesContent":["import type {\n RuleSetRule,\n RuleSetCondition,\n RuleSetConditionAbsolute,\n RuleSetUseItem,\n} from 'webpack';\n\nexport function injectRuleLoader(rule: any, loader: RuleSetUseItem = {}) {\n if (rule !== '...') {\n const _rule = rule as {\n loader?: string;\n use?: (RuleSetUseItem | string)[];\n options?: any;\n };\n if (_rule.loader) {\n _rule.use = [loader, { loader: _rule.loader, options: _rule.options }];\n delete _rule.loader;\n delete _rule.options;\n } else if (_rule.use) {\n _rule.use = [loader, ...(_rule.use as any[])];\n }\n }\n}\n\n/**\n * This function checks if the current module rule has a loader with the provided name.\n *\n * @param {RuleSetRule} rule - The current module rule.\n * @param {string} loaderName - The name of the loader to check.\n * @returns {boolean} Returns true if the current module rule has a loader with the provided name, otherwise false.\n */\nexport function hasLoader(rule: RuleSetRule, loaderName: string) {\n //@ts-ignore\n if (rule !== '...') {\n const _rule = rule as {\n loader?: string;\n use?: (RuleSetUseItem | string)[];\n options?: any;\n };\n if (_rule.loader === loaderName) {\n return true;\n } else if (_rule.use && Array.isArray(_rule.use)) {\n for (let i = 0; i < _rule.use.length; i++) {\n const loader = _rule.use[i];\n if (\n typeof loader !== 'string' &&\n typeof loader !== 'function' &&\n loader.loader &&\n (loader.loader === loaderName ||\n loader.loader.includes(`/${loaderName}/`))\n ) {\n return true;\n } else if (typeof loader === 'string') {\n if (loader === loaderName || loader.includes(`/${loaderName}/`)) {\n return true;\n }\n }\n }\n }\n }\n return false;\n}\n\ninterface Resource {\n path: string;\n layer?: string;\n issuerLayer?: string;\n}\n\nfunction matchesCondition(\n condition:\n | RuleSetCondition\n | RuleSetConditionAbsolute\n | RuleSetRule\n | undefined,\n resource: Resource,\n currentPath: string,\n): boolean {\n if (condition instanceof RegExp) {\n return condition.test(resource.path);\n } else if (typeof condition === 'string') {\n return resource.path.includes(condition);\n } else if (typeof condition === 'function') {\n return condition(resource.path);\n } else if (typeof condition === 'object') {\n if ('test' in condition && condition.test) {\n const tests = Array.isArray(condition.test)\n ? condition.test\n : [condition.test];\n if (\n !tests.some((test: RuleSetCondition) =>\n matchesCondition(test, resource, currentPath),\n )\n ) {\n return false;\n }\n }\n if ('include' in condition && condition.include) {\n const includes = Array.isArray(condition.include)\n ? condition.include\n : [condition.include];\n if (\n !includes.some((include: RuleSetCondition) =>\n matchesCondition(include, resource, currentPath),\n )\n ) {\n return false;\n }\n }\n if ('exclude' in condition && condition.exclude) {\n const excludes = Array.isArray(condition.exclude)\n ? condition.exclude\n : [condition.exclude];\n if (\n excludes.some((exclude: RuleSetCondition) =>\n matchesCondition(exclude, resource, currentPath),\n )\n ) {\n return false;\n }\n }\n if ('and' in condition && condition.and) {\n return condition.and.every((cond: RuleSetCondition) =>\n matchesCondition(cond, resource, currentPath),\n );\n }\n if ('or' in condition && condition.or) {\n return condition.or.some((cond: RuleSetCondition) =>\n matchesCondition(cond, resource, currentPath),\n );\n }\n if ('not' in condition && condition.not) {\n return !matchesCondition(condition.not, resource, currentPath);\n }\n if ('layer' in condition && condition.layer) {\n if (\n !resource.layer ||\n !matchesCondition(\n condition.layer,\n { path: resource.layer },\n currentPath,\n )\n ) {\n return false;\n }\n }\n if ('issuerLayer' in condition && condition.issuerLayer) {\n if (\n !resource.issuerLayer ||\n !matchesCondition(\n condition.issuerLayer,\n { path: resource.issuerLayer },\n currentPath,\n )\n ) {\n return false;\n }\n }\n }\n return true;\n}\n\nexport function findLoaderForResource(\n rules: RuleSetRule[],\n resource: Resource,\n path: string[] = [],\n): RuleSetRule | null {\n let lastMatchedRule: RuleSetRule | null = null;\n for (let i = 0; i < rules.length; i++) {\n const rule = rules[i];\n const currentPath = [...path, `rules[${i}]`];\n if (rule.oneOf) {\n for (let j = 0; j < rule.oneOf.length; j++) {\n const subRule = rule.oneOf[j];\n const subPath = [...currentPath, `oneOf[${j}]`];\n\n if (\n subRule &&\n matchesCondition(subRule, resource, subPath.join('->'))\n ) {\n return subRule;\n }\n }\n } else if (\n rule &&\n matchesCondition(rule, resource, currentPath.join(' -> '))\n ) {\n lastMatchedRule = rule;\n }\n }\n return lastMatchedRule;\n}\n"],"mappings":";AAOA,SAAgB,iBAAiB,MAAW,SAAyB,EAAE,EAAE;AACvE,KAAI,SAAS,OAAO;EAClB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,UAAU,YAAY,KAAK,OAAO,CAAC,CAE1D,mBAAkB;;AAGtB,QAAO"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { LoaderContext } from "webpack";
|
|
2
|
+
|
|
3
|
+
//#region src/loaders/nextPageMapLoader.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Webpack loader which prepares MF map for NextJS pages.
|
|
6
|
+
* This function is the main entry point for the loader.
|
|
7
|
+
* It gets the options passed to the loader and prepares the pages map.
|
|
8
|
+
* If the 'v2' option is passed, it prepares the pages map using the 'preparePageMapV2' function.
|
|
9
|
+
* Otherwise, it uses the 'preparePageMap' function.
|
|
10
|
+
* Finally, it calls the loader's callback function with the prepared pages map.
|
|
11
|
+
*
|
|
12
|
+
* @param {LoaderContext<Record<string, unknown>>} this - The loader context.
|
|
13
|
+
*/
|
|
14
|
+
declare function nextPageMapLoader(this: LoaderContext<Record<string, unknown>>): void;
|
|
15
|
+
/**
|
|
16
|
+
* Webpack config generator for `exposes` option.
|
|
17
|
+
* This function generates the webpack config for the 'exposes' option.
|
|
18
|
+
* It creates a map of pages to modules and returns an object with the pages map and the pages map v2.
|
|
19
|
+
*
|
|
20
|
+
* @param {string} cwd - The current working directory.
|
|
21
|
+
* @returns {Record<string, string>} The webpack config for the 'exposes' option.
|
|
22
|
+
*/
|
|
23
|
+
declare function exposeNextjsPages(cwd: string): {
|
|
24
|
+
'./pages-map': string;
|
|
25
|
+
'./pages-map-v2': string;
|
|
26
|
+
};
|
|
27
|
+
//#endregion
|
|
28
|
+
export { nextPageMapLoader as default, exposeNextjsPages };
|
|
29
|
+
//# sourceMappingURL=nextPageMapLoader.d.mts.map
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { LoaderContext } from "webpack";
|
|
2
|
+
|
|
3
|
+
//#region src/loaders/nextPageMapLoader.d.ts
|
|
2
4
|
/**
|
|
3
5
|
* Webpack loader which prepares MF map for NextJS pages.
|
|
4
6
|
* This function is the main entry point for the loader.
|
|
@@ -9,7 +11,7 @@ import type { LoaderContext } from 'webpack';
|
|
|
9
11
|
*
|
|
10
12
|
* @param {LoaderContext<Record<string, unknown>>} this - The loader context.
|
|
11
13
|
*/
|
|
12
|
-
|
|
14
|
+
declare function nextPageMapLoader(this: LoaderContext<Record<string, unknown>>): void;
|
|
13
15
|
/**
|
|
14
16
|
* Webpack config generator for `exposes` option.
|
|
15
17
|
* This function generates the webpack config for the 'exposes' option.
|
|
@@ -18,7 +20,10 @@ export default function nextPageMapLoader(this: LoaderContext<Record<string, unk
|
|
|
18
20
|
* @param {string} cwd - The current working directory.
|
|
19
21
|
* @returns {Record<string, string>} The webpack config for the 'exposes' option.
|
|
20
22
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
declare function exposeNextjsPages(cwd: string): {
|
|
24
|
+
'./pages-map': string;
|
|
25
|
+
'./pages-map-v2': string;
|
|
24
26
|
};
|
|
27
|
+
//#endregion
|
|
28
|
+
export { nextPageMapLoader as default, exposeNextjsPages };
|
|
29
|
+
//# sourceMappingURL=nextPageMapLoader.d.ts.map
|