@unpackjs/core 0.10.1 → 0.12.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.
@@ -0,0 +1,114 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var config_exports = {};
29
+ __export(config_exports, {
30
+ defineConfig: () => defineConfig,
31
+ loadConfig: () => loadConfig
32
+ });
33
+ module.exports = __toCommonJS(config_exports);
34
+ var import_shared = require("@unpackjs/shared");
35
+ var import_node_fs = __toESM(require("node:fs"));
36
+ var import_node_path = require("node:path");
37
+ const { merge } = require("@unpackjs/shared/webpack-merge");
38
+ async function loadConfig({
39
+ root,
40
+ cliOptions
41
+ }) {
42
+ const configPath = resolveConfigPath(root, cliOptions?.config);
43
+ let userConfig = {};
44
+ if (configPath) {
45
+ userConfig = await (0, import_shared.bundleRequire)(configPath);
46
+ if (typeof userConfig === "function") {
47
+ const params = {
48
+ env: (0, import_shared.getNodeEnv)(),
49
+ command: process.argv[2]
50
+ };
51
+ userConfig = await userConfig(params);
52
+ if (userConfig === void 0) {
53
+ throw new Error("Unpack config function must return a config object.");
54
+ }
55
+ }
56
+ }
57
+ const parsedUserConfig = userConfig;
58
+ const defaultConfig = {
59
+ bundler: "webpack",
60
+ build: {
61
+ outDir: "dist"
62
+ },
63
+ server: {
64
+ port: 3e3,
65
+ open: false
66
+ },
67
+ html: {
68
+ mountId: "root"
69
+ },
70
+ experiments: {
71
+ css: true
72
+ }
73
+ };
74
+ if (cliOptions.port)
75
+ (0, import_shared.setValueByPath)(parsedUserConfig, ["server", "port"], cliOptions.port);
76
+ if (cliOptions.open)
77
+ (0, import_shared.setValueByPath)(parsedUserConfig, ["server", "open"], cliOptions.open);
78
+ if (cliOptions.analyze)
79
+ (0, import_shared.setValueByPath)(parsedUserConfig, ["performance", "bundleAnalyze"], cliOptions.analyze);
80
+ return merge(defaultConfig, parsedUserConfig);
81
+ }
82
+ function defineConfig(config) {
83
+ return config;
84
+ }
85
+ function resolveConfigPath(root, customConfig) {
86
+ if (customConfig) {
87
+ const customConfigPath = (0, import_node_path.isAbsolute)(customConfig) ? customConfig : (0, import_node_path.join)(root, customConfig);
88
+ if (import_node_fs.default.existsSync(customConfigPath)) {
89
+ return customConfigPath;
90
+ }
91
+ import_shared.logger.warn(`Cannot find config file: ${customConfigPath}
92
+ `);
93
+ }
94
+ const CONFIG_FILES = [
95
+ "unpack.config.ts",
96
+ "unpack.config.js",
97
+ "unpack.config.mjs",
98
+ "unpack.config.cjs",
99
+ "unpack.config.mts",
100
+ "unpack.config.cts"
101
+ ];
102
+ for (const file of CONFIG_FILES) {
103
+ const configFile = (0, import_node_path.join)(root, file);
104
+ if (import_node_fs.default.existsSync(configFile)) {
105
+ return configFile;
106
+ }
107
+ }
108
+ return null;
109
+ }
110
+ // Annotate the CommonJS export names for ESM import in node:
111
+ 0 && (module.exports = {
112
+ defineConfig,
113
+ loadConfig
114
+ });
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,YAAY,EAIjB,KAAK,OAAO,EACZ,KAAK,OAAO,EACb,MAAM,kBAAkB,CAAA;AAWzB,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,CAoCxB;AACD,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,EAAE,OAAO,CAAA;IACZ,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AACD,MAAM,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,YAAY,KAAK,OAAO,CAAC,YAAY,CAAC,CAAA;AAEjF,MAAM,MAAM,kBAAkB,GAAG,CAAC,MAAM,EAAE,YAAY,KAAK,YAAY,CAAA;AAEvE,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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,YAAY,EAIjB,KAAK,OAAO,EACZ,KAAK,OAAO,EAEb,MAAM,kBAAkB,CAAA;AAKzB,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,CAuCxB;AACD,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,EAAE,OAAO,CAAA;IACZ,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AACD,MAAM,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,YAAY,KAAK,OAAO,CAAC,YAAY,CAAC,CAAA;AAEjF,MAAM,MAAM,kBAAkB,GAAG,CAAC,MAAM,EAAE,YAAY,KAAK,YAAY,CAAA;AAEvE,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"}
@@ -1,46 +1,21 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var config_exports = {};
29
- __export(config_exports, {
30
- defineConfig: () => defineConfig,
31
- loadConfig: () => loadConfig
32
- });
33
- module.exports = __toCommonJS(config_exports);
34
- var import_shared = require("@unpackjs/shared");
35
- var import_node_fs = __toESM(require("node:fs"));
36
- var import_node_path = require("node:path");
37
- var import_webpack_merge = require("@unpackjs/shared/webpack-merge");
38
- const jiti = require("@unpackjs/shared/jiti")(__filename, {
39
- esmResolve: true,
40
- // disable require cache to support restart CLI and read the new config
41
- requireCache: false,
42
- interopDefault: true
43
- });
1
+ import { createRequire } from 'module';
2
+ var require = createRequire(import.meta['url']);
3
+
4
+ import { fileURLToPath } from "url";
5
+ import path from "path";
6
+ var getFilename = () => fileURLToPath(import.meta.url);
7
+ var getDirname = () => path.dirname(getFilename());
8
+ var __dirname = /* @__PURE__ */ getDirname();
9
+ var __filename = /* @__PURE__ */ getFilename();
10
+ import {
11
+ getNodeEnv,
12
+ logger,
13
+ setValueByPath,
14
+ bundleRequire
15
+ } from "@unpackjs/shared";
16
+ import fs from "node:fs";
17
+ import { isAbsolute, join } from "node:path";
18
+ const { merge } = require("@unpackjs/shared/webpack-merge");
44
19
  async function loadConfig({
45
20
  root,
46
21
  cliOptions
@@ -48,10 +23,10 @@ async function loadConfig({
48
23
  const configPath = resolveConfigPath(root, cliOptions?.config);
49
24
  let userConfig = {};
50
25
  if (configPath) {
51
- userConfig = jiti(configPath);
26
+ userConfig = await bundleRequire(configPath);
52
27
  if (typeof userConfig === "function") {
53
28
  const params = {
54
- env: (0, import_shared.getNodeEnv)(),
29
+ env: getNodeEnv(),
55
30
  command: process.argv[2]
56
31
  };
57
32
  userConfig = await userConfig(params);
@@ -72,26 +47,29 @@ async function loadConfig({
72
47
  },
73
48
  html: {
74
49
  mountId: "root"
50
+ },
51
+ experiments: {
52
+ css: true
75
53
  }
76
54
  };
77
55
  if (cliOptions.port)
78
- (0, import_shared.setValueByPath)(parsedUserConfig, ["server", "port"], cliOptions.port);
56
+ setValueByPath(parsedUserConfig, ["server", "port"], cliOptions.port);
79
57
  if (cliOptions.open)
80
- (0, import_shared.setValueByPath)(parsedUserConfig, ["server", "open"], cliOptions.open);
58
+ setValueByPath(parsedUserConfig, ["server", "open"], cliOptions.open);
81
59
  if (cliOptions.analyze)
82
- (0, import_shared.setValueByPath)(parsedUserConfig, ["performance", "bundleAnalyze"], cliOptions.analyze);
83
- return (0, import_webpack_merge.merge)(defaultConfig, parsedUserConfig);
60
+ setValueByPath(parsedUserConfig, ["performance", "bundleAnalyze"], cliOptions.analyze);
61
+ return merge(defaultConfig, parsedUserConfig);
84
62
  }
85
63
  function defineConfig(config) {
86
64
  return config;
87
65
  }
88
66
  function resolveConfigPath(root, customConfig) {
89
67
  if (customConfig) {
90
- const customConfigPath = (0, import_node_path.isAbsolute)(customConfig) ? customConfig : (0, import_node_path.join)(root, customConfig);
91
- if (import_node_fs.default.existsSync(customConfigPath)) {
68
+ const customConfigPath = isAbsolute(customConfig) ? customConfig : join(root, customConfig);
69
+ if (fs.existsSync(customConfigPath)) {
92
70
  return customConfigPath;
93
71
  }
94
- import_shared.logger.warn(`Cannot find config file: ${customConfigPath}
72
+ logger.warn(`Cannot find config file: ${customConfigPath}
95
73
  `);
96
74
  }
97
75
  const CONFIG_FILES = [
@@ -103,15 +81,14 @@ function resolveConfigPath(root, customConfig) {
103
81
  "unpack.config.cts"
104
82
  ];
105
83
  for (const file of CONFIG_FILES) {
106
- const configFile = (0, import_node_path.join)(root, file);
107
- if (import_node_fs.default.existsSync(configFile)) {
84
+ const configFile = join(root, file);
85
+ if (fs.existsSync(configFile)) {
108
86
  return configFile;
109
87
  }
110
88
  }
111
89
  return null;
112
90
  }
113
- // Annotate the CommonJS export names for ESM import in node:
114
- 0 && (module.exports = {
91
+ export {
115
92
  defineConfig,
116
93
  loadConfig
117
- });
94
+ };
package/dist/index.cjs ADDED
@@ -0,0 +1,72 @@
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
+ var src_exports = {};
19
+ __export(src_exports, {
20
+ createService: () => createService,
21
+ defineConfig: () => import_config2.defineConfig
22
+ });
23
+ module.exports = __toCommonJS(src_exports);
24
+ var import_shared = require("@unpackjs/shared");
25
+ var import_config = require("./config/index.cjs");
26
+ var import_bundler_webpack = require("@unpackjs/bundler-webpack");
27
+ var import_bundler_rspack = require("@unpackjs/bundler-rspack");
28
+ var import_config2 = require("./config/index.cjs");
29
+ async function createService({ command, root, cliOptions }) {
30
+ const { npm_execpath } = process.env;
31
+ if (!npm_execpath || npm_execpath.includes("npx-cli") || npm_execpath.includes(".bun") || npm_execpath.includes("yarn")) {
32
+ console.log();
33
+ }
34
+ import_shared.logger.greet(`Unpack v${"0.12.0"}
35
+ `);
36
+ if (command === "build") {
37
+ (0, import_shared.setNodeEnv)(cliOptions.watch ? "development" : "production");
38
+ (0, import_shared.setDevServer)(false);
39
+ } else {
40
+ (0, import_shared.setNodeEnv)("development");
41
+ (0, import_shared.setDevServer)(true);
42
+ }
43
+ const unpackConfig = await (0, import_config.loadConfig)({ root, cliOptions });
44
+ const bundlerMap = {
45
+ webpack: () => {
46
+ return {
47
+ build: () => {
48
+ (0, import_bundler_webpack.build)({ root, unpackConfig });
49
+ },
50
+ dev: () => {
51
+ (0, import_bundler_webpack.dev)({ root, unpackConfig });
52
+ }
53
+ };
54
+ },
55
+ rspack: () => {
56
+ return {
57
+ build: () => {
58
+ (0, import_bundler_rspack.build)({ root, unpackConfig });
59
+ },
60
+ dev: () => {
61
+ (0, import_bundler_rspack.dev)({ root, unpackConfig });
62
+ }
63
+ };
64
+ }
65
+ };
66
+ bundlerMap[unpackConfig.bundler]()[command]();
67
+ }
68
+ // Annotate the CommonJS export names for ESM import in node:
69
+ 0 && (module.exports = {
70
+ createService,
71
+ defineConfig
72
+ });
@@ -1,5 +1,5 @@
1
1
  import { type Command, type CliOptions } from '@unpackjs/shared';
2
- export { defineConfig } from './config';
2
+ export { defineConfig } from './config/index';
3
3
  export type CreateServiceOptions = {
4
4
  command: Command;
5
5
  root: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EAIZ,KAAK,UAAU,EAEhB,MAAM,kBAAkB,CAAA;AAIzB,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAEvC,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,iBA8CtF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EAIZ,KAAK,UAAU,EAEhB,MAAM,kBAAkB,CAAA;AAIzB,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,iBA8CtF"}
package/dist/index.js CHANGED
@@ -1,72 +1,61 @@
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
- var src_exports = {};
19
- __export(src_exports, {
20
- createService: () => createService,
21
- defineConfig: () => import_config2.defineConfig
22
- });
23
- module.exports = __toCommonJS(src_exports);
24
- var import_shared = require("@unpackjs/shared");
25
- var import_config = require("./config");
26
- var import_bundler_webpack = require("@unpackjs/bundler-webpack");
27
- var import_bundler_rspack = require("@unpackjs/bundler-rspack");
28
- var import_config2 = require("./config");
1
+ import { createRequire } from 'module';
2
+ var require = createRequire(import.meta['url']);
3
+
4
+ import { fileURLToPath } from "url";
5
+ import path from "path";
6
+ var getFilename = () => fileURLToPath(import.meta.url);
7
+ var getDirname = () => path.dirname(getFilename());
8
+ var __dirname = /* @__PURE__ */ getDirname();
9
+ var __filename = /* @__PURE__ */ getFilename();
10
+ import {
11
+ setDevServer,
12
+ setNodeEnv,
13
+ logger
14
+ } from "@unpackjs/shared";
15
+ import { loadConfig } from "./config/index.js";
16
+ import { build as webpackBuild, dev as webpackDev } from "@unpackjs/bundler-webpack";
17
+ import { build as rspackBuild, dev as rspackDev } from "@unpackjs/bundler-rspack";
18
+ import { defineConfig } from "./config/index.js";
29
19
  async function createService({ command, root, cliOptions }) {
30
20
  const { npm_execpath } = process.env;
31
21
  if (!npm_execpath || npm_execpath.includes("npx-cli") || npm_execpath.includes(".bun") || npm_execpath.includes("yarn")) {
32
22
  console.log();
33
23
  }
34
- import_shared.logger.greet(` Unpack v${"0.10.1"}
24
+ logger.greet(`Unpack v${"0.12.0"}
35
25
  `);
36
26
  if (command === "build") {
37
- (0, import_shared.setNodeEnv)(cliOptions.watch ? "development" : "production");
38
- (0, import_shared.setDevServer)(false);
27
+ setNodeEnv(cliOptions.watch ? "development" : "production");
28
+ setDevServer(false);
39
29
  } else {
40
- (0, import_shared.setNodeEnv)("development");
41
- (0, import_shared.setDevServer)(true);
30
+ setNodeEnv("development");
31
+ setDevServer(true);
42
32
  }
43
- const unpackConfig = await (0, import_config.loadConfig)({ root, cliOptions });
33
+ const unpackConfig = await loadConfig({ root, cliOptions });
44
34
  const bundlerMap = {
45
35
  webpack: () => {
46
36
  return {
47
37
  build: () => {
48
- (0, import_bundler_webpack.build)({ root, unpackConfig });
38
+ webpackBuild({ root, unpackConfig });
49
39
  },
50
40
  dev: () => {
51
- (0, import_bundler_webpack.dev)({ root, unpackConfig });
41
+ webpackDev({ root, unpackConfig });
52
42
  }
53
43
  };
54
44
  },
55
45
  rspack: () => {
56
46
  return {
57
47
  build: () => {
58
- (0, import_bundler_rspack.build)({ root, unpackConfig });
48
+ rspackBuild({ root, unpackConfig });
59
49
  },
60
50
  dev: () => {
61
- (0, import_bundler_rspack.dev)({ root, unpackConfig });
51
+ rspackDev({ root, unpackConfig });
62
52
  }
63
53
  };
64
54
  }
65
55
  };
66
56
  bundlerMap[unpackConfig.bundler]()[command]();
67
57
  }
68
- // Annotate the CommonJS export names for ESM import in node:
69
- 0 && (module.exports = {
58
+ export {
70
59
  createService,
71
60
  defineConfig
72
- });
61
+ };
package/package.json CHANGED
@@ -1,9 +1,20 @@
1
1
  {
2
2
  "name": "@unpackjs/core",
3
- "version": "0.10.1",
3
+ "version": "0.12.0",
4
4
  "description": "",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "import": {
9
+ "types": "./dist/index.d.ts",
10
+ "default": "./dist/index.js"
11
+ },
12
+ "require": {
13
+ "types": "./dist/index.d.cts",
14
+ "default": "./dist/index.cjs"
15
+ }
16
+ }
17
+ },
7
18
  "keywords": [],
8
19
  "authors": [],
9
20
  "license": "MIT",
@@ -15,9 +26,9 @@
15
26
  "access": "public"
16
27
  },
17
28
  "dependencies": {
18
- "@unpackjs/bundler-rspack": "^0.10.1",
19
- "@unpackjs/bundler-webpack": "^0.10.1",
20
- "@unpackjs/shared": "^0.10.1"
29
+ "@unpackjs/bundler-rspack": "^0.12.0",
30
+ "@unpackjs/bundler-webpack": "^0.12.0",
31
+ "@unpackjs/shared": "^0.12.0"
21
32
  },
22
33
  "scripts": {
23
34
  "dev": "modern build --watch",
File without changes