@storm-software/unbuild 0.34.0 → 0.34.1

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.
@@ -27,28 +27,131 @@ var LogLevelLabel = {
27
27
  };
28
28
 
29
29
  // ../config-tools/src/utilities/correct-paths.ts
30
- import { join } from "node:path";
31
- var removeWindowsDriveLetter = /* @__PURE__ */ __name((osSpecificPath) => {
32
- return osSpecificPath.replace(/^[A-Z]:/, "");
33
- }, "removeWindowsDriveLetter");
34
- var correctPaths = /* @__PURE__ */ __name((path) => {
35
- if (!path) {
36
- return "";
37
- }
38
- if (path.includes("\\")) {
39
- if (!path.toUpperCase().startsWith("C:")) {
40
- path = `C:${path}`;
30
+ var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
31
+ function normalizeWindowsPath(input = "") {
32
+ if (!input) {
33
+ return input;
34
+ }
35
+ return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
36
+ }
37
+ __name(normalizeWindowsPath, "normalizeWindowsPath");
38
+ var _UNC_REGEX = /^[/\\]{2}/;
39
+ var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
40
+ var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
41
+ var correctPaths = /* @__PURE__ */ __name(function(path) {
42
+ if (!path || path.length === 0) {
43
+ return ".";
44
+ }
45
+ path = normalizeWindowsPath(path);
46
+ const isUNCPath = path.match(_UNC_REGEX);
47
+ const isPathAbsolute = isAbsolute(path);
48
+ const trailingSeparator = path[path.length - 1] === "/";
49
+ path = normalizeString(path, !isPathAbsolute);
50
+ if (path.length === 0) {
51
+ if (isPathAbsolute) {
52
+ return "/";
41
53
  }
42
- return path.replaceAll("/", "\\");
54
+ return trailingSeparator ? "./" : ".";
55
+ }
56
+ if (trailingSeparator) {
57
+ path += "/";
58
+ }
59
+ if (_DRIVE_LETTER_RE.test(path)) {
60
+ path += "/";
43
61
  }
44
- return removeWindowsDriveLetter(path).split("\\").join("/");
62
+ if (isUNCPath) {
63
+ if (!isPathAbsolute) {
64
+ return `//./${path}`;
65
+ }
66
+ return `//${path}`;
67
+ }
68
+ return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
45
69
  }, "correctPaths");
46
- var joinPaths = /* @__PURE__ */ __name((...paths) => {
47
- if (!paths || paths.length === 0) {
48
- return "";
70
+ var joinPaths = /* @__PURE__ */ __name(function(...segments) {
71
+ let path = "";
72
+ for (const seg of segments) {
73
+ if (!seg) {
74
+ continue;
75
+ }
76
+ if (path.length > 0) {
77
+ const pathTrailing = path[path.length - 1] === "/";
78
+ const segLeading = seg[0] === "/";
79
+ const both = pathTrailing && segLeading;
80
+ if (both) {
81
+ path += seg.slice(1);
82
+ } else {
83
+ path += pathTrailing || segLeading ? seg : `/${seg}`;
84
+ }
85
+ } else {
86
+ path += seg;
87
+ }
49
88
  }
50
- return correctPaths(join(...paths));
89
+ return correctPaths(path);
51
90
  }, "joinPaths");
91
+ function normalizeString(path, allowAboveRoot) {
92
+ let res = "";
93
+ let lastSegmentLength = 0;
94
+ let lastSlash = -1;
95
+ let dots = 0;
96
+ let char = null;
97
+ for (let index = 0; index <= path.length; ++index) {
98
+ if (index < path.length) {
99
+ char = path[index];
100
+ } else if (char === "/") {
101
+ break;
102
+ } else {
103
+ char = "/";
104
+ }
105
+ if (char === "/") {
106
+ if (lastSlash === index - 1 || dots === 1) {
107
+ } else if (dots === 2) {
108
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
109
+ if (res.length > 2) {
110
+ const lastSlashIndex = res.lastIndexOf("/");
111
+ if (lastSlashIndex === -1) {
112
+ res = "";
113
+ lastSegmentLength = 0;
114
+ } else {
115
+ res = res.slice(0, lastSlashIndex);
116
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
117
+ }
118
+ lastSlash = index;
119
+ dots = 0;
120
+ continue;
121
+ } else if (res.length > 0) {
122
+ res = "";
123
+ lastSegmentLength = 0;
124
+ lastSlash = index;
125
+ dots = 0;
126
+ continue;
127
+ }
128
+ }
129
+ if (allowAboveRoot) {
130
+ res += res.length > 0 ? "/.." : "..";
131
+ lastSegmentLength = 2;
132
+ }
133
+ } else {
134
+ if (res.length > 0) {
135
+ res += `/${path.slice(lastSlash + 1, index)}`;
136
+ } else {
137
+ res = path.slice(lastSlash + 1, index);
138
+ }
139
+ lastSegmentLength = index - lastSlash - 1;
140
+ }
141
+ lastSlash = index;
142
+ dots = 0;
143
+ } else if (char === "." && dots !== -1) {
144
+ ++dots;
145
+ } else {
146
+ dots = -1;
147
+ }
148
+ }
149
+ return res;
150
+ }
151
+ __name(normalizeString, "normalizeString");
152
+ var isAbsolute = /* @__PURE__ */ __name(function(p) {
153
+ return _IS_ABSOLUTE_RE.test(p);
154
+ }, "isAbsolute");
52
155
 
53
156
  // ../config-tools/src/logger/get-log-level.ts
54
157
  var getLogLevel = /* @__PURE__ */ __name((label) => {
@@ -279,20 +382,20 @@ var COLOR_KEYS = [
279
382
  // ../config-tools/src/utilities/get-default-config.ts
280
383
  import { existsSync as existsSync2 } from "node:fs";
281
384
  import { readFile } from "node:fs/promises";
282
- import { join as join3 } from "node:path";
385
+ import { join as join2 } from "node:path";
283
386
 
284
387
  // ../config-tools/src/utilities/find-up.ts
285
388
  import { existsSync } from "node:fs";
286
- import { join as join2 } from "node:path";
389
+ import { join } from "node:path";
287
390
  var MAX_PATH_SEARCH_DEPTH = 30;
288
391
  var depth = 0;
289
392
  function findFolderUp(startPath, endFileNames) {
290
393
  const _startPath = startPath ?? process.cwd();
291
- if (endFileNames.some((endFileName) => existsSync(join2(_startPath, endFileName)))) {
394
+ if (endFileNames.some((endFileName) => existsSync(join(_startPath, endFileName)))) {
292
395
  return _startPath;
293
396
  }
294
397
  if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
295
- const parent = join2(_startPath, "..");
398
+ const parent = join(_startPath, "..");
296
399
  return findFolderUp(parent, endFileNames);
297
400
  }
298
401
  return void 0;
@@ -389,7 +492,7 @@ var getDefaultConfig = /* @__PURE__ */ __name(async (root) => {
389
492
  let namespace = void 0;
390
493
  let repository = void 0;
391
494
  const workspaceRoot = findWorkspaceRoot(root);
392
- if (existsSync2(join3(workspaceRoot, "package.json"))) {
495
+ if (existsSync2(join2(workspaceRoot, "package.json"))) {
393
496
  const file = await readFile(joinPaths(workspaceRoot, "package.json"), "utf8");
394
497
  if (file) {
395
498
  const packageJson = JSON.parse(file);
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkLFUHP3V6cjs = require('./chunk-LFUHP3V6.cjs');
3
+ var _chunk5FQVMM7Icjs = require('./chunk-5FQVMM7I.cjs');
4
4
 
5
5
 
6
6
  var _chunkBGYQAVKQcjs = require('./chunk-BGYQAVKQ.cjs');
@@ -10,7 +10,7 @@ var onErrorPlugin = /* @__PURE__ */ _chunkBGYQAVKQcjs.__name.call(void 0, (optio
10
10
  name: "storm:on-error",
11
11
  buildEnd(error) {
12
12
  if (error) {
13
- _chunkLFUHP3V6cjs.writeError.call(void 0, `The following errors occurred during the build:
13
+ _chunk5FQVMM7Icjs.writeError.call(void 0, `The following errors occurred during the build:
14
14
  ${error ? error.message : "Unknown build error"}
15
15
 
16
16
  `, resolvedOptions.config);
@@ -18,7 +18,7 @@ ${error ? error.message : "Unknown build error"}
18
18
  }
19
19
  },
20
20
  renderError(error) {
21
- _chunkLFUHP3V6cjs.writeError.call(void 0, `The following errors occurred during the build:
21
+ _chunk5FQVMM7Icjs.writeError.call(void 0, `The following errors occurred during the build:
22
22
  ${error ? error.message : "Unknown build error"}
23
23
 
24
24
  `, resolvedOptions.config);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  writeInfo
3
- } from "./chunk-J4VTEQNQ.js";
3
+ } from "./chunk-PLJQK2VX.js";
4
4
  import {
5
5
  __name
6
6
  } from "./chunk-3GQAWCBQ.js";
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  tscPlugin
3
- } from "./chunk-I3ATI525.js";
3
+ } from "./chunk-WI52QJ54.js";
4
4
  import {
5
5
  typeDefinitions
6
6
  } from "./chunk-ESRR2FD2.js";
7
7
  import {
8
8
  analyzePlugin
9
- } from "./chunk-JN2D2LK7.js";
9
+ } from "./chunk-UELS4AUC.js";
10
10
  import {
11
11
  onErrorPlugin
12
- } from "./chunk-6N2XN6DP.js";
12
+ } from "./chunk-HHWS7REN.js";
13
13
  import {
14
14
  __name
15
15
  } from "./chunk-3GQAWCBQ.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  writeTrace
3
- } from "./chunk-J4VTEQNQ.js";
3
+ } from "./chunk-PLJQK2VX.js";
4
4
  import {
5
5
  __name
6
6
  } from "./chunk-3GQAWCBQ.js";
package/dist/clean.cjs CHANGED
@@ -1,10 +1,10 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunkI7SGCUR4cjs = require('./chunk-I7SGCUR4.cjs');
5
- require('./chunk-LFUHP3V6.cjs');
4
+ var _chunk3HGUCQU6cjs = require('./chunk-3HGUCQU6.cjs');
5
+ require('./chunk-5FQVMM7I.cjs');
6
6
  require('./chunk-BGYQAVKQ.cjs');
7
7
 
8
8
 
9
9
 
10
- exports.clean = _chunkI7SGCUR4cjs.clean; exports.cleanDirectories = _chunkI7SGCUR4cjs.cleanDirectories;
10
+ exports.clean = _chunk3HGUCQU6cjs.clean; exports.cleanDirectories = _chunk3HGUCQU6cjs.cleanDirectories;
package/dist/clean.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  clean,
3
3
  cleanDirectories
4
- } from "./chunk-ERYQ4O3N.js";
5
- import "./chunk-J4VTEQNQ.js";
4
+ } from "./chunk-2E6P5U5P.js";
5
+ import "./chunk-PLJQK2VX.js";
6
6
  import "./chunk-3GQAWCBQ.js";
7
7
  export {
8
8
  clean,
package/dist/config.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkHBOCJ3VScjs = require('./chunk-HBOCJ3VS.cjs');
4
- require('./chunk-ZYPPSI2Q.cjs');
3
+ var _chunkDL7OBOWNcjs = require('./chunk-DL7OBOWN.cjs');
4
+ require('./chunk-NGL4NRBA.cjs');
5
5
  require('./chunk-BDHZY5E7.cjs');
6
- require('./chunk-Y3FGYCTG.cjs');
7
- require('./chunk-ELBNF3ZV.cjs');
8
- require('./chunk-LFUHP3V6.cjs');
6
+ require('./chunk-AGJ2KZ3K.cjs');
7
+ require('./chunk-SEWO2Q7T.cjs');
8
+ require('./chunk-5FQVMM7I.cjs');
9
9
  require('./chunk-BGYQAVKQ.cjs');
10
10
 
11
11
 
12
- exports.getDefaultBuildPlugins = _chunkHBOCJ3VScjs.getDefaultBuildPlugins;
12
+ exports.getDefaultBuildPlugins = _chunkDL7OBOWNcjs.getDefaultBuildPlugins;
package/dist/config.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  getDefaultBuildPlugins
3
- } from "./chunk-SRY6IWKG.js";
4
- import "./chunk-I3ATI525.js";
3
+ } from "./chunk-UYR662XD.js";
4
+ import "./chunk-WI52QJ54.js";
5
5
  import "./chunk-ESRR2FD2.js";
6
- import "./chunk-JN2D2LK7.js";
7
- import "./chunk-6N2XN6DP.js";
8
- import "./chunk-J4VTEQNQ.js";
6
+ import "./chunk-UELS4AUC.js";
7
+ import "./chunk-HHWS7REN.js";
8
+ import "./chunk-PLJQK2VX.js";
9
9
  import "./chunk-3GQAWCBQ.js";
10
10
  export {
11
11
  getDefaultBuildPlugins
package/dist/index.cjs CHANGED
@@ -5,23 +5,23 @@
5
5
 
6
6
 
7
7
 
8
- var _chunkFYU6QKHNcjs = require('./chunk-FYU6QKHN.cjs');
8
+ var _chunkLJ5GM5M6cjs = require('./chunk-LJ5GM5M6.cjs');
9
9
 
10
10
 
11
11
 
12
- var _chunkI7SGCUR4cjs = require('./chunk-I7SGCUR4.cjs');
12
+ var _chunk3HGUCQU6cjs = require('./chunk-3HGUCQU6.cjs');
13
13
 
14
14
 
15
- var _chunkHBOCJ3VScjs = require('./chunk-HBOCJ3VS.cjs');
15
+ var _chunkDL7OBOWNcjs = require('./chunk-DL7OBOWN.cjs');
16
16
 
17
17
 
18
18
 
19
- var _chunkZYPPSI2Qcjs = require('./chunk-ZYPPSI2Q.cjs');
19
+ var _chunkNGL4NRBAcjs = require('./chunk-NGL4NRBA.cjs');
20
20
  require('./chunk-BDHZY5E7.cjs');
21
21
  require('./chunk-ORA4UQMU.cjs');
22
- require('./chunk-Y3FGYCTG.cjs');
23
- require('./chunk-ELBNF3ZV.cjs');
24
- require('./chunk-LFUHP3V6.cjs');
22
+ require('./chunk-AGJ2KZ3K.cjs');
23
+ require('./chunk-SEWO2Q7T.cjs');
24
+ require('./chunk-5FQVMM7I.cjs');
25
25
  require('./chunk-BGYQAVKQ.cjs');
26
26
 
27
27
 
@@ -35,4 +35,4 @@ require('./chunk-BGYQAVKQ.cjs');
35
35
 
36
36
 
37
37
 
38
- exports.build = _chunkFYU6QKHNcjs.build; exports.clean = _chunkI7SGCUR4cjs.clean; exports.cleanDirectories = _chunkI7SGCUR4cjs.cleanDirectories; exports.cleanOutputPath = _chunkFYU6QKHNcjs.cleanOutputPath; exports.copyBuildAssets = _chunkFYU6QKHNcjs.copyBuildAssets; exports.createTsCompilerOptions = _chunkZYPPSI2Qcjs.createTsCompilerOptions; exports.executeUnbuild = _chunkFYU6QKHNcjs.executeUnbuild; exports.generatePackageJson = _chunkFYU6QKHNcjs.generatePackageJson; exports.getDefaultBuildPlugins = _chunkHBOCJ3VScjs.getDefaultBuildPlugins; exports.loadConfig = _chunkZYPPSI2Qcjs.loadConfig; exports.resolveOptions = _chunkFYU6QKHNcjs.resolveOptions;
38
+ exports.build = _chunkLJ5GM5M6cjs.build; exports.clean = _chunk3HGUCQU6cjs.clean; exports.cleanDirectories = _chunk3HGUCQU6cjs.cleanDirectories; exports.cleanOutputPath = _chunkLJ5GM5M6cjs.cleanOutputPath; exports.copyBuildAssets = _chunkLJ5GM5M6cjs.copyBuildAssets; exports.createTsCompilerOptions = _chunkNGL4NRBAcjs.createTsCompilerOptions; exports.executeUnbuild = _chunkLJ5GM5M6cjs.executeUnbuild; exports.generatePackageJson = _chunkLJ5GM5M6cjs.generatePackageJson; exports.getDefaultBuildPlugins = _chunkDL7OBOWNcjs.getDefaultBuildPlugins; exports.loadConfig = _chunkNGL4NRBAcjs.loadConfig; exports.resolveOptions = _chunkLJ5GM5M6cjs.resolveOptions;
package/dist/index.js CHANGED
@@ -5,23 +5,23 @@ import {
5
5
  executeUnbuild,
6
6
  generatePackageJson,
7
7
  resolveOptions
8
- } from "./chunk-ZGZI67KX.js";
8
+ } from "./chunk-J7JXWCQS.js";
9
9
  import {
10
10
  clean,
11
11
  cleanDirectories
12
- } from "./chunk-ERYQ4O3N.js";
12
+ } from "./chunk-2E6P5U5P.js";
13
13
  import {
14
14
  getDefaultBuildPlugins
15
- } from "./chunk-SRY6IWKG.js";
15
+ } from "./chunk-UYR662XD.js";
16
16
  import {
17
17
  createTsCompilerOptions,
18
18
  loadConfig
19
- } from "./chunk-I3ATI525.js";
19
+ } from "./chunk-WI52QJ54.js";
20
20
  import "./chunk-ESRR2FD2.js";
21
21
  import "./chunk-OULCUN6I.js";
22
- import "./chunk-JN2D2LK7.js";
23
- import "./chunk-6N2XN6DP.js";
24
- import "./chunk-J4VTEQNQ.js";
22
+ import "./chunk-UELS4AUC.js";
23
+ import "./chunk-HHWS7REN.js";
24
+ import "./chunk-PLJQK2VX.js";
25
25
  import "./chunk-3GQAWCBQ.js";
26
26
  export {
27
27
  build,
@@ -1,8 +1,8 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkY3FGYCTGcjs = require('../chunk-Y3FGYCTG.cjs');
4
- require('../chunk-LFUHP3V6.cjs');
3
+ var _chunkAGJ2KZ3Kcjs = require('../chunk-AGJ2KZ3K.cjs');
4
+ require('../chunk-5FQVMM7I.cjs');
5
5
  require('../chunk-BGYQAVKQ.cjs');
6
6
 
7
7
 
8
- exports.analyzePlugin = _chunkY3FGYCTGcjs.analyzePlugin;
8
+ exports.analyzePlugin = _chunkAGJ2KZ3Kcjs.analyzePlugin;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  analyzePlugin
3
- } from "../chunk-JN2D2LK7.js";
4
- import "../chunk-J4VTEQNQ.js";
3
+ } from "../chunk-UELS4AUC.js";
4
+ import "../chunk-PLJQK2VX.js";
5
5
  import "../chunk-3GQAWCBQ.js";
6
6
  export {
7
7
  analyzePlugin
@@ -1,8 +1,8 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkELBNF3ZVcjs = require('../chunk-ELBNF3ZV.cjs');
4
- require('../chunk-LFUHP3V6.cjs');
3
+ var _chunkSEWO2Q7Tcjs = require('../chunk-SEWO2Q7T.cjs');
4
+ require('../chunk-5FQVMM7I.cjs');
5
5
  require('../chunk-BGYQAVKQ.cjs');
6
6
 
7
7
 
8
- exports.onErrorPlugin = _chunkELBNF3ZVcjs.onErrorPlugin;
8
+ exports.onErrorPlugin = _chunkSEWO2Q7Tcjs.onErrorPlugin;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  onErrorPlugin
3
- } from "../chunk-6N2XN6DP.js";
4
- import "../chunk-J4VTEQNQ.js";
3
+ } from "../chunk-HHWS7REN.js";
4
+ import "../chunk-PLJQK2VX.js";
5
5
  import "../chunk-3GQAWCBQ.js";
6
6
  export {
7
7
  onErrorPlugin
@@ -1,8 +1,8 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkZYPPSI2Qcjs = require('../chunk-ZYPPSI2Q.cjs');
4
- require('../chunk-LFUHP3V6.cjs');
3
+ var _chunkNGL4NRBAcjs = require('../chunk-NGL4NRBA.cjs');
4
+ require('../chunk-5FQVMM7I.cjs');
5
5
  require('../chunk-BGYQAVKQ.cjs');
6
6
 
7
7
 
8
- exports.tscPlugin = _chunkZYPPSI2Qcjs.tscPlugin;
8
+ exports.tscPlugin = _chunkNGL4NRBAcjs.tscPlugin;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  tscPlugin
3
- } from "../chunk-I3ATI525.js";
4
- import "../chunk-J4VTEQNQ.js";
3
+ } from "../chunk-WI52QJ54.js";
4
+ import "../chunk-PLJQK2VX.js";
5
5
  import "../chunk-3GQAWCBQ.js";
6
6
  export {
7
7
  tscPlugin
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/unbuild",
3
- "version": "0.34.0",
3
+ "version": "0.34.1",
4
4
  "type": "module",
5
5
  "description": "A package containing `unbuild` utilities for building Storm Software libraries and applications",
6
6
  "repository": {