@powerlines/plugin-unbuild 0.5.590 → 0.5.592

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/README.md CHANGED
@@ -5,9 +5,9 @@
5
5
 
6
6
  <div align="center">
7
7
  <picture>
8
- <source media="(prefers-color-scheme: dark)" srcset="https://public.storm-cdn.com/powerlines/banner-1280x640-dark.gif">
9
- <source media="(prefers-color-scheme: light)" srcset="https://public.storm-cdn.com/powerlines/banner-1280x640-light.gif">
10
- <img src="https://public.storm-cdn.com/powerlines/banner-1280x640-dark.gif" width="100%" alt="Powerlines" />
8
+ <source media="(prefers-color-scheme: dark)" srcset="https://public.storm-cdn.com/powerlines/media/banner-1280x640-dark.gif">
9
+ <source media="(prefers-color-scheme: light)" srcset="https://public.storm-cdn.com/powerlines/media/banner-1280x640-light.gif">
10
+ <img src="https://public.storm-cdn.com/powerlines/media/banner-1280x640-dark.gif" width="100%" alt="Powerlines" />
11
11
  </picture>
12
12
  </div>
13
13
  <br />
@@ -252,9 +252,9 @@ specification. Contributions of any kind welcome!
252
252
 
253
253
  <div align="center">
254
254
  <picture>
255
- <source media="(prefers-color-scheme: dark)" srcset="https://public.storm-cdn.com/storm-software/banner-1280x320-dark.webp">
256
- <source media="(prefers-color-scheme: light)" srcset="https://public.storm-cdn.com/storm-software/banner-1280x320-light.webp">
257
- <img src="https://public.storm-cdn.com/storm-software/banner-1280x320-dark.webp" width="100%" alt="Storm Software" />
255
+ <source media="(prefers-color-scheme: dark)" srcset="https://public.storm-cdn.com/storm-software/media/banner-1280x320-dark.webp">
256
+ <source media="(prefers-color-scheme: light)" srcset="https://public.storm-cdn.com/storm-software/media/banner-1280x320-light.webp">
257
+ <img src="https://public.storm-cdn.com/storm-software/media/banner-1280x320-dark.webp" width="100%" alt="Storm Software" />
258
258
  </picture>
259
259
  </div>
260
260
  <br />
@@ -286,9 +286,17 @@ generation of development tools, please reach out on our
286
286
 
287
287
  <br />
288
288
 
289
- <div align="center"><a href="https://stormsoftware.com" target="_blank"><img src="https://public.storm-cdn.com/storm-software/icon-circle-fill-dark.png" alt="Storm Software" width="200px"/></a></div>
289
+ <div align="center">
290
+ <a href="https://stormsoftware.com" target="_blank">
291
+ <picture>
292
+ <source media="(prefers-color-scheme: dark)" srcset="https://public.storm-cdn.com/storm-software/icons/circle-dark.webp">
293
+ <source media="(prefers-color-scheme: light)" srcset="https://public.storm-cdn.com/storm-software/icons/circle-light.webp">
294
+ <img src="https://public.storm-cdn.com/storm-software/icons/circle-dark.webp" width="200px" alt="Storm Software" />
295
+ </picture>
296
+ </a>
297
+ </div>
290
298
  <br />
291
- <div align="center"><a href="https://stormsoftware.com" target="_blank"><img src="https://public.storm-cdn.com/visit-us-text.svg" alt="Visit us at stormsoftware.com" height="90px"/></a></div>
299
+ <div align="center"><a href="https://stormsoftware.com" target="_blank"><picture><source media="(prefers-color-scheme: dark)" srcset="https://public.storm-cdn.com/misc/text/visit-us-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://public.storm-cdn.com/misc/text/visit-us-light.png"><img src="https://public.storm-cdn.com/misc/text/visit-us-dark.png" height="90px" alt="Visit us at stormsoftware.com" /></picture></a></div>
292
300
 
293
301
  <br />
294
302
 
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_resolve_options = require('../resolve-options-B2bmiwoX.cjs');
2
+ const require_helpers_resolve_options = require('./resolve-options.cjs');
3
3
 
4
- exports.DEFAULT_UNBUILD_CONFIG = require_resolve_options.DEFAULT_UNBUILD_CONFIG;
5
- exports.resolveOptions = require_resolve_options.resolveOptions;
6
- exports.unbuildLoader = require_resolve_options.unbuildLoader;
4
+ exports.DEFAULT_UNBUILD_CONFIG = require_helpers_resolve_options.DEFAULT_UNBUILD_CONFIG;
5
+ exports.resolveOptions = require_helpers_resolve_options.resolveOptions;
6
+ exports.unbuildLoader = require_helpers_resolve_options.unbuildLoader;
@@ -1,6 +1,153 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_resolve_options = require('../resolve-options-B2bmiwoX.cjs');
2
+ //#region \0rolldown/runtime.js
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
+ key = keys[i];
13
+ if (!__hasOwnProp.call(to, key) && key !== except) {
14
+ __defProp(to, key, {
15
+ get: ((k) => from[k]).bind(null, key),
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ }
19
+ }
20
+ }
21
+ return to;
22
+ };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24
+ value: mod,
25
+ enumerable: true
26
+ }) : target, mod));
3
27
 
4
- exports.DEFAULT_UNBUILD_CONFIG = require_resolve_options.DEFAULT_UNBUILD_CONFIG;
5
- exports.resolveOptions = require_resolve_options.resolveOptions;
6
- exports.unbuildLoader = require_resolve_options.unbuildLoader;
28
+ //#endregion
29
+ let _powerlines_core_lib_utilities_source_file = require("@powerlines/core/lib/utilities/source-file");
30
+ let _powerlines_unplugin_rollup = require("@powerlines/unplugin/rollup");
31
+ let _stryke_path = require("@stryke/path");
32
+ let _stryke_path_join_paths = require("@stryke/path/join-paths");
33
+ let defu = require("defu");
34
+ defu = __toESM(defu, 1);
35
+ let esbuild = require("esbuild");
36
+
37
+ //#region src/helpers/resolve-options.ts
38
+ const DEFAULT_UNBUILD_CONFIG = {
39
+ dts: true,
40
+ clean: false,
41
+ includeSrc: false,
42
+ treeShaking: true,
43
+ splitting: true,
44
+ stub: false,
45
+ watchOptions: {},
46
+ outputPath: "dist",
47
+ generatePackageJson: true,
48
+ banner: " ",
49
+ rollup: {
50
+ dts: {},
51
+ emitCJS: true,
52
+ replace: {},
53
+ resolve: {},
54
+ json: {},
55
+ esbuild: { target: "es2020" },
56
+ commonjs: {},
57
+ alias: {}
58
+ }
59
+ };
60
+ const unbuildLoader = (context) => {
61
+ return async (input, { options }) => {
62
+ if (!/\.(?:c|m)?[jt]sx?$/.test(input.path) || /\.d\.[cm]?ts$/.test(input.path)) return;
63
+ const output = [];
64
+ let contents = await input.getContents();
65
+ if (options.declaration && !input.srcPath?.match(/\.d\.[cm]?ts$/)) {
66
+ const extension = `.d.${input.srcPath?.match(/(?<=\.)(?:c|m)(?=[jt]s$)/)?.[0] || ""}ts`;
67
+ output.push({
68
+ contents,
69
+ srcPath: input.srcPath,
70
+ path: input.path,
71
+ extension,
72
+ declaration: true
73
+ });
74
+ }
75
+ let transformed = contents;
76
+ let result = await context.callHook("transform", {
77
+ sequential: true,
78
+ order: "pre"
79
+ }, transformed, input.path);
80
+ if (result) transformed = result;
81
+ result = await context.callHook("transform", {
82
+ sequential: true,
83
+ order: "normal"
84
+ }, (0, _powerlines_core_lib_utilities_source_file.getString)(transformed), input.path);
85
+ if (result) transformed = result;
86
+ result = await context.callHook("transform", {
87
+ sequential: true,
88
+ order: "post"
89
+ }, (0, _powerlines_core_lib_utilities_source_file.getString)(transformed), input.path);
90
+ if (result) transformed = result;
91
+ if ([
92
+ ".ts",
93
+ ".mts",
94
+ ".cts"
95
+ ].includes(input.extension)) contents = await (0, esbuild.transform)((0, _powerlines_core_lib_utilities_source_file.getString)(transformed), {
96
+ ...Object.fromEntries(Object.entries(options.esbuild ?? {}).filter(([key]) => key !== "absPaths")),
97
+ loader: "ts"
98
+ }).then((r) => r.code);
99
+ else if ([".tsx", ".jsx"].includes(input.extension)) contents = await (0, esbuild.transform)((0, _powerlines_core_lib_utilities_source_file.getString)(transformed), {
100
+ loader: input.extension === ".tsx" ? "tsx" : "jsx",
101
+ ...Object.fromEntries(Object.entries(options.esbuild ?? {}).filter(([key]) => key !== "absPaths"))
102
+ }).then((r) => r.code);
103
+ const isCjs = options.format === "cjs";
104
+ if (isCjs) contents = context.resolver.transform({
105
+ source: contents,
106
+ retainLines: false
107
+ }).replace(/^exports.default = /gm, "module.exports = ").replace(/^var _default = exports.default = /gm, "module.exports = ").replace("module.exports = void 0;", "");
108
+ let extension = isCjs ? ".js" : ".mjs";
109
+ if (options.ext) extension = options.ext.startsWith(".") ? options.ext : `.${options.ext}`;
110
+ output.push({
111
+ contents,
112
+ path: input.path,
113
+ extension
114
+ });
115
+ return output;
116
+ };
117
+ };
118
+ /**
119
+ * Extracts the unbuild configuration from the context.
120
+ *
121
+ * @param context - The build context.
122
+ * @returns The resolved unbuild configuration.
123
+ */
124
+ function resolveOptions(context) {
125
+ return (0, defu.default)({ alias: context.alias }, context.config.unbuild ? context.config.unbuild : {}, {
126
+ projectName: context.config.name,
127
+ name: context.config.name,
128
+ orgName: context.config.organization,
129
+ sourceRoot: (0, _stryke_path_join_paths.joinPaths)(context.config.root, "src"),
130
+ projectRoot: context.config.root,
131
+ outputPath: (0, _stryke_path.relativePath)((0, _stryke_path.appendPath)(context.config.root, context.config.cwd), context.config.output.path),
132
+ platform: context.config.platform,
133
+ external: context.builtins.reduce((ret, id) => {
134
+ if (!ret.includes(id)) ret.push(id);
135
+ return ret;
136
+ }, context.config.resolve.external ?? []),
137
+ loaders: [unbuildLoader(context)],
138
+ jiti: {
139
+ interopDefault: true,
140
+ fsCache: (0, _stryke_path_join_paths.joinPaths)(context.envPaths.cache, "jiti"),
141
+ moduleCache: true
142
+ },
143
+ rollup: (0, _powerlines_unplugin_rollup.resolveOptions)(context),
144
+ debug: context.config.mode === "development",
145
+ minify: context.config.output.minify,
146
+ sourcemap: context.config.output.sourceMap
147
+ }, DEFAULT_UNBUILD_CONFIG);
148
+ }
149
+
150
+ //#endregion
151
+ exports.DEFAULT_UNBUILD_CONFIG = DEFAULT_UNBUILD_CONFIG;
152
+ exports.resolveOptions = resolveOptions;
153
+ exports.unbuildLoader = unbuildLoader;
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
2
- const require_resolve_options = require('./resolve-options-B2bmiwoX.cjs');
2
+ const require_helpers_resolve_options = require('./helpers/resolve-options.cjs');
3
3
  require('./helpers/index.cjs');
4
4
  let _storm_software_unbuild = require("@storm-software/unbuild");
5
5
  let powerlines_plugin_utils = require("powerlines/plugin-utils");
@@ -19,7 +19,7 @@ const plugin = (options = {}) => {
19
19
  },
20
20
  async build() {
21
21
  this.debug("Starting Unbuild build process...");
22
- const options = require_resolve_options.resolveOptions(this);
22
+ const options = require_helpers_resolve_options.resolveOptions(this);
23
23
  this.debug({
24
24
  meta: { category: "config" },
25
25
  message: `Resolved Unbuild configuration: \n${(0, powerlines_plugin_utils.formatConfig)(options)}`
@@ -30,8 +30,8 @@ const plugin = (options = {}) => {
30
30
  };
31
31
 
32
32
  //#endregion
33
- exports.DEFAULT_UNBUILD_CONFIG = require_resolve_options.DEFAULT_UNBUILD_CONFIG;
33
+ exports.DEFAULT_UNBUILD_CONFIG = require_helpers_resolve_options.DEFAULT_UNBUILD_CONFIG;
34
34
  exports.default = plugin;
35
35
  exports.plugin = plugin;
36
- exports.resolveOptions = require_resolve_options.resolveOptions;
37
- exports.unbuildLoader = require_resolve_options.unbuildLoader;
36
+ exports.resolveOptions = require_helpers_resolve_options.resolveOptions;
37
+ exports.unbuildLoader = require_helpers_resolve_options.unbuildLoader;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-unbuild",
3
- "version": "0.5.590",
3
+ "version": "0.5.592",
4
4
  "private": false,
5
5
  "description": "A package containing a Powerlines plugin to build projects using Unbuild.",
6
6
  "keywords": ["unbuild", "powerlines", "storm-software", "powerlines-plugin"],
@@ -69,22 +69,22 @@
69
69
  "typings": "dist/index.d.mts",
70
70
  "files": ["dist"],
71
71
  "dependencies": {
72
- "@powerlines/core": "^0.48.56",
73
- "@powerlines/unplugin": "^0.0.104",
72
+ "@powerlines/core": "^0.48.58",
73
+ "@powerlines/unplugin": "^0.0.106",
74
74
  "@stryke/helpers": "^0.10.24",
75
75
  "@stryke/path": "^0.29.11",
76
76
  "@stryke/type-checks": "^0.6.17",
77
77
  "defu": "^6.1.7",
78
78
  "esbuild": "^0.27.7",
79
- "powerlines": "^0.47.134",
79
+ "powerlines": "^0.47.136",
80
80
  "unplugin": "^3.0.0"
81
81
  },
82
82
  "devDependencies": {
83
- "@storm-software/unbuild": "^0.57.214",
84
- "@types/node": "^25.9.2"
83
+ "@storm-software/unbuild": "^0.57.230",
84
+ "@types/node": "^25.9.3"
85
85
  },
86
86
  "peerDependencies": { "@storm-software/unbuild": ">=0.57.0" },
87
87
  "peerDependenciesMeta": { "@storm-software/unbuild": { "optional": false } },
88
88
  "publishConfig": { "access": "public" },
89
- "gitHead": "5ef45196d8c43e50c12d7000d1faafd27926cad0"
89
+ "gitHead": "7bc932dbec843729ebecf5a95f0f31ff9d53f4da"
90
90
  }
@@ -1,167 +0,0 @@
1
- //#region \0rolldown/runtime.js
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 __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
- key = keys[i];
12
- if (!__hasOwnProp.call(to, key) && key !== except) {
13
- __defProp(to, key, {
14
- get: ((k) => from[k]).bind(null, key),
15
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
- });
17
- }
18
- }
19
- }
20
- return to;
21
- };
22
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
23
- value: mod,
24
- enumerable: true
25
- }) : target, mod));
26
-
27
- //#endregion
28
- let _powerlines_core_lib_utilities_source_file = require("@powerlines/core/lib/utilities/source-file");
29
- let _powerlines_unplugin_rollup = require("@powerlines/unplugin/rollup");
30
- let _stryke_path = require("@stryke/path");
31
- let _stryke_path_join_paths = require("@stryke/path/join-paths");
32
- let defu = require("defu");
33
- defu = __toESM(defu, 1);
34
- let esbuild = require("esbuild");
35
-
36
- //#region src/helpers/resolve-options.ts
37
- const DEFAULT_UNBUILD_CONFIG = {
38
- dts: true,
39
- clean: false,
40
- includeSrc: false,
41
- treeShaking: true,
42
- splitting: true,
43
- stub: false,
44
- watchOptions: {},
45
- outputPath: "dist",
46
- generatePackageJson: true,
47
- banner: " ",
48
- rollup: {
49
- dts: {},
50
- emitCJS: true,
51
- replace: {},
52
- resolve: {},
53
- json: {},
54
- esbuild: { target: "es2020" },
55
- commonjs: {},
56
- alias: {}
57
- }
58
- };
59
- const unbuildLoader = (context) => {
60
- return async (input, { options }) => {
61
- if (!/\.(?:c|m)?[jt]sx?$/.test(input.path) || /\.d\.[cm]?ts$/.test(input.path)) return;
62
- const output = [];
63
- let contents = await input.getContents();
64
- if (options.declaration && !input.srcPath?.match(/\.d\.[cm]?ts$/)) {
65
- const extension = `.d.${input.srcPath?.match(/(?<=\.)(?:c|m)(?=[jt]s$)/)?.[0] || ""}ts`;
66
- output.push({
67
- contents,
68
- srcPath: input.srcPath,
69
- path: input.path,
70
- extension,
71
- declaration: true
72
- });
73
- }
74
- let transformed = contents;
75
- let result = await context.callHook("transform", {
76
- sequential: true,
77
- order: "pre"
78
- }, transformed, input.path);
79
- if (result) transformed = result;
80
- result = await context.callHook("transform", {
81
- sequential: true,
82
- order: "normal"
83
- }, (0, _powerlines_core_lib_utilities_source_file.getString)(transformed), input.path);
84
- if (result) transformed = result;
85
- result = await context.callHook("transform", {
86
- sequential: true,
87
- order: "post"
88
- }, (0, _powerlines_core_lib_utilities_source_file.getString)(transformed), input.path);
89
- if (result) transformed = result;
90
- if ([
91
- ".ts",
92
- ".mts",
93
- ".cts"
94
- ].includes(input.extension)) contents = await (0, esbuild.transform)((0, _powerlines_core_lib_utilities_source_file.getString)(transformed), {
95
- ...Object.fromEntries(Object.entries(options.esbuild ?? {}).filter(([key]) => key !== "absPaths")),
96
- loader: "ts"
97
- }).then((r) => r.code);
98
- else if ([".tsx", ".jsx"].includes(input.extension)) contents = await (0, esbuild.transform)((0, _powerlines_core_lib_utilities_source_file.getString)(transformed), {
99
- loader: input.extension === ".tsx" ? "tsx" : "jsx",
100
- ...Object.fromEntries(Object.entries(options.esbuild ?? {}).filter(([key]) => key !== "absPaths"))
101
- }).then((r) => r.code);
102
- const isCjs = options.format === "cjs";
103
- if (isCjs) contents = context.resolver.transform({
104
- source: contents,
105
- retainLines: false
106
- }).replace(/^exports.default = /gm, "module.exports = ").replace(/^var _default = exports.default = /gm, "module.exports = ").replace("module.exports = void 0;", "");
107
- let extension = isCjs ? ".js" : ".mjs";
108
- if (options.ext) extension = options.ext.startsWith(".") ? options.ext : `.${options.ext}`;
109
- output.push({
110
- contents,
111
- path: input.path,
112
- extension
113
- });
114
- return output;
115
- };
116
- };
117
- /**
118
- * Extracts the unbuild configuration from the context.
119
- *
120
- * @param context - The build context.
121
- * @returns The resolved unbuild configuration.
122
- */
123
- function resolveOptions(context) {
124
- return (0, defu.default)({ alias: context.alias }, context.config.unbuild ? context.config.unbuild : {}, {
125
- projectName: context.config.name,
126
- name: context.config.name,
127
- orgName: context.config.organization,
128
- sourceRoot: (0, _stryke_path_join_paths.joinPaths)(context.config.root, "src"),
129
- projectRoot: context.config.root,
130
- outputPath: (0, _stryke_path.relativePath)((0, _stryke_path.appendPath)(context.config.root, context.config.cwd), context.config.output.path),
131
- platform: context.config.platform,
132
- external: context.builtins.reduce((ret, id) => {
133
- if (!ret.includes(id)) ret.push(id);
134
- return ret;
135
- }, context.config.resolve.external ?? []),
136
- loaders: [unbuildLoader(context)],
137
- jiti: {
138
- interopDefault: true,
139
- fsCache: (0, _stryke_path_join_paths.joinPaths)(context.envPaths.cache, "jiti"),
140
- moduleCache: true
141
- },
142
- rollup: (0, _powerlines_unplugin_rollup.resolveOptions)(context),
143
- debug: context.config.mode === "development",
144
- minify: context.config.output.minify,
145
- sourcemap: context.config.output.sourceMap
146
- }, DEFAULT_UNBUILD_CONFIG);
147
- }
148
-
149
- //#endregion
150
- Object.defineProperty(exports, 'DEFAULT_UNBUILD_CONFIG', {
151
- enumerable: true,
152
- get: function () {
153
- return DEFAULT_UNBUILD_CONFIG;
154
- }
155
- });
156
- Object.defineProperty(exports, 'resolveOptions', {
157
- enumerable: true,
158
- get: function () {
159
- return resolveOptions;
160
- }
161
- });
162
- Object.defineProperty(exports, 'unbuildLoader', {
163
- enumerable: true,
164
- get: function () {
165
- return unbuildLoader;
166
- }
167
- });