@unpackjs/core 1.1.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.
@@ -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 : "eval-cheap-module-source-map",
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,12 +87,8 @@ 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
- if (plugins?.[0]) {
91
- for (const plugin of plugins) {
92
- if (!plugin.config)
93
- continue;
94
- rest = await plugin.config(rest, { mergeConfig: merge });
95
- }
90
+ for (const plugin of (0, import_shared.getNormalizedPluginsByHook)("config", plugins)) {
91
+ rest = await plugin.config(rest, { mergeConfig: merge });
96
92
  }
97
93
  return {
98
94
  ...rest,
@@ -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,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,mBAAm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,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"}
@@ -12,6 +12,7 @@ import { isAbsolute, join } from "node:path";
12
12
  import {
13
13
  bundleRequire,
14
14
  getNodeEnv,
15
+ getNormalizedPluginsByHook,
15
16
  isDev,
16
17
  isProd,
17
18
  logger,
@@ -44,7 +45,7 @@ async function loadConfig({
44
45
  build: {
45
46
  outDir: "dist",
46
47
  minify: isProd(),
47
- sourcemap: isProd() ? false : "eval-cheap-module-source-map",
48
+ sourcemap: isProd() ? false : "cheap-module-source-map",
48
49
  parallel: true,
49
50
  filenameHash: true,
50
51
  cache: isDev()
@@ -70,12 +71,8 @@ async function loadConfig({
70
71
  if (cliOptions.doctor)
71
72
  setValueByPath(parsedUserConfig, ["performance", "doctor"], cliOptions.doctor);
72
73
  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
- }
74
+ for (const plugin of getNormalizedPluginsByHook("config", plugins)) {
75
+ rest = await plugin.config(rest, { mergeConfig: merge });
79
76
  }
80
77
  return {
81
78
  ...rest,
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.1.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: () => {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,OAAO,EAIb,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,iBA+CtF"}
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.1.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.1.0",
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.1.0",
27
- "@unpackjs/bundler-webpack": "^1.1.0",
28
- "@unpackjs/shared": "^1.1.0",
29
- "@unpackjs/plugin-react": "^1.1.0"
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",