@unpackjs/core 1.2.0 → 1.3.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 +2 -4
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +3 -5
- package/dist/index.cjs +7 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -6
- package/package.json +5 -5
package/dist/config/index.cjs
CHANGED
|
@@ -61,7 +61,7 @@ async function loadConfig({
|
|
|
61
61
|
build: {
|
|
62
62
|
outDir: "dist",
|
|
63
63
|
minify: (0, import_shared.isProd)(),
|
|
64
|
-
sourcemap: (0, import_shared.isProd)() ? false : "
|
|
64
|
+
sourcemap: (0, import_shared.isProd)() ? false : "cheap-module-source-map",
|
|
65
65
|
parallel: true,
|
|
66
66
|
filenameHash: true,
|
|
67
67
|
cache: (0, import_shared.isDev)()
|
|
@@ -87,9 +87,7 @@ async function loadConfig({
|
|
|
87
87
|
if (cliOptions.doctor)
|
|
88
88
|
(0, import_shared.setValueByPath)(parsedUserConfig, ["performance", "doctor"], cliOptions.doctor);
|
|
89
89
|
let { plugins, bundlerConfig, ...rest } = merge(defaultConfig, parsedUserConfig);
|
|
90
|
-
for (const plugin of (0, import_shared.
|
|
91
|
-
if (!plugin.config)
|
|
92
|
-
continue;
|
|
90
|
+
for (const plugin of (0, import_shared.getNormalizedPluginsByHook)("config", plugins)) {
|
|
93
91
|
rest = await plugin.config(rest, { mergeConfig: merge });
|
|
94
92
|
}
|
|
95
93
|
return {
|
|
@@ -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,EAQlB,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,
|
|
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,EAQlB,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,CAuDxB;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,7 +12,7 @@ import { isAbsolute, join } from "node:path";
|
|
|
12
12
|
import {
|
|
13
13
|
bundleRequire,
|
|
14
14
|
getNodeEnv,
|
|
15
|
-
|
|
15
|
+
getNormalizedPluginsByHook,
|
|
16
16
|
isDev,
|
|
17
17
|
isProd,
|
|
18
18
|
logger,
|
|
@@ -45,7 +45,7 @@ async function loadConfig({
|
|
|
45
45
|
build: {
|
|
46
46
|
outDir: "dist",
|
|
47
47
|
minify: isProd(),
|
|
48
|
-
sourcemap: isProd() ? false : "
|
|
48
|
+
sourcemap: isProd() ? false : "cheap-module-source-map",
|
|
49
49
|
parallel: true,
|
|
50
50
|
filenameHash: true,
|
|
51
51
|
cache: isDev()
|
|
@@ -71,9 +71,7 @@ async function loadConfig({
|
|
|
71
71
|
if (cliOptions.doctor)
|
|
72
72
|
setValueByPath(parsedUserConfig, ["performance", "doctor"], cliOptions.doctor);
|
|
73
73
|
let { plugins, bundlerConfig, ...rest } = merge(defaultConfig, parsedUserConfig);
|
|
74
|
-
for (const plugin of
|
|
75
|
-
if (!plugin.config)
|
|
76
|
-
continue;
|
|
74
|
+
for (const plugin of getNormalizedPluginsByHook("config", plugins)) {
|
|
77
75
|
rest = await plugin.config(rest, { mergeConfig: merge });
|
|
78
76
|
}
|
|
79
77
|
return {
|
package/dist/index.cjs
CHANGED
|
@@ -28,12 +28,6 @@ var import_config = require("./config/index.cjs");
|
|
|
28
28
|
var import_config2 = require("./config/index.cjs");
|
|
29
29
|
const chalk = require("@unpackjs/shared/chalk");
|
|
30
30
|
async function createService({ command, root, cliOptions }) {
|
|
31
|
-
const { npm_execpath, npm_lifecycle_event } = process.env;
|
|
32
|
-
if (!npm_execpath || npm_lifecycle_event === "npx" || npm_execpath.includes("npx-cli") || npm_execpath.includes(".bun") || npm_execpath.includes("yarn")) {
|
|
33
|
-
console.log();
|
|
34
|
-
}
|
|
35
|
-
console.log(chalk.bold(`Unpack v${"1.2.0"}
|
|
36
|
-
`));
|
|
37
31
|
if (command === "build") {
|
|
38
32
|
(0, import_shared.setNodeEnv)(cliOptions.watch ? "development" : "production");
|
|
39
33
|
(0, import_shared.setDevServer)(false);
|
|
@@ -41,6 +35,13 @@ async function createService({ command, root, cliOptions }) {
|
|
|
41
35
|
(0, import_shared.setNodeEnv)("development");
|
|
42
36
|
(0, import_shared.setDevServer)(true);
|
|
43
37
|
}
|
|
38
|
+
if ((0, import_shared.isDevServer)()) {
|
|
39
|
+
import_shared.logger.greet(` ${chalk.green(`${chalk.bold("UNPACK")} v${"1.3.0"}`)}
|
|
40
|
+
`);
|
|
41
|
+
} else {
|
|
42
|
+
import_shared.logger.greet(chalk.bold(`Unpack v${"1.3.0"}
|
|
43
|
+
`));
|
|
44
|
+
}
|
|
44
45
|
const unpackConfig = await (0, import_config.loadConfig)({ root, cliOptions });
|
|
45
46
|
const bundlerMap = {
|
|
46
47
|
webpack: () => {
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,OAAO,EAMb,MAAM,kBAAkB,CAAA;AAGzB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,OAAO,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,CAAC,EAAE,UAAU,CAAA;CACxB,CAAA;AACD,wBAAsB,aAAa,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,oBAAoB,iBAyCtF"}
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,8 @@ var __filename = /* @__PURE__ */ getFilename();
|
|
|
10
10
|
import { build as rspackBuild, dev as rspackDev } from "@unpackjs/bundler-rspack";
|
|
11
11
|
import { build as webpackBuild, dev as webpackDev } from "@unpackjs/bundler-webpack";
|
|
12
12
|
import {
|
|
13
|
+
isDevServer,
|
|
14
|
+
logger,
|
|
13
15
|
setDevServer,
|
|
14
16
|
setNodeEnv
|
|
15
17
|
} from "@unpackjs/shared";
|
|
@@ -17,12 +19,6 @@ const chalk = require("@unpackjs/shared/chalk");
|
|
|
17
19
|
import { loadConfig } from "./config/index.js";
|
|
18
20
|
import { defineConfig } from "./config/index.js";
|
|
19
21
|
async function createService({ command, root, cliOptions }) {
|
|
20
|
-
const { npm_execpath, npm_lifecycle_event } = process.env;
|
|
21
|
-
if (!npm_execpath || npm_lifecycle_event === "npx" || npm_execpath.includes("npx-cli") || npm_execpath.includes(".bun") || npm_execpath.includes("yarn")) {
|
|
22
|
-
console.log();
|
|
23
|
-
}
|
|
24
|
-
console.log(chalk.bold(`Unpack v${"1.2.0"}
|
|
25
|
-
`));
|
|
26
22
|
if (command === "build") {
|
|
27
23
|
setNodeEnv(cliOptions.watch ? "development" : "production");
|
|
28
24
|
setDevServer(false);
|
|
@@ -30,6 +26,13 @@ async function createService({ command, root, cliOptions }) {
|
|
|
30
26
|
setNodeEnv("development");
|
|
31
27
|
setDevServer(true);
|
|
32
28
|
}
|
|
29
|
+
if (isDevServer()) {
|
|
30
|
+
logger.greet(` ${chalk.green(`${chalk.bold("UNPACK")} v${"1.3.0"}`)}
|
|
31
|
+
`);
|
|
32
|
+
} else {
|
|
33
|
+
logger.greet(chalk.bold(`Unpack v${"1.3.0"}
|
|
34
|
+
`));
|
|
35
|
+
}
|
|
33
36
|
const unpackConfig = await loadConfig({ root, cliOptions });
|
|
34
37
|
const bundlerMap = {
|
|
35
38
|
webpack: () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unpackjs/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"access": "public"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@unpackjs/bundler-rspack": "^1.
|
|
27
|
-
"@unpackjs/bundler-webpack": "^1.
|
|
28
|
-
"@unpackjs/shared": "^1.
|
|
29
|
-
"@unpackjs/plugin-react": "^1.
|
|
26
|
+
"@unpackjs/bundler-rspack": "^1.3.0",
|
|
27
|
+
"@unpackjs/bundler-webpack": "^1.3.0",
|
|
28
|
+
"@unpackjs/shared": "^1.3.0",
|
|
29
|
+
"@unpackjs/plugin-react": "^1.3.0"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"dev": "modern build --watch",
|