powerlines 0.42.19 → 0.42.21
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 +1 -1
- package/dist/{api-B6Ngiebb.cjs → api-Bt68FE-P.cjs} +84 -30
- package/dist/api-Bt68FE-P.cjs.map +1 -0
- package/dist/{api-BF0tvhyD.mjs → api-R6gI_KWp.mjs} +83 -30
- package/dist/api-R6gI_KWp.mjs.map +1 -0
- package/dist/astro.cjs +2 -4
- package/dist/astro.cjs.map +1 -0
- package/dist/astro.mjs +0 -3
- package/dist/astro.mjs.map +1 -1
- package/dist/config.cjs +2 -0
- package/dist/config.cjs.map +1 -0
- package/dist/constants.cjs +2 -0
- package/dist/constants.cjs.map +1 -0
- package/dist/context/index.cjs +1 -3
- package/dist/context/index.mjs +1 -3
- package/dist/esbuild.cjs +3 -4
- package/dist/esbuild.cjs.map +1 -0
- package/dist/esbuild.mjs +1 -3
- package/dist/esbuild.mjs.map +1 -1
- package/dist/farm.cjs +3 -4
- package/dist/farm.cjs.map +1 -0
- package/dist/farm.mjs +1 -3
- package/dist/farm.mjs.map +1 -1
- package/dist/index.cjs +3 -4
- package/dist/index.cjs.map +1 -0
- package/dist/index.mjs +1 -3
- package/dist/index.mjs.map +1 -1
- package/dist/next.cjs +2 -4
- package/dist/next.cjs.map +1 -0
- package/dist/next.mjs +0 -3
- package/dist/next.mjs.map +1 -1
- package/dist/nuxt.cjs +3 -4
- package/dist/nuxt.cjs.map +1 -0
- package/dist/nuxt.mjs +1 -3
- package/dist/nuxt.mjs.map +1 -1
- package/dist/plugin-utils.cjs +2 -0
- package/dist/plugin-utils.cjs.map +1 -0
- package/dist/rolldown.cjs +3 -4
- package/dist/rolldown.cjs.map +1 -0
- package/dist/rolldown.mjs +1 -3
- package/dist/rolldown.mjs.map +1 -1
- package/dist/rollup.cjs +3 -4
- package/dist/rollup.cjs.map +1 -0
- package/dist/rollup.mjs +1 -3
- package/dist/rollup.mjs.map +1 -1
- package/dist/rspack.cjs +3 -4
- package/dist/rspack.cjs.map +1 -0
- package/dist/rspack.mjs +1 -3
- package/dist/rspack.mjs.map +1 -1
- package/dist/tsconfig-l-UmDdrR.cjs +2 -1
- package/dist/tsconfig-l-UmDdrR.cjs.map +1 -0
- package/dist/tsdown.cjs +2 -4
- package/dist/tsdown.cjs.map +1 -0
- package/dist/tsdown.mjs +0 -3
- package/dist/tsdown.mjs.map +1 -1
- package/dist/tsup.cjs +2 -4
- package/dist/tsup.cjs.map +1 -0
- package/dist/tsup.mjs +0 -3
- package/dist/tsup.mjs.map +1 -1
- package/dist/unloader.cjs +3 -4
- package/dist/unloader.cjs.map +1 -0
- package/dist/unloader.mjs +1 -3
- package/dist/unloader.mjs.map +1 -1
- package/dist/unplugin.cjs +1 -3
- package/dist/unplugin.mjs +1 -3
- package/dist/utils.cjs +2 -0
- package/dist/utils.cjs.map +1 -0
- package/dist/virtual-BvouNuwf.cjs +2 -1
- package/dist/virtual-BvouNuwf.cjs.map +1 -0
- package/dist/vite.cjs +3 -4
- package/dist/vite.cjs.map +1 -0
- package/dist/vite.mjs +1 -3
- package/dist/vite.mjs.map +1 -1
- package/dist/webpack.cjs +3 -4
- package/dist/webpack.cjs.map +1 -0
- package/dist/webpack.mjs +1 -3
- package/dist/webpack.mjs.map +1 -1
- package/package.json +31 -31
- package/dist/api-BF0tvhyD.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ This package is part of the <b>🔌 Powerlines</b> monorepo. Powerlines is the "
|
|
|
27
27
|
|
|
28
28
|
<h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
|
|
29
29
|
|
|
30
|
-
[](https://stormsoftware.com/projects/powerlines) [](http://commitizen.github.io/cz-cli/)  
|
|
31
31
|
|
|
32
32
|
<!-- prettier-ignore-start -->
|
|
33
33
|
<!-- markdownlint-disable -->
|
|
@@ -77,7 +77,7 @@ let unplugin = require("unplugin");
|
|
|
77
77
|
|
|
78
78
|
//#region package.json
|
|
79
79
|
var name = "powerlines";
|
|
80
|
-
var version = "0.42.
|
|
80
|
+
var version = "0.42.20";
|
|
81
81
|
|
|
82
82
|
//#endregion
|
|
83
83
|
//#region src/_internal/helpers/generate-types.ts
|
|
@@ -722,6 +722,10 @@ function normalizeId(id, prefix = "powerlines") {
|
|
|
722
722
|
* @returns The normalized path.
|
|
723
723
|
*/
|
|
724
724
|
function normalizePath(path, builtinsPath, prefix = "powerlines") {
|
|
725
|
+
if (!(0, _stryke_type_checks_is_set_string.isSetString)(path)) {
|
|
726
|
+
if (!(0, _stryke_type_checks_is_string.isString)(path)) throw new Error("Path type must be a string or a file descriptor");
|
|
727
|
+
throw new Error("Path cannot be empty");
|
|
728
|
+
}
|
|
725
729
|
return (0, _stryke_path_is_type.isAbsolutePath)(path) ? path : isValidId(toFilePath(path), prefix) ? normalizeId(toFilePath(path), prefix).replace(new RegExp(`^${prefix.replace(/:$/, "")}:`), builtinsPath) : toFilePath(path);
|
|
726
730
|
}
|
|
727
731
|
/**
|
|
@@ -798,6 +802,10 @@ var VirtualFileSystem = class VirtualFileSystem {
|
|
|
798
802
|
* @returns The normalized path.
|
|
799
803
|
*/
|
|
800
804
|
#normalizePath(path) {
|
|
805
|
+
if (!(0, _stryke_type_checks_is_set_string.isSetString)(path)) {
|
|
806
|
+
if (!(0, _stryke_type_checks_is_string.isString)(path)) throw new Error("Path type must be a string or a file descriptor");
|
|
807
|
+
throw new Error("Path cannot be empty");
|
|
808
|
+
}
|
|
801
809
|
return normalizePath(path.includes("{") || path.includes("}") ? (0, require_plugin_utils.plugin_utils_exports.replacePathTokens)(this.#context, path) : path, this.#context.builtinsPath, this.#context.config.framework);
|
|
802
810
|
}
|
|
803
811
|
/**
|
|
@@ -875,7 +883,7 @@ var VirtualFileSystem = class VirtualFileSystem {
|
|
|
875
883
|
if (result) return result;
|
|
876
884
|
}
|
|
877
885
|
result = this.paths[this.#normalizeId(path)];
|
|
878
|
-
if (!result) {
|
|
886
|
+
if (!(0, _stryke_type_checks_is_set_string.isSetString)(result)) {
|
|
879
887
|
const paths = options.paths ?? [];
|
|
880
888
|
if (importer && !paths.includes(importer)) paths.push(importer);
|
|
881
889
|
if (!importer) {
|
|
@@ -891,15 +899,17 @@ var VirtualFileSystem = class VirtualFileSystem {
|
|
|
891
899
|
break;
|
|
892
900
|
}
|
|
893
901
|
}
|
|
894
|
-
if (!result) try {
|
|
902
|
+
if (!(0, _stryke_type_checks_is_set_string.isSetString)(result)) try {
|
|
895
903
|
result = await (0, _stryke_fs_resolve.resolve)(path, {
|
|
896
904
|
...options,
|
|
897
905
|
paths
|
|
898
906
|
});
|
|
899
907
|
} catch {}
|
|
900
908
|
}
|
|
901
|
-
if (
|
|
902
|
-
|
|
909
|
+
if ((0, _stryke_type_checks_is_set_string.isSetString)(result)) {
|
|
910
|
+
if (!this.#context.config.skipCache) this.resolverCache.set(this.#normalizeId(path), result);
|
|
911
|
+
return result;
|
|
912
|
+
}
|
|
903
913
|
};
|
|
904
914
|
/**
|
|
905
915
|
* A synchronous helper function to resolve modules using the Jiti resolver
|
|
@@ -925,10 +935,10 @@ var VirtualFileSystem = class VirtualFileSystem {
|
|
|
925
935
|
let result;
|
|
926
936
|
if (!this.#context.config.skipCache) {
|
|
927
937
|
result = this.resolverCache.get(this.#normalizeId(path));
|
|
928
|
-
if (result) return result;
|
|
938
|
+
if ((0, _stryke_type_checks_is_set_string.isSetString)(result)) return result;
|
|
929
939
|
}
|
|
930
940
|
result = this.paths[this.#normalizeId(path)];
|
|
931
|
-
if (!result) {
|
|
941
|
+
if (!(0, _stryke_type_checks_is_set_string.isSetString)(result)) {
|
|
932
942
|
const paths = options.paths ?? [];
|
|
933
943
|
if (importer && !paths.includes(importer)) paths.push(importer);
|
|
934
944
|
if (!importer) {
|
|
@@ -944,15 +954,17 @@ var VirtualFileSystem = class VirtualFileSystem {
|
|
|
944
954
|
break;
|
|
945
955
|
}
|
|
946
956
|
}
|
|
947
|
-
if (!result) try {
|
|
957
|
+
if (!(0, _stryke_type_checks_is_set_string.isSetString)(result)) try {
|
|
948
958
|
result = (0, _stryke_fs_resolve.resolveSync)(path, {
|
|
949
959
|
...options,
|
|
950
960
|
paths
|
|
951
961
|
});
|
|
952
962
|
} catch {}
|
|
953
963
|
}
|
|
954
|
-
if (
|
|
955
|
-
|
|
964
|
+
if ((0, _stryke_type_checks_is_set_string.isSetString)(result)) {
|
|
965
|
+
if (!this.#context.config.skipCache) this.resolverCache.set(this.#normalizeId(path), result);
|
|
966
|
+
return result;
|
|
967
|
+
}
|
|
956
968
|
};
|
|
957
969
|
/**
|
|
958
970
|
* Creates a virtual file system (VFS) that is backed up to a Cap'n Proto message buffer.
|
|
@@ -1076,7 +1088,7 @@ var VirtualFileSystem = class VirtualFileSystem {
|
|
|
1076
1088
|
get paths() {
|
|
1077
1089
|
return new Proxy(this.#paths, {
|
|
1078
1090
|
get: (target, prop) => {
|
|
1079
|
-
return target[this.#normalizeId(prop)];
|
|
1091
|
+
return this.#normalizeId(prop) in target ? target[this.#normalizeId(prop)] : void 0;
|
|
1080
1092
|
},
|
|
1081
1093
|
set: (target, prop, value) => {
|
|
1082
1094
|
target[this.#normalizeId(prop)] = value;
|
|
@@ -1179,58 +1191,99 @@ var VirtualFileSystem = class VirtualFileSystem {
|
|
|
1179
1191
|
* Checks if a file is virtual in the virtual file system (VFS).
|
|
1180
1192
|
*
|
|
1181
1193
|
* @param path - The path to the file.
|
|
1194
|
+
* @param importer - An optional path to the importer module.
|
|
1195
|
+
* @param options - Additional resolution options.
|
|
1182
1196
|
* @returns `true` if the file is virtual, otherwise `false`.
|
|
1183
1197
|
*/
|
|
1184
|
-
isVirtual(path) {
|
|
1185
|
-
const resolved = this.resolveSync(path);
|
|
1186
|
-
if (!resolved)
|
|
1198
|
+
isVirtual(path, importer, options) {
|
|
1199
|
+
const resolved = this.resolveSync(path, importer, options);
|
|
1200
|
+
if (!(0, _stryke_type_checks_is_set_string.isSetString)(resolved)) {
|
|
1201
|
+
if ((0, _stryke_type_checks_is_set.isSet)(resolved)) throw new Error(`Resolved path is not a string: ${String(resolved)}`);
|
|
1202
|
+
return false;
|
|
1203
|
+
}
|
|
1187
1204
|
return this.#getStorage(resolved)?.adapter?.preset === "virtual";
|
|
1188
1205
|
}
|
|
1189
1206
|
/**
|
|
1190
1207
|
* Checks if a path is a directory in the virtual file system (VFS).
|
|
1191
1208
|
*
|
|
1192
1209
|
* @param path - The path to check.
|
|
1210
|
+
* @param importer - An optional path to the importer module.
|
|
1211
|
+
* @param options - Additional resolution options.
|
|
1193
1212
|
* @returns `true` if the path is a directory, otherwise `false`.
|
|
1194
1213
|
*/
|
|
1195
|
-
isDirectorySync(path) {
|
|
1196
|
-
const resolved = this.resolveSync(path);
|
|
1197
|
-
if (!resolved)
|
|
1214
|
+
isDirectorySync(path, importer, options) {
|
|
1215
|
+
const resolved = this.resolveSync(path, importer, options);
|
|
1216
|
+
if (!(0, _stryke_type_checks_is_set_string.isSetString)(resolved)) {
|
|
1217
|
+
if ((0, _stryke_type_checks_is_set.isSet)(resolved)) throw new Error(`Resolved path is not a string: ${String(resolved)}`);
|
|
1218
|
+
return false;
|
|
1219
|
+
}
|
|
1198
1220
|
return !!(this.existsSync(resolved) && this.#getStorage(resolved)?.adapter?.isDirectorySync(resolved));
|
|
1199
1221
|
}
|
|
1200
1222
|
/**
|
|
1201
1223
|
* Checks if a path is a directory in the virtual file system (VFS).
|
|
1202
1224
|
*
|
|
1203
1225
|
* @param path - The path to check.
|
|
1226
|
+
* @param importer - An optional path to the importer module.
|
|
1227
|
+
* @param options - Additional resolution options.
|
|
1204
1228
|
* @returns `true` if the path is a directory, otherwise `false`.
|
|
1205
1229
|
*/
|
|
1206
|
-
async isDirectory(path) {
|
|
1207
|
-
const resolved = await this.resolve(path);
|
|
1208
|
-
if (!resolved)
|
|
1230
|
+
async isDirectory(path, importer, options) {
|
|
1231
|
+
const resolved = await this.resolve(path, importer, options);
|
|
1232
|
+
if (!(0, _stryke_type_checks_is_set_string.isSetString)(resolved)) {
|
|
1233
|
+
if ((0, _stryke_type_checks_is_set.isSet)(resolved)) throw new Error(`Resolved path is not a string: ${String(resolved)}`);
|
|
1234
|
+
return false;
|
|
1235
|
+
}
|
|
1209
1236
|
return !!(await this.exists(resolved) && await this.#getStorage(resolved)?.adapter?.isDirectory(resolved));
|
|
1210
1237
|
}
|
|
1211
1238
|
/**
|
|
1212
1239
|
* Checks if a path is a file in the virtual file system (VFS).
|
|
1213
1240
|
*
|
|
1214
1241
|
* @param path - The path to check.
|
|
1242
|
+
* @param importer - An optional path to the importer module.
|
|
1243
|
+
* @param options - Additional resolution options.
|
|
1215
1244
|
* @returns `true` if the path is a file, otherwise `false`.
|
|
1216
1245
|
*/
|
|
1217
|
-
isFileSync(path) {
|
|
1218
|
-
const resolved = this.resolveSync(path);
|
|
1219
|
-
if (!resolved)
|
|
1246
|
+
isFileSync(path, importer, options) {
|
|
1247
|
+
const resolved = this.resolveSync(path, importer, options);
|
|
1248
|
+
if (!(0, _stryke_type_checks_is_set_string.isSetString)(resolved)) {
|
|
1249
|
+
if ((0, _stryke_type_checks_is_set.isSet)(resolved)) throw new Error(`Resolved path is not a string: ${String(resolved)}`);
|
|
1250
|
+
return false;
|
|
1251
|
+
}
|
|
1220
1252
|
return this.#getStorage(resolved)?.adapter?.isFileSync(resolved) ?? false;
|
|
1221
1253
|
}
|
|
1222
1254
|
/**
|
|
1223
1255
|
* Checks if a path is a file in the virtual file system (VFS).
|
|
1224
1256
|
*
|
|
1225
1257
|
* @param path - The path to check.
|
|
1258
|
+
* @param importer - An optional path to the importer module.
|
|
1259
|
+
* @param options - Additional resolution options.
|
|
1226
1260
|
* @returns `true` if the path is a file, otherwise `false`.
|
|
1227
1261
|
*/
|
|
1228
|
-
async isFile(path) {
|
|
1229
|
-
const resolved = await this.resolve(path);
|
|
1230
|
-
if (!resolved)
|
|
1262
|
+
async isFile(path, importer, options) {
|
|
1263
|
+
const resolved = await this.resolve(path, importer, options);
|
|
1264
|
+
if (!(0, _stryke_type_checks_is_set_string.isSetString)(resolved)) {
|
|
1265
|
+
if ((0, _stryke_type_checks_is_set.isSet)(resolved)) throw new Error(`Resolved path is not a string: ${String(resolved)}`);
|
|
1266
|
+
return false;
|
|
1267
|
+
}
|
|
1231
1268
|
return await this.#getStorage(resolved)?.adapter?.isFile(resolved) ?? false;
|
|
1232
1269
|
}
|
|
1233
1270
|
/**
|
|
1271
|
+
* Checks if a file Id must be resolved by the virtual file system (VFS).
|
|
1272
|
+
*
|
|
1273
|
+
* @remarks
|
|
1274
|
+
* Examples of file Ids that would be considered virtual include:
|
|
1275
|
+
* - Ids that start with the framework specific prefix (e.g. `powerlines:`)
|
|
1276
|
+
* - Ids that match a configured alias for virtual modules (returned true from {@link VirtualFileSystemInterface.isVirtual})
|
|
1277
|
+
*
|
|
1278
|
+
* @param path - The path or id of the file.
|
|
1279
|
+
* @param importer - An optional path to the importer module, used for resolving the file path.
|
|
1280
|
+
* @param options - Additional options for resolving the file path.
|
|
1281
|
+
* @returns `true` if the file is virtual, otherwise `false`.
|
|
1282
|
+
*/
|
|
1283
|
+
isResolvableId(path, importer, options) {
|
|
1284
|
+
return path.startsWith(`${this.#context.config.framework}:`) || this.isVirtual(path, importer, options);
|
|
1285
|
+
}
|
|
1286
|
+
/**
|
|
1234
1287
|
* Lists files in a given path.
|
|
1235
1288
|
*
|
|
1236
1289
|
* @param path - The path to list files from.
|
|
@@ -2136,9 +2189,9 @@ var PowerlinesContext = class PowerlinesContext {
|
|
|
2136
2189
|
if (alias) moduleId = alias.replacement;
|
|
2137
2190
|
} else if ((0, _stryke_type_checks_is_set_object.isSetObject)(this.config.resolve.alias) && this.config.resolve.alias[id]) moduleId = this.config.resolve.alias[id];
|
|
2138
2191
|
}
|
|
2139
|
-
if (this.fs.
|
|
2192
|
+
if (this.fs.isResolvableId(moduleId) || importer && this.fs.isResolvableId(importer)) {
|
|
2140
2193
|
let resolvedImporter = importer;
|
|
2141
|
-
if (importer && this.fs.
|
|
2194
|
+
if (importer && this.fs.isResolvableId(importer)) resolvedImporter = await this.fs.resolve(importer, void 0, (0, defu.default)({
|
|
2142
2195
|
conditions: this.config.resolve.conditions,
|
|
2143
2196
|
extensions: this.config.resolve.extensions
|
|
2144
2197
|
}, options));
|
|
@@ -2147,7 +2200,7 @@ var PowerlinesContext = class PowerlinesContext {
|
|
|
2147
2200
|
extensions: this.config.resolve.extensions
|
|
2148
2201
|
}, options));
|
|
2149
2202
|
if (!result) return;
|
|
2150
|
-
const external = Boolean(!(0, bundle_require.match)(moduleId, this.config.resolve.noExternal) && ((0, bundle_require.match)(moduleId, this.config.resolve.external) || moduleId.startsWith("node:") || this.fs.
|
|
2203
|
+
const external = Boolean(!(0, bundle_require.match)(moduleId, this.config.resolve.noExternal) && ((0, bundle_require.match)(moduleId, this.config.resolve.external) || moduleId.startsWith("node:") || this.fs.isResolvableId(moduleId) && this.config.projectType !== "application" || this.config.resolve.skipNodeModulesBundle && !/^[A-Z]:[/\\]|^\.{0,2}\/|^\.{1,2}$/.test(moduleId)));
|
|
2151
2204
|
return {
|
|
2152
2205
|
id: result,
|
|
2153
2206
|
external,
|
|
@@ -3891,4 +3944,5 @@ Object.defineProperty(exports, 'version', {
|
|
|
3891
3944
|
get: function () {
|
|
3892
3945
|
return version;
|
|
3893
3946
|
}
|
|
3894
|
-
});
|
|
3947
|
+
});
|
|
3948
|
+
//# sourceMappingURL=api-Bt68FE-P.cjs.map
|