powerlines 0.37.24 → 0.37.26
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/dist/api.cjs +2 -2
- package/dist/api.js +1 -1
- package/dist/astro.cjs +4 -4
- package/dist/astro.js +3 -3
- package/dist/{chunk-R6UTSBYI.cjs → chunk-3NXWMXOZ.cjs} +124 -71
- package/dist/{chunk-GYAWFCLJ.js → chunk-6E6WTAVH.js} +3 -3
- package/dist/{chunk-IR4MEQHU.cjs → chunk-6ZRFRVBT.cjs} +5 -5
- package/dist/{chunk-ZUGCJPUV.js → chunk-A6V5BGQY.js} +3 -3
- package/dist/{chunk-F7ZYHEFF.js → chunk-AFQL3PY3.js} +124 -71
- package/dist/{chunk-SZ2ZJ7D6.js → chunk-BWZ6XSL7.js} +3 -3
- package/dist/chunk-M7NM24T5.cjs +12 -0
- package/dist/{chunk-DE5IDYUO.cjs → chunk-MWHTNQVC.cjs} +4 -4
- package/dist/{chunk-APCE4C3B.js → chunk-N2YHQVMW.js} +3 -3
- package/dist/{chunk-K4UKAUQY.cjs → chunk-NCS7P6Z6.cjs} +4 -4
- package/dist/{chunk-4ENEIHKC.js → chunk-QJ3CMPPJ.js} +3 -3
- package/dist/chunk-XGBSXPOD.cjs +12 -0
- package/dist/esbuild.cjs +6 -6
- package/dist/esbuild.js +3 -3
- package/dist/farm.cjs +3 -3
- package/dist/farm.js +2 -2
- package/dist/index.cjs +10 -10
- package/dist/index.js +2 -2
- package/dist/lib/{chunk-UJ5TICQ2.js → chunk-2KN6LNJA.js} +3 -3
- package/dist/lib/{chunk-UJ5TICQ2.js.map → chunk-2KN6LNJA.js.map} +1 -1
- package/dist/lib/{chunk-NE26SC53.js → chunk-2LZ2KCSP.js} +3 -3
- package/dist/lib/{chunk-NE26SC53.js.map → chunk-2LZ2KCSP.js.map} +1 -1
- package/dist/lib/{chunk-O33UNFHZ.cjs → chunk-2PXKVOOG.cjs} +19 -19
- package/dist/lib/{chunk-O33UNFHZ.cjs.map → chunk-2PXKVOOG.cjs.map} +1 -1
- package/dist/lib/{chunk-PJQR4XNF.cjs → chunk-3L7QXHBF.cjs} +130 -77
- package/dist/lib/chunk-3L7QXHBF.cjs.map +1 -0
- package/dist/lib/{chunk-XUWN6WZH.cjs → chunk-47XLO7EU.cjs} +6 -6
- package/dist/lib/{chunk-XUWN6WZH.cjs.map → chunk-47XLO7EU.cjs.map} +1 -1
- package/dist/lib/{chunk-TCM3STGS.js → chunk-4EEKHN44.js} +4 -4
- package/dist/lib/{chunk-TCM3STGS.js.map → chunk-4EEKHN44.js.map} +1 -1
- package/dist/lib/{chunk-KFT5AKNL.js → chunk-5WMECB6D.js} +4 -4
- package/dist/lib/{chunk-KFT5AKNL.js.map → chunk-5WMECB6D.js.map} +1 -1
- package/dist/lib/{chunk-UUBS5Z5H.js → chunk-EHK6LKBR.js} +125 -72
- package/dist/lib/chunk-EHK6LKBR.js.map +1 -0
- package/dist/lib/{chunk-YTT66LRY.js → chunk-F7TAZWC7.js} +3 -3
- package/dist/lib/{chunk-YTT66LRY.js.map → chunk-F7TAZWC7.js.map} +1 -1
- package/dist/lib/{chunk-YYG2XJQN.cjs → chunk-J4TJDOSP.cjs} +4 -4
- package/dist/lib/chunk-J4TJDOSP.cjs.map +1 -0
- package/dist/lib/{chunk-MEZZ76LR.cjs → chunk-LENVCNR2.cjs} +5 -5
- package/dist/lib/{chunk-MEZZ76LR.cjs.map → chunk-LENVCNR2.cjs.map} +1 -1
- package/dist/lib/{chunk-EBBGE5FN.js → chunk-LGM65FVK.js} +4 -4
- package/dist/lib/chunk-LGM65FVK.js.map +1 -0
- package/dist/lib/{chunk-RI3JLIUH.cjs → chunk-XKEHVYDR.cjs} +7 -7
- package/dist/lib/{chunk-RI3JLIUH.cjs.map → chunk-XKEHVYDR.cjs.map} +1 -1
- package/dist/lib/{chunk-JFA7OW2I.cjs → chunk-YR7H6YZZ.cjs} +16 -16
- package/dist/lib/{chunk-JFA7OW2I.cjs.map → chunk-YR7H6YZZ.cjs.map} +1 -1
- package/dist/lib/contexts/api-context.cjs +7 -7
- package/dist/lib/contexts/api-context.js +6 -6
- package/dist/lib/contexts/context.cjs +5 -5
- package/dist/lib/contexts/context.js +4 -4
- package/dist/lib/contexts/environment-context.cjs +6 -6
- package/dist/lib/contexts/environment-context.js +5 -5
- package/dist/lib/contexts/index.cjs +9 -9
- package/dist/lib/contexts/index.js +6 -6
- package/dist/lib/fs/helpers.cjs +12 -12
- package/dist/lib/fs/helpers.d.cts +1 -1
- package/dist/lib/fs/helpers.d.ts +1 -1
- package/dist/lib/fs/helpers.js +1 -1
- package/dist/lib/fs/index.cjs +4 -4
- package/dist/lib/fs/index.js +3 -3
- package/dist/lib/fs/storage/file-system.cjs +3 -3
- package/dist/lib/fs/storage/file-system.js +2 -2
- package/dist/lib/fs/storage/index.cjs +3 -3
- package/dist/lib/fs/storage/index.js +2 -2
- package/dist/lib/fs/vfs.cjs +4 -4
- package/dist/lib/fs/vfs.js +3 -3
- package/dist/lib/index.cjs +12 -12
- package/dist/lib/index.js +7 -7
- package/dist/lib/unplugin/factory.cjs +8 -8
- package/dist/lib/unplugin/factory.js +7 -7
- package/dist/lib/unplugin/index.cjs +8 -8
- package/dist/lib/unplugin/index.js +7 -7
- package/dist/next.cjs +4 -4
- package/dist/next.js +3 -3
- package/dist/nuxt.cjs +7 -7
- package/dist/nuxt.js +5 -5
- package/dist/rolldown.cjs +6 -6
- package/dist/rolldown.js +3 -3
- package/dist/rollup.cjs +3 -3
- package/dist/rollup.js +2 -2
- package/dist/rspack.cjs +3 -3
- package/dist/rspack.js +2 -2
- package/dist/tsdown.cjs +4 -4
- package/dist/tsdown.js +3 -3
- package/dist/tsup.cjs +4 -4
- package/dist/tsup.js +3 -3
- package/dist/unloader.cjs +3 -3
- package/dist/unloader.js +2 -2
- package/dist/unplugin.cjs +8 -8
- package/dist/unplugin.js +4 -4
- package/dist/vite.cjs +6 -6
- package/dist/vite.js +3 -3
- package/dist/webpack.cjs +6 -6
- package/dist/webpack.js +3 -3
- package/package.json +8 -8
- package/dist/chunk-4IXGEWKB.cjs +0 -12
- package/dist/chunk-SPHARZBB.cjs +0 -12
- package/dist/lib/chunk-EBBGE5FN.js.map +0 -1
- package/dist/lib/chunk-PJQR4XNF.cjs.map +0 -1
- package/dist/lib/chunk-UUBS5Z5H.js.map +0 -1
- package/dist/lib/chunk-YYG2XJQN.cjs.map +0 -1
|
@@ -2,9 +2,9 @@ import { __name } from './chunk-7QVYU63E.js';
|
|
|
2
2
|
import { toArray } from '@stryke/convert/to-array';
|
|
3
3
|
import { getUnique } from '@stryke/helpers/get-unique';
|
|
4
4
|
import { correctPath } from '@stryke/path/correct-path';
|
|
5
|
-
import { findFileDotExtensionSafe } from '@stryke/path/file-path-fns';
|
|
6
5
|
import { isAbsolutePath } from '@stryke/path/is-type';
|
|
7
6
|
import { joinPaths } from '@stryke/path/join';
|
|
7
|
+
import { replaceExtension } from '@stryke/path/replace';
|
|
8
8
|
import { slash } from '@stryke/path/slash';
|
|
9
9
|
import { isError } from '@stryke/type-checks/is-error';
|
|
10
10
|
import { isSetObject } from '@stryke/type-checks/is-set-object';
|
|
@@ -31,7 +31,7 @@ function isValidId(id, prefix = "powerlines") {
|
|
|
31
31
|
}
|
|
32
32
|
__name(isValidId, "isValidId");
|
|
33
33
|
function normalizeId(id, prefix = "powerlines") {
|
|
34
|
-
return
|
|
34
|
+
return replaceExtension(toFilePath(id)).replace(/^\\0/, "").replace(/^powerlines:/, "").replace(new RegExp(`^${prefix.replace(/:$/, "")}:`), "");
|
|
35
35
|
}
|
|
36
36
|
__name(normalizeId, "normalizeId");
|
|
37
37
|
function normalizePath(path, builtinsPath, prefix = "powerlines") {
|
|
@@ -70,5 +70,5 @@ function normalizeGlobPatterns(workspaceRoot, patterns) {
|
|
|
70
70
|
__name(normalizeGlobPatterns, "normalizeGlobPatterns");
|
|
71
71
|
|
|
72
72
|
export { filterKeyByBase, ignoreExists, ignoreNotfound, isFileError, isValidId, normalizeBaseKey, normalizeGlobPatterns, normalizeId, normalizeKey, normalizePath, toFilePath };
|
|
73
|
-
//# sourceMappingURL=chunk-
|
|
74
|
-
//# sourceMappingURL=chunk-
|
|
73
|
+
//# sourceMappingURL=chunk-LGM65FVK.js.map
|
|
74
|
+
//# sourceMappingURL=chunk-LGM65FVK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/fs/helpers.ts"],"names":["isFileError","err","isError","code","ignoreNotfound","ignoreExists","toFilePath","path","correctPath","slash","toString","replace","isValidId","id","prefix","startsWith","normalizeId","replaceExtension","RegExp","normalizePath","builtinsPath","isAbsolutePath","normalizeKey","key","sep","normalizeBaseKey","base","filterKeyByBase","length","normalizeGlobPatterns","workspaceRoot","patterns","getUnique","toArray","map","pattern","isSetObject","isSetString","input","glob","joinPaths","undefined","filter"],"mappings":";;;;;;;;;;;;AAqCO,SAASA,YAAYC,GAAAA,EAAQ;AAClC,EAAA,OAAOC,OAAAA,CAAQD,GAAAA,CAAAA,IAAQ,MAAA,IAAUA,OAAOA,GAAAA,CAAIE,IAAAA;AAC9C;AAFgBH,MAAAA,CAAAA,WAAAA,EAAAA,aAAAA,CAAAA;AAUT,SAASI,eAAeH,GAAAA,EAAQ;AACrC,EAAA,OACED,WAAAA,CAAYC,GAAAA,CAAAA,KACXA,GAAAA,CAAIE,SAAS,QAAA,IAAYF,GAAAA,CAAIE,IAAAA,KAAS,QAAA,GAAW,IAAA,GAAOF,GAAAA,CAAAA;AAE7D;AALgBG,MAAAA,CAAAA,cAAAA,EAAAA,gBAAAA,CAAAA;AAaT,SAASC,aAAaJ,GAAAA,EAAQ;AACnC,EAAA,OAAOD,YAAYC,GAAAA,CAAAA,IAAQA,GAAAA,CAAIE,IAAAA,KAAS,WAAW,IAAA,GAAOF,GAAAA;AAC5D;AAFgBI,MAAAA,CAAAA,YAAAA,EAAAA,cAAAA,CAAAA;AAIT,SAASC,WAAWC,IAAAA,EAA0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,CAAAA,CACLG,GAAAA,CAAIC,CAAAA,OAAAA,KAAAA;AACH,IAAA,IACEC,WAAAA,CAAYD,OAAAA,CAAAA,KACXE,WAAAA,CAAYF,OAAAA,CAAQG,KAAK,CAAA,IAAKD,WAAAA,CAAYF,OAAAA,CAAQI,IAAI,CAAA,CAAA,EACvD;AACA,MAAA,OAAOC,UACLL,OAAAA,CAAQG,KAAAA,IAASR,aAAAA,EACjBK,OAAAA,CAAQI,QAAQ,MAAA,CAAA;IAEpB,CAAA,MAAA,IAAW,CAACF,WAAAA,CAAYF,OAAAA,CAAAA,EAAU;AAChC,MAAA,OAAOM,MAAAA;AACT,IAAA;AAEA,IAAA,OAAON,OAAAA;EACT,CAAA,CAAA,CACCO,MAAAA,CAAOL,WAAAA,CAAAA,CAAAA;AAEd;AA1BgBR,MAAAA,CAAAA,qBAAAA,EAAAA,uBAAAA,CAAAA","file":"chunk-LGM65FVK.js","sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { correctPath } from \"@stryke/path/correct-path\";\nimport { isAbsolutePath } from \"@stryke/path/is-type\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { replaceExtension } from \"@stryke/path/replace\";\nimport { slash } from \"@stryke/path/slash\";\nimport { isError } from \"@stryke/type-checks/is-error\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { AssetGlob } from \"@stryke/types/file\";\nimport { PathOrFileDescriptor } from \"node:fs\";\n\n/**\n * Checks if an error is a file system error.\n *\n * @param err - The error to check.\n * @returns `true` if the error is a file system error, otherwise `false`.\n */\nexport function isFileError(err: any) {\n return isError(err) && \"code\" in err && err.code;\n}\n\n/**\n * Ignores file not found errors.\n *\n * @param err - The error to check.\n * @returns `null` if the error is a file not found error, otherwise returns the error.\n */\nexport function ignoreNotfound(err: any) {\n return (\n isFileError(err) &&\n (err.code === \"ENOENT\" || err.code === \"EISDIR\" ? null : err)\n );\n}\n\n/**\n * Ignores file exists errors.\n *\n * @param err - The error to check.\n * @returns `null` if the error is a file exists error, otherwise returns the error.\n */\nexport function ignoreExists(err: any) {\n return isFileError(err) && err.code === \"EEXIST\" ? null : err;\n}\n\nexport function toFilePath(path: PathOrFileDescriptor): string {\n return correctPath(slash(path?.toString() || \".\").replace(/^file:\\/\\//, \"\"));\n}\n\n/**\n * Checks if a given file id is valid based on the specified prefix.\n *\n * @param id - The file ID to check.\n * @param prefix - The prefix to use for built-in files. Default is \"powerlines\".\n * @returns `true` if the file ID is valid, otherwise `false`.\n */\nexport function isValidId(id: string, prefix = \"powerlines\"): boolean {\n return id.replace(/^\\\\0/, \"\").startsWith(`${prefix.replace(/:$/, \"\")}`);\n}\n\n/**\n * Formats a file id by removing the file extension and prepended runtime prefix.\n *\n * @param id - The file ID to format.\n * @param prefix - The prefix to use for built-in files. Default is \"powerlines\".\n * @returns The formatted file ID.\n */\nexport function normalizeId(id: string, prefix = \"powerlines\"): string {\n // return `${prefix.replace(/:$/, \"\")}:${toFilePath(id)\n // .replace(new RegExp(`^${prefix.replace(/:$/, \"\")}:`), \"\")\n // .replace(/^\\\\0/, \"\")\n // .replace(findFileDotExtensionSafe(toFilePath(id)), \"\")}`;\n\n return replaceExtension(toFilePath(id))\n .replace(/^\\\\0/, \"\")\n .replace(/^powerlines:/, \"\")\n .replace(new RegExp(`^${prefix.replace(/:$/, \"\")}:`), \"\");\n}\n\n/**\n * Normalizes a given path by resolving it against the project root, workspace root, and built-ins path.\n *\n * @param path - The path to normalize.\n * @param builtinsPath - The path to built-in files.\n * @param prefix - The prefix to use for built-in files. Default is \"powerlines\".\n * @returns The normalized path.\n */\nexport function normalizePath(\n path: string,\n builtinsPath: string,\n prefix = \"powerlines\"\n): string {\n return isAbsolutePath(path)\n ? path\n : isValidId(toFilePath(path), prefix)\n ? normalizeId(toFilePath(path), prefix).replace(\n new RegExp(`^${prefix.replace(/:$/, \"\")}:`),\n builtinsPath\n )\n : toFilePath(path);\n}\n\n/**\n * Normalizes a storage key by replacing all path separators with the specified separator.\n *\n * @param key - The storage key to normalize.\n * @param sep - The separator to use for normalization. Default is \":\".\n * @returns The normalized storage key.\n */\nexport function normalizeKey(\n key: string | undefined,\n sep: \":\" | \"/\" = \":\"\n): string {\n if (!key) {\n return \"\";\n }\n return key.replace(/[:/\\\\]/g, sep).replace(/^[:/\\\\]|[:/\\\\]$/g, \"\");\n}\n\n/**\n * Normalizes the base key for storage operations.\n *\n * @param base - The base key to normalize.\n * @returns The normalized base key with a trailing colon if not empty.\n */\nexport function normalizeBaseKey(base?: string) {\n base = normalizeKey(base);\n return base ? `${base}:` : \"\";\n}\n\n/**\n * Filters a storage key based on the specified base path.\n *\n * @param key - The storage key to filter.\n * @param base - The base path to filter by.\n * @returns `true` if the key matches the base path criteria, otherwise `false`.\n */\nexport function filterKeyByBase(\n key: string,\n base: string | undefined\n): boolean {\n if (base) {\n return key.startsWith(base) && key[key.length - 1] !== \"$\";\n }\n\n return key[key.length - 1] !== \"$\";\n}\n\n/**\n * Normalizes glob patterns by resolving them against the workspace root.\n *\n * @param workspaceRoot - The root directory of the workspace.\n * @param patterns - The glob patterns to normalize.\n * @returns An array of normalized glob patterns.\n */\nexport function normalizeGlobPatterns(\n workspaceRoot: string,\n patterns:\n | string\n | Omit<AssetGlob, \"output\">\n | (string | Omit<AssetGlob, \"output\">)[]\n): string[] {\n return getUnique(\n toArray(patterns)\n .map(pattern => {\n if (\n isSetObject(pattern) &&\n (isSetString(pattern.input) || isSetString(pattern.glob))\n ) {\n return joinPaths(\n pattern.input || workspaceRoot,\n pattern.glob || \"**/*\"\n );\n } else if (!isSetString(pattern)) {\n return undefined;\n }\n\n return pattern;\n })\n .filter(isSetString)\n );\n}\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunk4LHV7MWI_cjs = require('./chunk-4LHV7MWI.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkJ4TJDOSP_cjs = require('./chunk-J4TJDOSP.cjs');
|
|
5
5
|
var chunkPK6SKIKE_cjs = require('./chunk-PK6SKIKE.cjs');
|
|
6
6
|
var exists = require('@stryke/fs/exists');
|
|
7
7
|
var helpers = require('@stryke/fs/helpers');
|
|
@@ -103,7 +103,7 @@ var FileSystemStorageAdapter = class extends chunk4LHV7MWI_cjs.BaseStorageAdapte
|
|
|
103
103
|
try {
|
|
104
104
|
return fs.unlinkSync(this.resolve(key));
|
|
105
105
|
} catch (err) {
|
|
106
|
-
return
|
|
106
|
+
return chunkJ4TJDOSP_cjs.ignoreNotfound(err);
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
}
|
|
@@ -114,7 +114,7 @@ var FileSystemStorageAdapter = class extends chunk4LHV7MWI_cjs.BaseStorageAdapte
|
|
|
114
114
|
*/
|
|
115
115
|
async remove(key) {
|
|
116
116
|
if (!this.options.isReadOnly) {
|
|
117
|
-
return promises.unlink(this.resolve(key)).catch(
|
|
117
|
+
return promises.unlink(this.resolve(key)).catch(chunkJ4TJDOSP_cjs.ignoreNotfound);
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
/**
|
|
@@ -145,7 +145,7 @@ var FileSystemStorageAdapter = class extends chunk4LHV7MWI_cjs.BaseStorageAdapte
|
|
|
145
145
|
ignore: this.options.ignore
|
|
146
146
|
});
|
|
147
147
|
} catch (err) {
|
|
148
|
-
return
|
|
148
|
+
return chunkJ4TJDOSP_cjs.ignoreNotfound(err) ?? [];
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
/**
|
|
@@ -157,7 +157,7 @@ var FileSystemStorageAdapter = class extends chunk4LHV7MWI_cjs.BaseStorageAdapte
|
|
|
157
157
|
async list(base) {
|
|
158
158
|
return listFiles.listFiles(this.resolve(base), {
|
|
159
159
|
ignore: this.options.ignore
|
|
160
|
-
}).catch(
|
|
160
|
+
}).catch(chunkJ4TJDOSP_cjs.ignoreNotfound).then((r) => r || []);
|
|
161
161
|
}
|
|
162
162
|
/**
|
|
163
163
|
* Synchronously checks if the given key is a directory.
|
|
@@ -180,5 +180,5 @@ var FileSystemStorageAdapter = class extends chunk4LHV7MWI_cjs.BaseStorageAdapte
|
|
|
180
180
|
};
|
|
181
181
|
|
|
182
182
|
exports.FileSystemStorageAdapter = FileSystemStorageAdapter;
|
|
183
|
-
//# sourceMappingURL=chunk-
|
|
184
|
-
//# sourceMappingURL=chunk-
|
|
183
|
+
//# sourceMappingURL=chunk-XKEHVYDR.cjs.map
|
|
184
|
+
//# sourceMappingURL=chunk-XKEHVYDR.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/fs/storage/file-system.ts"],"names":["FileSystemStorageAdapter","BaseStorageAdapter","name","preset","options","existsSync","key","resolve","exists","getSync","readFileSync","get","readFile","setSync","value","isReadOnly","writeFileSync","set","writeFile","removeSync","unlinkSync","err","ignoreNotfound","remove","unlink","catch","mkdirSync","dirPath","createDirectorySync","mkdir","createDirectory","listSync","base","listFilesSync","ignore","list","listFiles","then","r","isDirectorySync","isDirectory","isFileSync","isFile"],"mappings":";;;;;;;;;;;;;;AAmCO,IAAMA,wBAAAA,GAAN,cAAuCC,oCAAAA,CAAAA;EAnC9C;;;;;;EAuCSC,IAAAA,GAAO,aAAA;;;;;;;EAQWC,MAAAA,GAAS,IAAA;;;;;;AAOlC,EAAA,WAAA,CAAmBC,OAAAA,EAAiC;A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ACnCE,MAAAA,MAAAA,EAAQ,KAAK9B,OAAAA,CAAQ8B;KACvB,CAAA,CACGT,MAAMH,gCAAAA,CAAAA,CACNe,KAAKC,CAAAA,CAAAA,KAAKA,CAAAA,IAAK,EAAE,CAAA;AACtB,EAAA;;;;;;;AAQgBC,EAAAA,eAAAA,CAAgBjC,GAAAA,EAAsB;AACpD,IAAA,OAAOkC,kBAAAA,CAAY,IAAA,CAAKjC,OAAAA,CAAQD,GAAAA,CAAAA,CAAAA;AAClC,EAAA;;;;;;;AAQgBmC,EAAAA,UAAAA,CAAWnC,GAAAA,EAAsB;AAC/C,IAAA,OAAO,CAACoC,aAAAA,CAAO,IAAA,CAAKnC,OAAAA,CAAQD,GAAAA,CAAAA,CAAAA;AAC9B,EAAA;AACF","file":"chunk-RI3JLIUH.cjs","sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { exists, existsSync } from \"@stryke/fs/exists\";\nimport { createDirectory, createDirectorySync } from \"@stryke/fs/helpers\";\nimport { isDirectory, isFile } from \"@stryke/fs/is-file\";\nimport { listFiles, listFilesSync } from \"@stryke/fs/list-files\";\nimport { readFile, readFileSync } from \"@stryke/fs/read-file\";\nimport { writeFile, writeFileSync } from \"@stryke/fs/write-file\";\nimport { unlinkSync } from \"node:fs\";\nimport { unlink } from \"node:fs/promises\";\nimport { ignoreNotfound } from \"../helpers\";\nimport { BaseStorageAdapter, StorageAdapterOptions } from \"./base\";\n\nexport type SetSyncOptions = Parameters<typeof writeFileSync>[2];\nexport type SetOptions = Parameters<typeof writeFile>[2];\n\n/**\n * File system storage adapter implementation.\n */\nexport class FileSystemStorageAdapter extends BaseStorageAdapter {\n /**\n * A name identifying the storage adapter type.\n */\n public name = \"file-system\";\n\n /**\n * The storage preset for the adapter.\n *\n * @remarks\n * This can be used as an alternate way to identify the type of storage being used.\n */\n public override readonly preset = \"fs\";\n\n /**\n * Constructor for the FileSystemStorageAdapter.\n *\n * @param options - Configuration options for the storage adapter.\n */\n public constructor(options?: StorageAdapterOptions) {\n super(options);\n }\n\n /**\n * Synchronously checks if a key exists in the storage.\n *\n * @param key - The key to check for existence.\n * @returns Returns `true` if the key exists, otherwise `false`.\n */\n public existsSync(key: string): boolean {\n return existsSync(this.resolve(key));\n }\n\n /**\n * Asynchronously checks if a key exists in the storage.\n *\n * @param key - The key to check for existence.\n * @returns A promise that resolves to `true` if the key exists, otherwise `false`.\n */\n public override async exists(key: string): Promise<boolean> {\n return exists(this.resolve(key));\n }\n\n /**\n * Synchronously retrieves the value associated with a given key.\n *\n * @param key - The key whose value is to be retrieved.\n * @returns The value associated with the key, or `null` if the key does not exist.\n */\n public getSync(key: string): string | null {\n return readFileSync(this.resolve(key));\n }\n\n /**\n * Asynchronously retrieves the value associated with a given key.\n *\n * @param key - The key whose value is to be retrieved.\n * @returns A promise that resolves to the value associated with the key, or `null` if the key does not exist.\n */\n public override async get(key: string): Promise<string | null> {\n return readFile(this.resolve(key));\n }\n\n /**\n * Synchronously sets the value for a given key.\n *\n * @param key - The key to set the value for.\n * @param value - The value to set.\n */\n public setSync(key: string, value: string) {\n if (!this.options.isReadOnly) {\n return writeFileSync(this.resolve(key), value);\n }\n }\n\n /**\n * Asynchronously sets the value for a given key.\n *\n * @param key - The key to set the value for.\n * @param value - The value to set.\n */\n public override async set(key: string, value: string): Promise<void> {\n if (!this.options.isReadOnly) {\n return writeFile(this.resolve(key), value);\n }\n }\n\n /**\n * Synchronously removes a key from the storage.\n *\n * @param key - The key to remove.\n */\n public removeSync(key: string) {\n if (!this.options.isReadOnly) {\n try {\n return unlinkSync(this.resolve(key));\n } catch (err) {\n return ignoreNotfound(err);\n }\n }\n }\n\n /**\n * Asynchronously removes a key from the storage.\n *\n * @param key - The key to remove.\n */\n public override async remove(key: string): Promise<void> {\n if (!this.options.isReadOnly) {\n return unlink(this.resolve(key)).catch(ignoreNotfound);\n }\n }\n\n /**\n * Synchronously creates a directory at the specified path.\n *\n * @param dirPath - The path of the directory to create.\n */\n public override mkdirSync(dirPath: string) {\n createDirectorySync(this.resolve(dirPath));\n }\n\n /**\n * Creates a directory at the specified path.\n *\n * @param dirPath - The path of the directory to create.\n */\n public override async mkdir(dirPath: string): Promise<void> {\n await createDirectory(this.resolve(dirPath));\n }\n\n /**\n * Lists all keys under a given base path synchronously.\n *\n * @param base - The base path to list keys from.\n * @returns An array of keys under the specified base path.\n */\n public listSync(base?: string): string[] {\n try {\n return listFilesSync(this.resolve(base), {\n ignore: this.options.ignore\n });\n } catch (err) {\n return ignoreNotfound(err) ?? [];\n }\n }\n\n /**\n * Asynchronously lists all keys under a given base path.\n *\n * @param base - The base path to list keys from.\n * @returns A promise that resolves to an array of keys under the specified base path.\n */\n public override async list(base?: string): Promise<string[]> {\n return listFiles(this.resolve(base), {\n ignore: this.options.ignore\n })\n .catch(ignoreNotfound)\n .then(r => r || []);\n }\n\n /**\n * Synchronously checks if the given key is a directory.\n *\n * @param key - The key to check.\n * @returns `true` if the key is a directory, otherwise `false`.\n */\n public override isDirectorySync(key: string): boolean {\n return isDirectory(this.resolve(key));\n }\n\n /**\n * Synchronously checks if the given key is a file.\n *\n * @param key - The key to check.\n * @returns `true` if the key is a file, otherwise `false`.\n */\n public override isFileSync(key: string): boolean {\n return !isFile(this.resolve(key));\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/lib/fs/storage/file-system.ts"],"names":["FileSystemStorageAdapter","BaseStorageAdapter","name","preset","options","existsSync","key","resolve","exists","getSync","readFileSync","get","readFile","setSync","value","isReadOnly","writeFileSync","set","writeFile","removeSync","unlinkSync","err","ignoreNotfound","remove","unlink","catch","mkdirSync","dirPath","createDirectorySync","mkdir","createDirectory","listSync","base","listFilesSync","ignore","list","listFiles","then","r","isDirectorySync","isDirectory","isFileSync","isFile"],"mappings":";;;;;;;;;;;;;;AAmCO,IAAMA,wBAAAA,GAAN,cAAuCC,oCAAAA,CAAAA;EAnC9C;;;;;;EAuCSC,IAAAA,GAAO,aAAA;;;;;;;EAQWC,MAAAA,GAAS,IAAA;;;;;;AAOlC,EAAA,WAAA,CAAmBC,OAAAA,EAAiC;AAClD,IAAA,KAAA,CAAMA,OAAAA,CAAAA;AACR,EAAA;;;;;;;AAQOC,EAAAA,UAAAA,CAAWC,GAAAA,EAAsB;AACtC,IAAA,OAAOD,iBAAAA,CAAW,IAAA,CAAKE,OAAAA,CAAQD,GAAAA,CAAAA,CAAAA;AACjC,EAAA;;;;;;;AAQA,EAAA,MAAsBE,OAAOF,GAAAA,EAA+B;AAC1D,IAAA,OAAOE,aAAAA,CAAO,IAAA,CAAKD,OAAAA,CAAQD,GAAAA,CAAAA,CAAAA;AAC7B,EAAA;;;;;;;AAQOG,EAAAA,OAAAA,CAAQH,GAAAA,EAA4B;AACzC,IAAA,OAAOI,qBAAAA,CAAa,IAAA,CAAKH,OAAAA,CAAQD,GAAAA,CAAAA,CAAAA;AACnC,EAAA;;;;;;;AAQA,EAAA,MAAsBK,IAAIL,GAAAA,EAAqC;AAC7D,IAAA,OAAOM,iBAAAA,CAAS,IAAA,CAAKL,OAAAA,CAAQD,GAAAA,CAAAA,CAAAA;AAC/B,EAAA;;;;;;;AAQOO,EAAAA,OAAAA,CAAQP,KAAaQ,KAAAA,EAAe;AACzC,IAAA,IAAI,CAAC,IAAA,CAAKV,OAAAA,CAAQW,UAAAA,EAAY;AAC5B,MAAA,OAAOC,uBAAAA,CAAc,IAAA,CAAKT,OAAAA,CAAQD,GAAAA,GAAMQ,KAAAA,CAAAA;AAC1C,IAAA;AACF,EAAA;;;;;;;EAQA,M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A,CAAAA,EAAO;AACvCE,QAAAA,MAAAA,EAAQ,KAAK9B,OAAAA,CAAQ8B;OACvB,CAAA;AACF,IAAA,CAAA,CAAA,OAASb,GAAAA,EAAK;AACZ,MAAA,OAAOC,gCAAAA,CAAeD,GAAAA,CAAAA,IAAQ,EAAA;AAChC,IAAA;AACF,EAAA;;;;;;;AAQA,EAAA,MAAsBc,KAAKH,IAAAA,EAAkC;AAC3D,IAAA,OAAOI,mBAAAA,CAAU,IAAA,CAAK7B,OAAAA,CAAQyB,IAAAA,CAAAA,EAAO;AACnCE,MAAAA,MAAAA,EAAQ,KAAK9B,OAAAA,CAAQ8B;KACvB,CAAA,CACGT,MAAMH,gCAAAA,CAAAA,CACNe,KAAKC,CAAAA,CAAAA,KAAKA,CAAAA,IAAK,EAAE,CAAA;AACtB,EAAA;;;;;;;AAQgBC,EAAAA,eAAAA,CAAgBjC,GAAAA,EAAsB;AACpD,IAAA,OAAOkC,kBAAAA,CAAY,IAAA,CAAKjC,OAAAA,CAAQD,GAAAA,CAAAA,CAAAA;AAClC,EAAA;;;;;;;AAQgBmC,EAAAA,UAAAA,CAAWnC,GAAAA,EAAsB;AAC/C,IAAA,OAAO,CAACoC,aAAAA,CAAO,IAAA,CAAKnC,OAAAA,CAAQD,GAAAA,CAAAA,CAAAA;AAC9B,EAAA;AACF","file":"chunk-XKEHVYDR.cjs","sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { exists, existsSync } from \"@stryke/fs/exists\";\nimport { createDirectory, createDirectorySync } from \"@stryke/fs/helpers\";\nimport { isDirectory, isFile } from \"@stryke/fs/is-file\";\nimport { listFiles, listFilesSync } from \"@stryke/fs/list-files\";\nimport { readFile, readFileSync } from \"@stryke/fs/read-file\";\nimport { writeFile, writeFileSync } from \"@stryke/fs/write-file\";\nimport { unlinkSync } from \"node:fs\";\nimport { unlink } from \"node:fs/promises\";\nimport { ignoreNotfound } from \"../helpers\";\nimport { BaseStorageAdapter, StorageAdapterOptions } from \"./base\";\n\nexport type SetSyncOptions = Parameters<typeof writeFileSync>[2];\nexport type SetOptions = Parameters<typeof writeFile>[2];\n\n/**\n * File system storage adapter implementation.\n */\nexport class FileSystemStorageAdapter extends BaseStorageAdapter {\n /**\n * A name identifying the storage adapter type.\n */\n public name = \"file-system\";\n\n /**\n * The storage preset for the adapter.\n *\n * @remarks\n * This can be used as an alternate way to identify the type of storage being used.\n */\n public override readonly preset = \"fs\";\n\n /**\n * Constructor for the FileSystemStorageAdapter.\n *\n * @param options - Configuration options for the storage adapter.\n */\n public constructor(options?: StorageAdapterOptions) {\n super(options);\n }\n\n /**\n * Synchronously checks if a key exists in the storage.\n *\n * @param key - The key to check for existence.\n * @returns Returns `true` if the key exists, otherwise `false`.\n */\n public existsSync(key: string): boolean {\n return existsSync(this.resolve(key));\n }\n\n /**\n * Asynchronously checks if a key exists in the storage.\n *\n * @param key - The key to check for existence.\n * @returns A promise that resolves to `true` if the key exists, otherwise `false`.\n */\n public override async exists(key: string): Promise<boolean> {\n return exists(this.resolve(key));\n }\n\n /**\n * Synchronously retrieves the value associated with a given key.\n *\n * @param key - The key whose value is to be retrieved.\n * @returns The value associated with the key, or `null` if the key does not exist.\n */\n public getSync(key: string): string | null {\n return readFileSync(this.resolve(key));\n }\n\n /**\n * Asynchronously retrieves the value associated with a given key.\n *\n * @param key - The key whose value is to be retrieved.\n * @returns A promise that resolves to the value associated with the key, or `null` if the key does not exist.\n */\n public override async get(key: string): Promise<string | null> {\n return readFile(this.resolve(key));\n }\n\n /**\n * Synchronously sets the value for a given key.\n *\n * @param key - The key to set the value for.\n * @param value - The value to set.\n */\n public setSync(key: string, value: string) {\n if (!this.options.isReadOnly) {\n return writeFileSync(this.resolve(key), value);\n }\n }\n\n /**\n * Asynchronously sets the value for a given key.\n *\n * @param key - The key to set the value for.\n * @param value - The value to set.\n */\n public override async set(key: string, value: string): Promise<void> {\n if (!this.options.isReadOnly) {\n return writeFile(this.resolve(key), value);\n }\n }\n\n /**\n * Synchronously removes a key from the storage.\n *\n * @param key - The key to remove.\n */\n public removeSync(key: string) {\n if (!this.options.isReadOnly) {\n try {\n return unlinkSync(this.resolve(key));\n } catch (err) {\n return ignoreNotfound(err);\n }\n }\n }\n\n /**\n * Asynchronously removes a key from the storage.\n *\n * @param key - The key to remove.\n */\n public override async remove(key: string): Promise<void> {\n if (!this.options.isReadOnly) {\n return unlink(this.resolve(key)).catch(ignoreNotfound);\n }\n }\n\n /**\n * Synchronously creates a directory at the specified path.\n *\n * @param dirPath - The path of the directory to create.\n */\n public override mkdirSync(dirPath: string) {\n createDirectorySync(this.resolve(dirPath));\n }\n\n /**\n * Creates a directory at the specified path.\n *\n * @param dirPath - The path of the directory to create.\n */\n public override async mkdir(dirPath: string): Promise<void> {\n await createDirectory(this.resolve(dirPath));\n }\n\n /**\n * Lists all keys under a given base path synchronously.\n *\n * @param base - The base path to list keys from.\n * @returns An array of keys under the specified base path.\n */\n public listSync(base?: string): string[] {\n try {\n return listFilesSync(this.resolve(base), {\n ignore: this.options.ignore\n });\n } catch (err) {\n return ignoreNotfound(err) ?? [];\n }\n }\n\n /**\n * Asynchronously lists all keys under a given base path.\n *\n * @param base - The base path to list keys from.\n * @returns A promise that resolves to an array of keys under the specified base path.\n */\n public override async list(base?: string): Promise<string[]> {\n return listFiles(this.resolve(base), {\n ignore: this.options.ignore\n })\n .catch(ignoreNotfound)\n .then(r => r || []);\n }\n\n /**\n * Synchronously checks if the given key is a directory.\n *\n * @param key - The key to check.\n * @returns `true` if the key is a directory, otherwise `false`.\n */\n public override isDirectorySync(key: string): boolean {\n return isDirectory(this.resolve(key));\n }\n\n /**\n * Synchronously checks if the given key is a file.\n *\n * @param key - The key to check.\n * @returns `true` if the key is a file, otherwise `false`.\n */\n public override isFileSync(key: string): boolean {\n return !isFile(this.resolve(key));\n }\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkMFC7UJHT_cjs = require('./chunk-MFC7UJHT.cjs');
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var chunk47XLO7EU_cjs = require('./chunk-47XLO7EU.cjs');
|
|
5
|
+
var chunkLENVCNR2_cjs = require('./chunk-LENVCNR2.cjs');
|
|
6
6
|
var chunkBJGMF356_cjs = require('./chunk-BJGMF356.cjs');
|
|
7
7
|
var chunkZWLSNYIN_cjs = require('./chunk-ZWLSNYIN.cjs');
|
|
8
8
|
var chunkQHTL2U3L_cjs = require('./chunk-QHTL2U3L.cjs');
|
|
@@ -488,7 +488,7 @@ var PowerlinesAPI = class _PowerlinesAPI {
|
|
|
488
488
|
* @returns A new instance of the Powerlines API
|
|
489
489
|
*/
|
|
490
490
|
static async from(workspaceRoot, config) {
|
|
491
|
-
const api = new _PowerlinesAPI(await
|
|
491
|
+
const api = new _PowerlinesAPI(await chunk47XLO7EU_cjs.PowerlinesAPIContext.from(workspaceRoot, config));
|
|
492
492
|
api.#context.$$internal = {
|
|
493
493
|
api,
|
|
494
494
|
addPlugin: api.#addPlugin.bind(api),
|
|
@@ -1006,8 +1006,8 @@ ${formatTypes(types$1)}
|
|
|
1006
1006
|
if (isPromise.isPromiseLike(config)) {
|
|
1007
1007
|
awaited = await Promise.resolve(config);
|
|
1008
1008
|
}
|
|
1009
|
-
if (!
|
|
1010
|
-
const invalid =
|
|
1009
|
+
if (!chunkLENVCNR2_cjs.isPluginConfig(awaited)) {
|
|
1010
|
+
const invalid = chunkLENVCNR2_cjs.findInvalidPluginConfig(awaited);
|
|
1011
1011
|
throw new Error(`Invalid ${invalid && invalid.length > 1 ? "plugins" : "plugin"} specified in the configuration - ${invalid && invalid.length > 0 ? JSON.stringify(awaited) : invalid?.join("\n\n")}
|
|
1012
1012
|
|
|
1013
1013
|
Please ensure the value is one of the following:
|
|
@@ -1019,7 +1019,7 @@ Please ensure the value is one of the following:
|
|
|
1019
1019
|
- an array of plugins or plugin configurations`);
|
|
1020
1020
|
}
|
|
1021
1021
|
let plugins;
|
|
1022
|
-
if (
|
|
1022
|
+
if (chunkLENVCNR2_cjs.isPlugin(awaited)) {
|
|
1023
1023
|
plugins = [
|
|
1024
1024
|
awaited
|
|
1025
1025
|
];
|
|
@@ -1032,9 +1032,9 @@ Please ensure the value is one of the following:
|
|
|
1032
1032
|
} else {
|
|
1033
1033
|
plugins = toArray.toArray(resolved);
|
|
1034
1034
|
}
|
|
1035
|
-
} else if (Array.isArray(awaited) && awaited.every(
|
|
1035
|
+
} else if (Array.isArray(awaited) && awaited.every(chunkLENVCNR2_cjs.isPlugin)) {
|
|
1036
1036
|
plugins = awaited;
|
|
1037
|
-
} else if (Array.isArray(awaited) && awaited.every(
|
|
1037
|
+
} else if (Array.isArray(awaited) && awaited.every(chunkLENVCNR2_cjs.isPluginConfig)) {
|
|
1038
1038
|
plugins = [];
|
|
1039
1039
|
for (const pluginConfig of awaited) {
|
|
1040
1040
|
const initialized = await this.#initPlugin(pluginConfig);
|
|
@@ -1042,10 +1042,10 @@ Please ensure the value is one of the following:
|
|
|
1042
1042
|
plugins.push(...initialized);
|
|
1043
1043
|
}
|
|
1044
1044
|
}
|
|
1045
|
-
} else if (
|
|
1045
|
+
} else if (chunkLENVCNR2_cjs.isPluginConfigTuple(awaited) || chunkLENVCNR2_cjs.isPluginConfigObject(awaited)) {
|
|
1046
1046
|
let pluginConfig;
|
|
1047
1047
|
let pluginOptions;
|
|
1048
|
-
if (
|
|
1048
|
+
if (chunkLENVCNR2_cjs.isPluginConfigTuple(awaited)) {
|
|
1049
1049
|
pluginConfig = awaited[0];
|
|
1050
1050
|
pluginOptions = awaited?.length === 2 ? awaited[1] : void 0;
|
|
1051
1051
|
} else {
|
|
@@ -1061,21 +1061,21 @@ Please ensure the value is one of the following:
|
|
|
1061
1061
|
}
|
|
1062
1062
|
} else if (isFunction.isFunction(pluginConfig)) {
|
|
1063
1063
|
plugins = toArray.toArray(await Promise.resolve(pluginConfig(pluginOptions)));
|
|
1064
|
-
} else if (Array.isArray(pluginConfig) && pluginConfig.every(
|
|
1064
|
+
} else if (Array.isArray(pluginConfig) && pluginConfig.every(chunkLENVCNR2_cjs.isPlugin)) {
|
|
1065
1065
|
plugins = pluginConfig;
|
|
1066
|
-
} else if (
|
|
1066
|
+
} else if (chunkLENVCNR2_cjs.isPlugin(pluginConfig)) {
|
|
1067
1067
|
plugins = toArray.toArray(pluginConfig);
|
|
1068
1068
|
}
|
|
1069
1069
|
}
|
|
1070
1070
|
if (!plugins) {
|
|
1071
1071
|
throw new Error(`The plugin configuration ${JSON.stringify(awaited)} is invalid. This configuration must point to a valid Powerlines plugin module.`);
|
|
1072
1072
|
}
|
|
1073
|
-
if (plugins.length > 0 && !plugins.every(
|
|
1073
|
+
if (plugins.length > 0 && !plugins.every(chunkLENVCNR2_cjs.isPlugin)) {
|
|
1074
1074
|
throw new Error(`The plugin option ${JSON.stringify(plugins)} does not export a valid module. This configuration must point to a valid Powerlines plugin module.`);
|
|
1075
1075
|
}
|
|
1076
1076
|
const result = [];
|
|
1077
1077
|
for (const plugin of plugins) {
|
|
1078
|
-
if (
|
|
1078
|
+
if (chunkLENVCNR2_cjs.checkDedupe(plugin, this.context.plugins)) {
|
|
1079
1079
|
this.context.log(types.LogLevelLabel.TRACE, `Duplicate ${chalk3__default.default.bold.cyanBright(plugin.name)} plugin dependency detected - Skipping initialization.`);
|
|
1080
1080
|
} else {
|
|
1081
1081
|
result.push(plugin);
|
|
@@ -1246,5 +1246,5 @@ function createUnpluginFactory(variant, decorate) {
|
|
|
1246
1246
|
chunkPK6SKIKE_cjs.__name(createUnpluginFactory, "createUnpluginFactory");
|
|
1247
1247
|
|
|
1248
1248
|
exports.createUnpluginFactory = createUnpluginFactory;
|
|
1249
|
-
//# sourceMappingURL=chunk-
|
|
1250
|
-
//# sourceMappingURL=chunk-
|
|
1249
|
+
//# sourceMappingURL=chunk-YR7H6YZZ.cjs.map
|
|
1250
|
+
//# sourceMappingURL=chunk-YR7H6YZZ.cjs.map
|