@umijs/mfsu 4.0.6 → 4.0.9

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.
Files changed (40) hide show
  1. package/compiled/is-absolute-url/LICENSE +9 -0
  2. package/compiled/is-absolute-url/index.d.ts +22 -0
  3. package/compiled/is-absolute-url/index.js +1 -0
  4. package/compiled/is-absolute-url/package.json +1 -0
  5. package/dist/babelPlugins/awaitImport/MFImport.js +59 -66
  6. package/dist/babelPlugins/awaitImport/awaitImport.d.ts +1 -1
  7. package/dist/babelPlugins/awaitImport/awaitImport.js +103 -117
  8. package/dist/babelPlugins/awaitImport/checkMatch.js +131 -119
  9. package/dist/babelPlugins/awaitImport/getAliasedPath.js +54 -35
  10. package/dist/babelPlugins/awaitImport/getRealPath.js +42 -21
  11. package/dist/babelPlugins/awaitImport/isExternals.js +55 -26
  12. package/dist/babelPlugins/awaitImport/parseSpecifiers.js +51 -52
  13. package/dist/constants.js +47 -10
  14. package/dist/dep/dep.js +112 -83
  15. package/dist/dep/getCJSExports.js +60 -53
  16. package/dist/dep/getExposeFromContent.js +71 -59
  17. package/dist/dep/getModuleExports.js +58 -32
  18. package/dist/depBuilder/depBuilder.js +184 -158
  19. package/dist/depBuilder/getESBuildEntry.js +35 -12
  20. package/dist/depInfo.js +75 -53
  21. package/dist/esbuildHandlers/autoCssModules.js +43 -22
  22. package/dist/esbuildHandlers/awaitImport/index.js +82 -70
  23. package/dist/index.js +32 -22
  24. package/dist/loader/esbuild.js +87 -35
  25. package/dist/mfsu/mfsu.d.ts +1 -1
  26. package/dist/mfsu/mfsu.js +231 -257
  27. package/dist/mfsu/strategyCompileTime.js +123 -99
  28. package/dist/mfsu/strategyStaticAnalyze.js +135 -117
  29. package/dist/moduleGraph.js +227 -186
  30. package/dist/staticDepInfo/importParser.js +28 -6
  31. package/dist/staticDepInfo/simulations/babel-plugin-import.js +99 -91
  32. package/dist/staticDepInfo/staticDepInfo.js +230 -197
  33. package/dist/types.js +33 -8
  34. package/dist/utils/makeArray.js +29 -5
  35. package/dist/utils/trimFileContent.js +29 -5
  36. package/dist/webpackPlugins/buildDepPlugin.js +49 -25
  37. package/dist/webpackPlugins/depChunkIdPrefixPlugin.js +44 -19
  38. package/dist/webpackPlugins/stripSourceMapUrlPlugin.js +46 -27
  39. package/dist/webpackPlugins/writeCachePlugin.js +39 -15
  40. package/package.json +8 -6
@@ -1,206 +1,239 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.StaticDepInfo = void 0;
7
- const utils_1 = require("@umijs/utils");
8
- const fs_1 = require("fs");
9
- // @ts-ignore
10
- const why_1 = __importDefault(require("is-equal/why"));
11
- const path_1 = require("path");
12
- const checkMatch_1 = require("../babelPlugins/awaitImport/checkMatch");
13
- const dep_1 = require("../dep/dep");
14
- const babel_plugin_import_1 = __importDefault(require("./simulations/babel-plugin-import"));
15
- class StaticDepInfo {
16
- constructor(opts) {
17
- this.currentDep = {};
18
- this.builtWithDep = {};
19
- this.produced = [];
20
- this.mfsu = opts.mfsu;
21
- this.include = this.mfsu.opts.include || [];
22
- this.opts = opts;
23
- this.cacheFilePath = (0, path_1.join)(this.opts.mfsu.opts.tmpBase, 'MFSU_CACHE_v4.json');
24
- this.cwd = this.mfsu.opts.cwd;
25
- opts.srcCodeCache.register((info) => {
26
- this.produced.push({ changes: info.events });
27
- this.currentDep = this._getDependencies(info.code, info.imports);
28
- });
29
- this.runtimeSimulations = [
30
- {
31
- packageName: 'antd',
32
- handleImports: (0, babel_plugin_import_1.default)({
33
- libraryName: 'antd',
34
- style: true,
35
- libraryDirectory: 'es',
36
- }),
37
- },
38
- {
39
- packageName: '@alipay/bigfish/antd',
40
- handleImports: (0, babel_plugin_import_1.default)({
41
- libraryName: '@alipay/bigfish/antd',
42
- style: true,
43
- libraryDirectory: 'es',
44
- }),
45
- },
46
- ];
47
- }
48
- getProducedEvent() {
49
- return this.produced;
50
- }
51
- consumeAllProducedEvents() {
52
- this.produced = [];
53
- }
54
- shouldBuild() {
55
- if (utils_1.lodash.isEqual(this.builtWithDep, this.currentDep)) {
56
- return false;
57
- }
58
- else {
59
- if (process.env.DEBUG_UMI) {
60
- const reason = (0, why_1.default)(this.builtWithDep, this.currentDep);
61
- utils_1.logger.info('[MFSU][eager]: isEqual(oldDep,newDep) === false, because ', reason);
62
- }
63
- return 'dependencies changed';
64
- }
65
- }
66
- getDepModules() {
67
- const map = this.getDependencies();
68
- const staticDeps = {};
69
- const keys = Object.keys(map);
70
- for (const k of keys) {
71
- staticDeps[k] = {
72
- file: k,
73
- version: map[k].version,
74
- };
75
- }
76
- return staticDeps;
77
- }
78
- snapshot() {
79
- this.builtWithDep = this.currentDep;
80
- }
81
- loadCache() {
82
- if ((0, fs_1.existsSync)(this.cacheFilePath)) {
83
- this.builtWithDep = JSON.parse((0, fs_1.readFileSync)(this.cacheFilePath, 'utf-8'));
84
- utils_1.logger.info('[MFSU][eager] restored cache');
85
- }
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
+ var __spreadValues = (a, b) => {
13
+ for (var prop in b || (b = {}))
14
+ if (__hasOwnProp.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ if (__getOwnPropSymbols)
17
+ for (var prop of __getOwnPropSymbols(b)) {
18
+ if (__propIsEnum.call(b, prop))
19
+ __defNormalProp(a, prop, b[prop]);
86
20
  }
87
- writeCache() {
88
- utils_1.fsExtra.mkdirpSync((0, path_1.dirname)(this.cacheFilePath));
89
- const newContent = JSON.stringify(this.builtWithDep, null, 2);
90
- if ((0, fs_1.existsSync)(this.cacheFilePath) &&
91
- (0, fs_1.readFileSync)(this.cacheFilePath, 'utf-8') === newContent) {
92
- return;
93
- }
94
- utils_1.logger.info('[MFSU][eager] write cache');
95
- (0, fs_1.writeFileSync)(this.cacheFilePath, newContent, 'utf-8');
96
- }
97
- getCacheFilePath() {
98
- return this.cacheFilePath;
21
+ return a;
22
+ };
23
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
+ var __export = (target, all) => {
25
+ for (var name in all)
26
+ __defProp(target, name, { get: all[name], enumerable: true });
27
+ };
28
+ var __copyProps = (to, from, except, desc) => {
29
+ if (from && typeof from === "object" || typeof from === "function") {
30
+ for (let key of __getOwnPropNames(from))
31
+ if (!__hasOwnProp.call(to, key) && key !== except)
32
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
33
+ }
34
+ return to;
35
+ };
36
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
37
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
38
+
39
+ // staticDepInfo.ts
40
+ var staticDepInfo_exports = {};
41
+ __export(staticDepInfo_exports, {
42
+ StaticDepInfo: () => StaticDepInfo
43
+ });
44
+ module.exports = __toCommonJS(staticDepInfo_exports);
45
+ var import_utils = require("@umijs/utils");
46
+ var import_fs = require("fs");
47
+ var import_why = __toESM(require("is-equal/why"));
48
+ var import_path = require("path");
49
+ var import_checkMatch = require("../babelPlugins/awaitImport/checkMatch");
50
+ var import_dep = require("../dep/dep");
51
+ var import_babel_plugin_import = __toESM(require("./simulations/babel-plugin-import"));
52
+ var StaticDepInfo = class {
53
+ constructor(opts) {
54
+ this.currentDep = {};
55
+ this.builtWithDep = {};
56
+ this.produced = [];
57
+ this.mfsu = opts.mfsu;
58
+ this.include = this.mfsu.opts.include || [];
59
+ this.opts = opts;
60
+ this.cacheFilePath = (0, import_path.join)(this.opts.mfsu.opts.tmpBase, "MFSU_CACHE_v4.json");
61
+ this.cwd = this.mfsu.opts.cwd;
62
+ opts.srcCodeCache.register((info) => {
63
+ this.produced.push({ changes: info.events });
64
+ this.currentDep = this._getDependencies(info.code, info.imports);
65
+ });
66
+ this.runtimeSimulations = [
67
+ {
68
+ packageName: "antd",
69
+ handleImports: (0, import_babel_plugin_import.default)({
70
+ libraryName: "antd",
71
+ style: true,
72
+ libraryDirectory: "es"
73
+ })
74
+ },
75
+ {
76
+ packageName: "@alipay/bigfish/antd",
77
+ handleImports: (0, import_babel_plugin_import.default)({
78
+ libraryName: "@alipay/bigfish/antd",
79
+ style: true,
80
+ libraryDirectory: "es"
81
+ })
82
+ }
83
+ ];
84
+ }
85
+ getProducedEvent() {
86
+ return this.produced;
87
+ }
88
+ consumeAllProducedEvents() {
89
+ this.produced = [];
90
+ }
91
+ shouldBuild() {
92
+ if (import_utils.lodash.isEqual(this.builtWithDep, this.currentDep)) {
93
+ return false;
94
+ } else {
95
+ if (process.env.DEBUG_UMI) {
96
+ const reason = (0, import_why.default)(this.builtWithDep, this.currentDep);
97
+ import_utils.logger.info("[MFSU][eager]: isEqual(oldDep,newDep) === false, because ", reason);
98
+ }
99
+ return "dependencies changed";
99
100
  }
100
- getDependencies() {
101
- return this.currentDep;
101
+ }
102
+ getDepModules() {
103
+ const map = this.getDependencies();
104
+ const staticDeps = {};
105
+ const keys = Object.keys(map);
106
+ for (const k of keys) {
107
+ staticDeps[k] = {
108
+ file: k,
109
+ version: map[k].version
110
+ };
102
111
  }
103
- init() {
104
- const merged = this.opts.srcCodeCache.getMergedCode();
105
- this.currentDep = this._getDependencies(merged.code, merged.imports);
112
+ return staticDeps;
113
+ }
114
+ snapshot() {
115
+ this.builtWithDep = this.currentDep;
116
+ }
117
+ loadCache() {
118
+ if ((0, import_fs.existsSync)(this.cacheFilePath)) {
119
+ this.builtWithDep = JSON.parse((0, import_fs.readFileSync)(this.cacheFilePath, "utf-8"));
120
+ import_utils.logger.info("[MFSU][eager] restored cache");
106
121
  }
107
- _getDependencies(bigCodeString, imports) {
108
- const start = Date.now();
109
- const cwd = this.mfsu.opts.cwd;
110
- const opts = {
111
- exportAllMembers: this.mfsu.opts.exportAllMembers,
112
- unMatchLibs: this.mfsu.opts.unMatchLibs,
113
- remoteName: this.mfsu.opts.mfName,
114
- alias: this.mfsu.alias,
115
- externals: this.mfsu.externals,
116
- };
117
- const matched = {};
118
- const unMatched = new Set();
119
- const pkgNames = this.runtimeSimulations.map(({ packageName }) => packageName);
120
- const groupedMockImports = {};
121
- for (const imp of imports) {
122
- if (pkgNames.indexOf(imp.n) >= 0) {
123
- const name = imp.n;
124
- if (groupedMockImports[name]) {
125
- groupedMockImports[name].push(imp);
126
- }
127
- else {
128
- groupedMockImports[name] = [imp];
129
- }
130
- continue;
131
- }
132
- if (unMatched.has(imp.n)) {
133
- continue;
134
- }
135
- if (matched[imp.n]) {
136
- continue;
137
- }
138
- const match = (0, checkMatch_1.checkMatch)({
139
- value: imp.n,
140
- depth: 1,
141
- filename: '_.js',
142
- opts,
143
- });
144
- if (match.isMatch) {
145
- matched[match.value] = {
146
- ...match,
147
- version: dep_1.Dep.getDepVersion({
148
- dep: match.value,
149
- cwd,
150
- }),
151
- };
152
- }
153
- else {
154
- unMatched.add(imp.n);
155
- }
156
- }
157
- this.simulateRuntimeTransform(matched, groupedMockImports, bigCodeString);
158
- this.appendIncludeList(matched, opts);
159
- utils_1.logger.debug('[MFSU][eager] _getDependencies costs', Date.now() - start);
160
- return matched;
122
+ }
123
+ writeCache() {
124
+ import_utils.fsExtra.mkdirpSync((0, import_path.dirname)(this.cacheFilePath));
125
+ const newContent = JSON.stringify(this.builtWithDep, null, 2);
126
+ if ((0, import_fs.existsSync)(this.cacheFilePath) && (0, import_fs.readFileSync)(this.cacheFilePath, "utf-8") === newContent) {
127
+ return;
161
128
  }
162
- simulateRuntimeTransform(matched, groupedImports, rawCode) {
163
- for (const mock of this.runtimeSimulations) {
164
- const name = mock.packageName;
165
- const pathToVersion = (dep) => {
166
- return dep_1.Dep.getDepVersion({
167
- dep,
168
- cwd: this.cwd,
169
- });
170
- };
171
- const ms = mock.handleImports({
172
- imports: groupedImports[name],
173
- rawCode,
174
- alias: this.mfsu.alias,
175
- mfName: this.mfsu.opts.mfName,
176
- pathToVersion,
177
- });
178
- for (const m of ms) {
179
- matched[m.value] = m;
180
- }
129
+ import_utils.logger.info("[MFSU][eager] write cache");
130
+ (0, import_fs.writeFileSync)(this.cacheFilePath, newContent, "utf-8");
131
+ }
132
+ getCacheFilePath() {
133
+ return this.cacheFilePath;
134
+ }
135
+ getDependencies() {
136
+ return this.currentDep;
137
+ }
138
+ init() {
139
+ const merged = this.opts.srcCodeCache.getMergedCode();
140
+ this.currentDep = this._getDependencies(merged.code, merged.imports);
141
+ }
142
+ _getDependencies(bigCodeString, imports) {
143
+ const start = Date.now();
144
+ const cwd = this.mfsu.opts.cwd;
145
+ const opts = {
146
+ exportAllMembers: this.mfsu.opts.exportAllMembers,
147
+ unMatchLibs: this.mfsu.opts.unMatchLibs,
148
+ remoteName: this.mfsu.opts.mfName,
149
+ alias: this.mfsu.alias,
150
+ externals: this.mfsu.externals
151
+ };
152
+ const matched = {};
153
+ const unMatched = /* @__PURE__ */ new Set();
154
+ const pkgNames = this.runtimeSimulations.map(({ packageName }) => packageName);
155
+ const groupedMockImports = {};
156
+ for (const imp of imports) {
157
+ if (pkgNames.indexOf(imp.n) >= 0) {
158
+ const name = imp.n;
159
+ if (groupedMockImports[name]) {
160
+ groupedMockImports[name].push(imp);
161
+ } else {
162
+ groupedMockImports[name] = [imp];
181
163
  }
164
+ continue;
165
+ }
166
+ if (unMatched.has(imp.n)) {
167
+ continue;
168
+ }
169
+ if (matched[imp.n]) {
170
+ continue;
171
+ }
172
+ const match = (0, import_checkMatch.checkMatch)({
173
+ value: imp.n,
174
+ depth: 1,
175
+ filename: "_.js",
176
+ opts
177
+ });
178
+ if (match.isMatch) {
179
+ matched[match.value] = __spreadProps(__spreadValues({}, match), {
180
+ version: import_dep.Dep.getDepVersion({
181
+ dep: match.value,
182
+ cwd
183
+ })
184
+ });
185
+ } else {
186
+ unMatched.add(imp.n);
187
+ }
182
188
  }
183
- appendIncludeList(matched, opts) {
184
- for (const p of this.include) {
185
- const match = (0, checkMatch_1.checkMatch)({
186
- value: p,
187
- depth: 1,
188
- filename: '_.js',
189
- opts,
190
- });
191
- if (match.isMatch) {
192
- matched[match.value] = {
193
- ...match,
194
- version: dep_1.Dep.getDepVersion({
195
- dep: match.value,
196
- cwd: this.cwd,
197
- }),
198
- };
199
- }
200
- }
189
+ this.simulateRuntimeTransform(matched, groupedMockImports, bigCodeString);
190
+ this.appendIncludeList(matched, opts);
191
+ import_utils.logger.debug("[MFSU][eager] _getDependencies costs", Date.now() - start);
192
+ return matched;
193
+ }
194
+ simulateRuntimeTransform(matched, groupedImports, rawCode) {
195
+ for (const mock of this.runtimeSimulations) {
196
+ const name = mock.packageName;
197
+ const pathToVersion = (dep) => {
198
+ return import_dep.Dep.getDepVersion({
199
+ dep,
200
+ cwd: this.cwd
201
+ });
202
+ };
203
+ const ms = mock.handleImports({
204
+ imports: groupedImports[name],
205
+ rawCode,
206
+ alias: this.mfsu.alias,
207
+ mfName: this.mfsu.opts.mfName,
208
+ pathToVersion
209
+ });
210
+ for (const m of ms) {
211
+ matched[m.value] = m;
212
+ }
201
213
  }
202
- async allRuntimeHelpers() {
203
- // todo mfsu4
214
+ }
215
+ appendIncludeList(matched, opts) {
216
+ for (const p of this.include) {
217
+ const match = (0, import_checkMatch.checkMatch)({
218
+ value: p,
219
+ depth: 1,
220
+ filename: "_.js",
221
+ opts
222
+ });
223
+ if (match.isMatch) {
224
+ matched[match.value] = __spreadProps(__spreadValues({}, match), {
225
+ version: import_dep.Dep.getDepVersion({
226
+ dep: match.value,
227
+ cwd: this.cwd
228
+ })
229
+ });
230
+ }
204
231
  }
205
- }
206
- exports.StaticDepInfo = StaticDepInfo;
232
+ }
233
+ async allRuntimeHelpers() {
234
+ }
235
+ };
236
+ // Annotate the CommonJS export names for ESM import in node:
237
+ 0 && (module.exports = {
238
+ StaticDepInfo
239
+ });
package/dist/types.js CHANGED
@@ -1,8 +1,33 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Mode = void 0;
4
- var Mode;
5
- (function (Mode) {
6
- Mode["development"] = "development";
7
- Mode["production"] = "production";
8
- })(Mode = exports.Mode || (exports.Mode = {}));
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // types.ts
20
+ var types_exports = {};
21
+ __export(types_exports, {
22
+ Mode: () => Mode
23
+ });
24
+ module.exports = __toCommonJS(types_exports);
25
+ var Mode = /* @__PURE__ */ ((Mode2) => {
26
+ Mode2["development"] = "development";
27
+ Mode2["production"] = "production";
28
+ return Mode2;
29
+ })(Mode || {});
30
+ // Annotate the CommonJS export names for ESM import in node:
31
+ 0 && (module.exports = {
32
+ Mode
33
+ });
@@ -1,7 +1,31 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeArray = void 0;
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // makeArray.ts
20
+ var makeArray_exports = {};
21
+ __export(makeArray_exports, {
22
+ makeArray: () => makeArray
23
+ });
24
+ module.exports = __toCommonJS(makeArray_exports);
4
25
  function makeArray(item) {
5
- return Array.isArray(item) ? item : [item];
26
+ return Array.isArray(item) ? item : [item];
6
27
  }
7
- exports.makeArray = makeArray;
28
+ // Annotate the CommonJS export names for ESM import in node:
29
+ 0 && (module.exports = {
30
+ makeArray
31
+ });
@@ -1,7 +1,31 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.trimFileContent = void 0;
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // trimFileContent.ts
20
+ var trimFileContent_exports = {};
21
+ __export(trimFileContent_exports, {
22
+ trimFileContent: () => trimFileContent
23
+ });
24
+ module.exports = __toCommonJS(trimFileContent_exports);
4
25
  function trimFileContent(content) {
5
- return content.trim() + '\n';
26
+ return content.trim() + "\n";
6
27
  }
7
- exports.trimFileContent = trimFileContent;
28
+ // Annotate the CommonJS export names for ESM import in node:
29
+ 0 && (module.exports = {
30
+ trimFileContent
31
+ });
@@ -1,25 +1,49 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BuildDepPlugin = void 0;
4
- const PLUGIN_NAME = 'MFSUBuildDeps';
5
- class BuildDepPlugin {
6
- constructor(opts) {
7
- this.opts = opts;
8
- }
9
- apply(compiler) {
10
- compiler.hooks.watchRun.tapPromise(PLUGIN_NAME, (c) => {
11
- var _a, _b;
12
- return ((_b = (_a = this.opts).onFileChange) === null || _b === void 0 ? void 0 : _b.call(_a, c)) || Promise.resolve();
13
- });
14
- compiler.hooks.beforeCompile.tap(PLUGIN_NAME, () => {
15
- var _a, _b;
16
- (_b = (_a = this.opts).beforeCompile) === null || _b === void 0 ? void 0 : _b.call(_a);
17
- });
18
- compiler.hooks.done.tap(PLUGIN_NAME, (stats) => {
19
- if (!stats.hasErrors()) {
20
- this.opts.onCompileDone();
21
- }
22
- });
23
- }
24
- }
25
- exports.BuildDepPlugin = BuildDepPlugin;
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // buildDepPlugin.ts
20
+ var buildDepPlugin_exports = {};
21
+ __export(buildDepPlugin_exports, {
22
+ BuildDepPlugin: () => BuildDepPlugin
23
+ });
24
+ module.exports = __toCommonJS(buildDepPlugin_exports);
25
+ var PLUGIN_NAME = "MFSUBuildDeps";
26
+ var BuildDepPlugin = class {
27
+ constructor(opts) {
28
+ this.opts = opts;
29
+ }
30
+ apply(compiler) {
31
+ compiler.hooks.watchRun.tapPromise(PLUGIN_NAME, (c) => {
32
+ var _a, _b;
33
+ return ((_b = (_a = this.opts).onFileChange) == null ? void 0 : _b.call(_a, c)) || Promise.resolve();
34
+ });
35
+ compiler.hooks.beforeCompile.tap(PLUGIN_NAME, () => {
36
+ var _a, _b;
37
+ (_b = (_a = this.opts).beforeCompile) == null ? void 0 : _b.call(_a);
38
+ });
39
+ compiler.hooks.done.tap(PLUGIN_NAME, (stats) => {
40
+ if (!stats.hasErrors()) {
41
+ this.opts.onCompileDone();
42
+ }
43
+ });
44
+ }
45
+ };
46
+ // Annotate the CommonJS export names for ESM import in node:
47
+ 0 && (module.exports = {
48
+ BuildDepPlugin
49
+ });