@unpackjs/core 0.26.2 → 0.28.0
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/index.cjs +19 -3
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +20 -3
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +5 -4
package/dist/config/index.cjs
CHANGED
|
@@ -34,6 +34,7 @@ module.exports = __toCommonJS(config_exports);
|
|
|
34
34
|
var import_node_fs = __toESM(require("node:fs"));
|
|
35
35
|
var import_node_path = require("node:path");
|
|
36
36
|
var import_shared = require("@unpackjs/shared");
|
|
37
|
+
var import_plugin_react = require("@unpackjs/plugin-react");
|
|
37
38
|
const { merge } = require("@unpackjs/shared/webpack-merge");
|
|
38
39
|
async function loadConfig({
|
|
39
40
|
root,
|
|
@@ -62,7 +63,8 @@ async function loadConfig({
|
|
|
62
63
|
minify: (0, import_shared.isProd)(),
|
|
63
64
|
sourcemap: (0, import_shared.isProd)() ? false : "eval-cheap-module-source-map",
|
|
64
65
|
parallel: true,
|
|
65
|
-
filenameHash: true
|
|
66
|
+
filenameHash: true,
|
|
67
|
+
cache: (0, import_shared.isDev)()
|
|
66
68
|
},
|
|
67
69
|
server: {
|
|
68
70
|
port: 3e3
|
|
@@ -74,7 +76,7 @@ async function loadConfig({
|
|
|
74
76
|
modules: true,
|
|
75
77
|
transformer: "postcss"
|
|
76
78
|
},
|
|
77
|
-
clickToComponent: true
|
|
79
|
+
plugins: [(0, import_plugin_react.pluginReact)({ clickToComponent: true })]
|
|
78
80
|
};
|
|
79
81
|
if (cliOptions.port)
|
|
80
82
|
(0, import_shared.setValueByPath)(parsedUserConfig, ["server", "port"], cliOptions.port);
|
|
@@ -82,7 +84,21 @@ async function loadConfig({
|
|
|
82
84
|
(0, import_shared.setValueByPath)(parsedUserConfig, ["server", "open"], cliOptions.open);
|
|
83
85
|
if (cliOptions.analyze)
|
|
84
86
|
(0, import_shared.setValueByPath)(parsedUserConfig, ["performance", "bundleAnalyze"], cliOptions.analyze);
|
|
85
|
-
|
|
87
|
+
if (cliOptions.doctor)
|
|
88
|
+
(0, import_shared.setValueByPath)(parsedUserConfig, ["performance", "doctor"], cliOptions.doctor);
|
|
89
|
+
let { plugins, bundlerConfig, ...rest } = merge(defaultConfig, parsedUserConfig);
|
|
90
|
+
if (plugins?.[0]) {
|
|
91
|
+
for (const plugin of plugins) {
|
|
92
|
+
if (!plugin.config)
|
|
93
|
+
continue;
|
|
94
|
+
rest = await plugin.config(rest, { mergeConfig: merge });
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
...rest,
|
|
99
|
+
plugins,
|
|
100
|
+
bundlerConfig
|
|
101
|
+
};
|
|
86
102
|
}
|
|
87
103
|
function defineConfig(config) {
|
|
88
104
|
return config;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,YAAY,EAOlB,MAAM,kBAAkB,CAAA;AAIzB,wBAAsB,UAAU,CAAC,EAC/B,IAAI,EACJ,UAAU,GACX,EAAE;IACD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,UAAU,CAAC,EAAE,UAAU,CAAA;CACxB,GAAG,OAAO,CAAC,YAAY,CAAC,CA0DxB;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,EAAE,OAAO,CAAA;IACZ,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,YAAY,KAAK,OAAO,CAAC,YAAY,CAAC,CAAA;AACjF,MAAM,MAAM,kBAAkB,GAAG,CAAC,MAAM,EAAE,YAAY,KAAK,YAAY,CAAA;AACvE,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,kBAAkB,GAAG,mBAAmB,CAAA;AACxF,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,YAAY,CAAA;AAChE,wBAAgB,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,kBAAkB,CAAA;AAC5E,wBAAgB,YAAY,CAAC,MAAM,EAAE,mBAAmB,GAAG,mBAAmB,CAAA;AAC9E,wBAAgB,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,kBAAkB,CAAA"}
|
package/dist/config/index.js
CHANGED
|
@@ -12,11 +12,13 @@ import { isAbsolute, join } from "node:path";
|
|
|
12
12
|
import {
|
|
13
13
|
bundleRequire,
|
|
14
14
|
getNodeEnv,
|
|
15
|
+
isDev,
|
|
15
16
|
isProd,
|
|
16
17
|
logger,
|
|
17
18
|
setValueByPath
|
|
18
19
|
} from "@unpackjs/shared";
|
|
19
20
|
const { merge } = require("@unpackjs/shared/webpack-merge");
|
|
21
|
+
import { pluginReact } from "@unpackjs/plugin-react";
|
|
20
22
|
async function loadConfig({
|
|
21
23
|
root,
|
|
22
24
|
cliOptions
|
|
@@ -44,7 +46,8 @@ async function loadConfig({
|
|
|
44
46
|
minify: isProd(),
|
|
45
47
|
sourcemap: isProd() ? false : "eval-cheap-module-source-map",
|
|
46
48
|
parallel: true,
|
|
47
|
-
filenameHash: true
|
|
49
|
+
filenameHash: true,
|
|
50
|
+
cache: isDev()
|
|
48
51
|
},
|
|
49
52
|
server: {
|
|
50
53
|
port: 3e3
|
|
@@ -56,7 +59,7 @@ async function loadConfig({
|
|
|
56
59
|
modules: true,
|
|
57
60
|
transformer: "postcss"
|
|
58
61
|
},
|
|
59
|
-
clickToComponent: true
|
|
62
|
+
plugins: [pluginReact({ clickToComponent: true })]
|
|
60
63
|
};
|
|
61
64
|
if (cliOptions.port)
|
|
62
65
|
setValueByPath(parsedUserConfig, ["server", "port"], cliOptions.port);
|
|
@@ -64,7 +67,21 @@ async function loadConfig({
|
|
|
64
67
|
setValueByPath(parsedUserConfig, ["server", "open"], cliOptions.open);
|
|
65
68
|
if (cliOptions.analyze)
|
|
66
69
|
setValueByPath(parsedUserConfig, ["performance", "bundleAnalyze"], cliOptions.analyze);
|
|
67
|
-
|
|
70
|
+
if (cliOptions.doctor)
|
|
71
|
+
setValueByPath(parsedUserConfig, ["performance", "doctor"], cliOptions.doctor);
|
|
72
|
+
let { plugins, bundlerConfig, ...rest } = merge(defaultConfig, parsedUserConfig);
|
|
73
|
+
if (plugins?.[0]) {
|
|
74
|
+
for (const plugin of plugins) {
|
|
75
|
+
if (!plugin.config)
|
|
76
|
+
continue;
|
|
77
|
+
rest = await plugin.config(rest, { mergeConfig: merge });
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
...rest,
|
|
82
|
+
plugins,
|
|
83
|
+
bundlerConfig
|
|
84
|
+
};
|
|
68
85
|
}
|
|
69
86
|
function defineConfig(config) {
|
|
70
87
|
return config;
|
package/dist/index.cjs
CHANGED
|
@@ -32,7 +32,7 @@ async function createService({ command, root, cliOptions }) {
|
|
|
32
32
|
if (!npm_execpath || npm_lifecycle_event === "npx" || npm_execpath.includes("npx-cli") || npm_execpath.includes(".bun") || npm_execpath.includes("yarn")) {
|
|
33
33
|
console.log();
|
|
34
34
|
}
|
|
35
|
-
console.log(chalk.bold(`Unpack v${"0.
|
|
35
|
+
console.log(chalk.bold(`Unpack v${"0.28.0"}
|
|
36
36
|
`));
|
|
37
37
|
if (command === "build") {
|
|
38
38
|
(0, import_shared.setNodeEnv)(cliOptions.watch ? "development" : "production");
|
package/dist/index.js
CHANGED
|
@@ -21,7 +21,7 @@ async function createService({ command, root, cliOptions }) {
|
|
|
21
21
|
if (!npm_execpath || npm_lifecycle_event === "npx" || npm_execpath.includes("npx-cli") || npm_execpath.includes(".bun") || npm_execpath.includes("yarn")) {
|
|
22
22
|
console.log();
|
|
23
23
|
}
|
|
24
|
-
console.log(chalk.bold(`Unpack v${"0.
|
|
24
|
+
console.log(chalk.bold(`Unpack v${"0.28.0"}
|
|
25
25
|
`));
|
|
26
26
|
if (command === "build") {
|
|
27
27
|
setNodeEnv(cliOptions.watch ? "development" : "production");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unpackjs/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -23,9 +23,10 @@
|
|
|
23
23
|
"access": "public"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@unpackjs/bundler-rspack": "^0.
|
|
27
|
-
"@unpackjs/bundler-webpack": "^0.
|
|
28
|
-
"@unpackjs/shared": "^0.
|
|
26
|
+
"@unpackjs/bundler-rspack": "^0.28.0",
|
|
27
|
+
"@unpackjs/bundler-webpack": "^0.28.0",
|
|
28
|
+
"@unpackjs/shared": "^0.28.0",
|
|
29
|
+
"@unpackjs/plugin-react": "^0.28.0"
|
|
29
30
|
},
|
|
30
31
|
"scripts": {
|
|
31
32
|
"dev": "modern build --watch",
|