@modern-js/builder 0.0.0-nightly-20230926160605 → 0.0.0-nightly-20230928160554
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/plugins/define.d.ts +2 -0
- package/dist/plugins/define.js +66 -0
- package/dist/plugins/index.js +2 -1
- package/package.json +17 -9
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var define_exports = {};
|
|
30
|
+
__export(define_exports, {
|
|
31
|
+
builderPluginDefine: () => builderPluginDefine
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(define_exports);
|
|
34
|
+
var import_lodash = require("@modern-js/utils/lodash");
|
|
35
|
+
const builderPluginDefine = () => ({
|
|
36
|
+
name: "builder-plugin-define",
|
|
37
|
+
async setup(api) {
|
|
38
|
+
api.modifyBundlerChain(async (chain, { env, target, CHAIN_ID, bundler }) => {
|
|
39
|
+
const { getNodeEnv, removeTailSlash, applyOptionsChain } = await Promise.resolve().then(() => __toESM(require("@modern-js/utils")));
|
|
40
|
+
const config = api.getNormalizedConfig();
|
|
41
|
+
const publicPath = chain.output.get("publicPath");
|
|
42
|
+
const assetPrefix = publicPath && typeof publicPath === "string" ? publicPath : config.output.assetPrefix;
|
|
43
|
+
const builtinVars = {
|
|
44
|
+
"process.env.NODE_ENV": getNodeEnv(),
|
|
45
|
+
"process.env.ASSET_PREFIX": removeTailSlash(assetPrefix)
|
|
46
|
+
};
|
|
47
|
+
const globalVars = applyOptionsChain(builtinVars, config.source.globalVars, {
|
|
48
|
+
env,
|
|
49
|
+
target
|
|
50
|
+
});
|
|
51
|
+
var _JSON_stringify;
|
|
52
|
+
const serializedVars = (0, import_lodash.mapValues)(globalVars, (value) => (_JSON_stringify = JSON.stringify(value)) !== null && _JSON_stringify !== void 0 ? _JSON_stringify : "undefined");
|
|
53
|
+
const defineExprs = config.source.define;
|
|
54
|
+
chain.plugin(CHAIN_ID.PLUGIN.DEFINE).use(bundler.DefinePlugin, [
|
|
55
|
+
{
|
|
56
|
+
...serializedVars,
|
|
57
|
+
...defineExprs
|
|
58
|
+
}
|
|
59
|
+
]);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
64
|
+
0 && (module.exports = {
|
|
65
|
+
builderPluginDefine
|
|
66
|
+
});
|
package/dist/plugins/index.js
CHANGED
|
@@ -65,7 +65,8 @@ const plugins = {
|
|
|
65
65
|
})),
|
|
66
66
|
networkPerformance: () => Promise.resolve().then(() => __toESM(require("./networkPerformance"))).then((m) => m.builderPluginNetworkPerformance()),
|
|
67
67
|
preloadOrPrefetch: () => Promise.resolve().then(() => __toESM(require("./preloadOrPrefetch"))).then((m) => m.builderPluginPreloadOrPrefetch()),
|
|
68
|
-
performance: () => Promise.resolve().then(() => __toESM(require("./performance"))).then((m) => m.builderPluginPerformance())
|
|
68
|
+
performance: () => Promise.resolve().then(() => __toESM(require("./performance"))).then((m) => m.builderPluginPerformance()),
|
|
69
|
+
define: () => Promise.resolve().then(() => __toESM(require("./define"))).then((m) => m.builderPluginDefine())
|
|
69
70
|
};
|
|
70
71
|
// Annotate the CommonJS export names for ESM import in node:
|
|
71
72
|
0 && (module.exports = {
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"engines": {
|
|
19
19
|
"node": ">=14.0.0"
|
|
20
20
|
},
|
|
21
|
-
"version": "0.0.0-nightly-
|
|
21
|
+
"version": "0.0.0-nightly-20230928160554",
|
|
22
22
|
"jsnext:source": "./src/index.ts",
|
|
23
23
|
"types": "./dist/index.d.ts",
|
|
24
24
|
"main": "./dist/index.js",
|
|
@@ -33,31 +33,39 @@
|
|
|
33
33
|
"types": "./dist/cli/index.d.ts",
|
|
34
34
|
"jsnext:source": "./src/cli/index.ts",
|
|
35
35
|
"default": "./dist/cli/index.js"
|
|
36
|
+
},
|
|
37
|
+
"./plugins/*": {
|
|
38
|
+
"types": "./dist/plugins/*.d.ts",
|
|
39
|
+
"jsnext:source": "./src/plugins/*.ts",
|
|
40
|
+
"default": "./dist/plugins/*.js"
|
|
36
41
|
}
|
|
37
42
|
},
|
|
38
43
|
"typesVersions": {
|
|
39
44
|
"*": {
|
|
40
45
|
"cli": [
|
|
41
46
|
"./dist/cli/index.d.ts"
|
|
47
|
+
],
|
|
48
|
+
"plugins/*": [
|
|
49
|
+
"./dist/plugins/*.d.ts"
|
|
42
50
|
]
|
|
43
51
|
}
|
|
44
52
|
},
|
|
45
53
|
"dependencies": {
|
|
46
54
|
"@svgr/webpack": "8.0.1",
|
|
47
55
|
"@swc/helpers": "0.5.1",
|
|
48
|
-
"@modern-js/builder-shared": "0.0.0-nightly-
|
|
49
|
-
"@modern-js/monorepo-utils": "0.0.0-nightly-
|
|
50
|
-
"@modern-js/node-bundle-require": "0.0.0-nightly-
|
|
51
|
-
"@modern-js/utils": "0.0.0-nightly-
|
|
56
|
+
"@modern-js/builder-shared": "0.0.0-nightly-20230928160554",
|
|
57
|
+
"@modern-js/monorepo-utils": "0.0.0-nightly-20230928160554",
|
|
58
|
+
"@modern-js/node-bundle-require": "0.0.0-nightly-20230928160554",
|
|
59
|
+
"@modern-js/utils": "0.0.0-nightly-20230928160554"
|
|
52
60
|
},
|
|
53
61
|
"devDependencies": {
|
|
54
62
|
"@types/babel__core": "^7.20.0",
|
|
55
63
|
"@types/node": "^14",
|
|
56
64
|
"typescript": "^5",
|
|
57
|
-
"@modern-js/builder-webpack-provider": "0.0.0-nightly-
|
|
58
|
-
"@modern-js/builder-rspack-provider": "0.0.0-nightly-
|
|
59
|
-
"@scripts/build": "0.0.0-nightly-
|
|
60
|
-
"@scripts/vitest-config": "0.0.0-nightly-
|
|
65
|
+
"@modern-js/builder-webpack-provider": "0.0.0-nightly-20230928160554",
|
|
66
|
+
"@modern-js/builder-rspack-provider": "0.0.0-nightly-20230928160554",
|
|
67
|
+
"@scripts/build": "0.0.0-nightly-20230928160554",
|
|
68
|
+
"@scripts/vitest-config": "0.0.0-nightly-20230928160554"
|
|
61
69
|
},
|
|
62
70
|
"publishConfig": {
|
|
63
71
|
"registry": "https://registry.npmjs.org/",
|