@storm-software/unbuild 0.34.0 → 0.34.2

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
- var _path = require('path');
31
- var removeWindowsDriveLetter = /* @__PURE__ */ _chunkBGYQAVKQcjs.__name.call(void 0, (osSpecificPath) => {
32
- return osSpecificPath.replace(/^[A-Z]:/, "");
33
- }, "removeWindowsDriveLetter");
34
- var correctPaths = /* @__PURE__ */ _chunkBGYQAVKQcjs.__name.call(void 0, (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
+ _chunkBGYQAVKQcjs.__name.call(void 0, 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__ */ _chunkBGYQAVKQcjs.__name.call(void 0, 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__ */ _chunkBGYQAVKQcjs.__name.call(void 0, (...paths) => {
47
- if (!paths || paths.length === 0) {
48
- return "";
70
+ var joinPaths = /* @__PURE__ */ _chunkBGYQAVKQcjs.__name.call(void 0, 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(_path.join.call(void 0, ...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
+ _chunkBGYQAVKQcjs.__name.call(void 0, normalizeString, "normalizeString");
152
+ var isAbsolute = /* @__PURE__ */ _chunkBGYQAVKQcjs.__name.call(void 0, 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__ */ _chunkBGYQAVKQcjs.__name.call(void 0, (label) => {
@@ -279,7 +382,7 @@ var COLOR_KEYS = [
279
382
  // ../config-tools/src/utilities/get-default-config.ts
280
383
  var _fs = require('fs');
281
384
  var _promises = require('fs/promises');
282
-
385
+ var _path = require('path');
283
386
 
284
387
  // ../config-tools/src/utilities/find-up.ts
285
388
 
@@ -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');
@@ -25,7 +25,7 @@ var analyzePlugin = /* @__PURE__ */ _chunkBGYQAVKQcjs.__name.call(void 0, (optio
25
25
  renderChunk(source, chunk) {
26
26
  const sourceBytes = formatBytes(source.length);
27
27
  const fileName = chunk.fileName;
28
- _chunkLFUHP3V6cjs.writeInfo.call(void 0, ` - ${fileName} ${sourceBytes}`, resolvedOptions.config);
28
+ _chunk5FQVMM7Icjs.writeInfo.call(void 0, ` - ${fileName} ${sourceBytes}`, resolvedOptions.config);
29
29
  }
30
30
  };
31
31
  }, "analyzePlugin");
@@ -1,25 +1,25 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkZYPPSI2Qcjs = require('./chunk-ZYPPSI2Q.cjs');
3
+ var _chunkNGL4NRBAcjs = require('./chunk-NGL4NRBA.cjs');
4
4
 
5
5
 
6
6
  var _chunkBDHZY5E7cjs = require('./chunk-BDHZY5E7.cjs');
7
7
 
8
8
 
9
- var _chunkY3FGYCTGcjs = require('./chunk-Y3FGYCTG.cjs');
9
+ var _chunkAGJ2KZ3Kcjs = require('./chunk-AGJ2KZ3K.cjs');
10
10
 
11
11
 
12
- var _chunkELBNF3ZVcjs = require('./chunk-ELBNF3ZV.cjs');
12
+ var _chunkSEWO2Q7Tcjs = require('./chunk-SEWO2Q7T.cjs');
13
13
 
14
14
 
15
15
  var _chunkBGYQAVKQcjs = require('./chunk-BGYQAVKQ.cjs');
16
16
 
17
17
  // src/config.ts
18
18
  var getDefaultBuildPlugins = /* @__PURE__ */ _chunkBGYQAVKQcjs.__name.call(void 0, async (options, resolvedOptions) => Promise.all([
19
- _chunkY3FGYCTGcjs.analyzePlugin.call(void 0, options, resolvedOptions),
19
+ _chunkAGJ2KZ3Kcjs.analyzePlugin.call(void 0, options, resolvedOptions),
20
20
  _chunkBDHZY5E7cjs.typeDefinitions.call(void 0, resolvedOptions.projectRoot),
21
- _chunkZYPPSI2Qcjs.tscPlugin.call(void 0, options, resolvedOptions),
22
- _chunkELBNF3ZVcjs.onErrorPlugin.call(void 0, options, resolvedOptions)
21
+ _chunkNGL4NRBAcjs.tscPlugin.call(void 0, options, resolvedOptions),
22
+ _chunkSEWO2Q7Tcjs.onErrorPlugin.call(void 0, options, resolvedOptions)
23
23
  ].map((plugin) => Promise.resolve(plugin))), "getDefaultBuildPlugins");
24
24
 
25
25