@storm-software/workspace-tools 1.43.7 → 1.43.9
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/CHANGELOG.md +15 -0
- package/index.js +61 -115
- package/meta.json +1 -1
- package/package.json +1 -1
- package/src/base/index.js +13 -68
- package/src/executors/design-tokens/executor.js +26 -81
- package/src/executors/tsup/executor.js +40 -94
- package/src/executors/tsup-browser/executor.js +40 -94
- package/src/executors/tsup-neutral/executor.js +40 -94
- package/src/executors/tsup-node/executor.js +40 -94
- package/src/generators/browser-library/generator.js +13 -68
- package/src/generators/config-schema/generator.js +11 -66
- package/src/generators/neutral-library/generator.js +13 -68
- package/src/generators/node-library/generator.js +13 -68
- package/src/generators/preset/generator.js +11 -66
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## [1.43.8](https://github.com/storm-software/storm-ops/compare/workspace-tools-v1.43.7...workspace-tools-v1.43.8) (2024-01-17)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **config-tools:** Removed unused defaulting logic for config file ([2770efd](https://github.com/storm-software/storm-ops/commit/2770efde7032b88e6bf20fb23c5b89060175db5d))
|
|
7
|
+
|
|
8
|
+
## [1.43.7](https://github.com/storm-software/storm-ops/compare/workspace-tools-v1.43.6...workspace-tools-v1.43.7) (2024-01-17)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **config-tools:** Resolved issue with bad config file lookup logic ([9967de4](https://github.com/storm-software/storm-ops/commit/9967de48b063a83f42c74c3f6dd667d31123dc6f))
|
|
14
|
+
* **workspace-tools:** Resolved issue with config file names changing ([f18c40c](https://github.com/storm-software/storm-ops/commit/f18c40c1be8c154aff163692e79351b34accb991))
|
|
15
|
+
|
|
1
16
|
## [1.43.6](https://github.com/storm-software/storm-ops/compare/workspace-tools-v1.43.5...workspace-tools-v1.43.6) (2024-01-17)
|
|
2
17
|
|
|
3
18
|
|
package/index.js
CHANGED
|
@@ -34308,7 +34308,7 @@ var require_jsonfile = __commonJS({
|
|
|
34308
34308
|
return obj;
|
|
34309
34309
|
}
|
|
34310
34310
|
var readFile = universalify.fromPromise(_readFile);
|
|
34311
|
-
function
|
|
34311
|
+
function readFileSync3(file, options = {}) {
|
|
34312
34312
|
if (typeof options === "string") {
|
|
34313
34313
|
options = { encoding: options };
|
|
34314
34314
|
}
|
|
@@ -34340,7 +34340,7 @@ var require_jsonfile = __commonJS({
|
|
|
34340
34340
|
}
|
|
34341
34341
|
var jsonfile = {
|
|
34342
34342
|
readFile,
|
|
34343
|
-
readFileSync:
|
|
34343
|
+
readFileSync: readFileSync3,
|
|
34344
34344
|
writeFile: writeFile2,
|
|
34345
34345
|
writeFileSync: writeFileSync3
|
|
34346
34346
|
};
|
|
@@ -46989,7 +46989,7 @@ var require_lib6 = __commonJS({
|
|
|
46989
46989
|
function _interopRequireDefault(obj) {
|
|
46990
46990
|
return obj && obj.__esModule ? obj : { default: obj };
|
|
46991
46991
|
}
|
|
46992
|
-
var
|
|
46992
|
+
var readFileSync3 = (fp) => {
|
|
46993
46993
|
return _fs.default.readFileSync(fp, "utf8");
|
|
46994
46994
|
};
|
|
46995
46995
|
var pathExists = (fp) => new Promise((resolve) => {
|
|
@@ -47113,7 +47113,7 @@ var require_lib6 = __commonJS({
|
|
|
47113
47113
|
if (this.packageJsonCache.has(filepath2)) {
|
|
47114
47114
|
return this.packageJsonCache.get(filepath2)[options.packageKey];
|
|
47115
47115
|
}
|
|
47116
|
-
const data2 = this.options.parseJSON(
|
|
47116
|
+
const data2 = this.options.parseJSON(readFileSync3(filepath2));
|
|
47117
47117
|
return data2;
|
|
47118
47118
|
}
|
|
47119
47119
|
};
|
|
@@ -47147,7 +47147,7 @@ var require_lib6 = __commonJS({
|
|
|
47147
47147
|
if (this.packageJsonCache.has(filepath2)) {
|
|
47148
47148
|
return this.packageJsonCache.get(filepath2)[options.packageKey];
|
|
47149
47149
|
}
|
|
47150
|
-
const data2 = this.options.parseJSON(
|
|
47150
|
+
const data2 = this.options.parseJSON(readFileSync3(filepath2));
|
|
47151
47151
|
return data2;
|
|
47152
47152
|
}
|
|
47153
47153
|
};
|
|
@@ -73213,7 +73213,7 @@ var require_util5 = __commonJS({
|
|
|
73213
73213
|
var normalize2 = createSafeHandler((url) => {
|
|
73214
73214
|
});
|
|
73215
73215
|
exports.normalize = normalize2;
|
|
73216
|
-
function
|
|
73216
|
+
function join7(aRoot, aPath) {
|
|
73217
73217
|
const pathType = getURLType(aPath);
|
|
73218
73218
|
const rootType = getURLType(aRoot);
|
|
73219
73219
|
aRoot = ensureDirectory(aRoot);
|
|
@@ -73239,7 +73239,7 @@ var require_util5 = __commonJS({
|
|
|
73239
73239
|
const newPath = withBase(aPath, withBase(aRoot, base));
|
|
73240
73240
|
return computeRelativeURL(base, newPath);
|
|
73241
73241
|
}
|
|
73242
|
-
exports.join =
|
|
73242
|
+
exports.join = join7;
|
|
73243
73243
|
function relative(rootURL, targetURL) {
|
|
73244
73244
|
const result = relativeIfPossible(rootURL, targetURL);
|
|
73245
73245
|
return typeof result === "string" ? result : normalize2(targetURL);
|
|
@@ -73269,9 +73269,9 @@ var require_util5 = __commonJS({
|
|
|
73269
73269
|
}
|
|
73270
73270
|
let url = normalize2(sourceURL || "");
|
|
73271
73271
|
if (sourceRoot)
|
|
73272
|
-
url =
|
|
73272
|
+
url = join7(sourceRoot, url);
|
|
73273
73273
|
if (sourceMapURL)
|
|
73274
|
-
url =
|
|
73274
|
+
url = join7(trimFilename(sourceMapURL), url);
|
|
73275
73275
|
return url;
|
|
73276
73276
|
}
|
|
73277
73277
|
exports.computeSourceURL = computeSourceURL;
|
|
@@ -75036,8 +75036,8 @@ var require_source_map = __commonJS({
|
|
|
75036
75036
|
// node_modules/.pnpm/rollup@4.5.0/node_modules/rollup/dist/native.js
|
|
75037
75037
|
var require_native = __commonJS({
|
|
75038
75038
|
"node_modules/.pnpm/rollup@4.5.0/node_modules/rollup/dist/native.js"(exports, module2) {
|
|
75039
|
-
var { existsSync:
|
|
75040
|
-
var { join:
|
|
75039
|
+
var { existsSync: existsSync5 } = require("node:fs");
|
|
75040
|
+
var { join: join7 } = require("node:path");
|
|
75041
75041
|
var { platform, arch, report } = require("node:process");
|
|
75042
75042
|
var isMusl = () => !report.getReport().header.glibcVersionRuntime;
|
|
75043
75043
|
var bindingsByPlatformAndArch = {
|
|
@@ -75087,7 +75087,7 @@ If this is important to you, please consider supporting Rollup to make a native
|
|
|
75087
75087
|
return imported.base;
|
|
75088
75088
|
}
|
|
75089
75089
|
var localName = `./rollup.${packageBase}.node`;
|
|
75090
|
-
var { parse, parseAsync, xxhashBase64Url } =
|
|
75090
|
+
var { parse, parseAsync, xxhashBase64Url } = existsSync5(join7(__dirname, localName)) ? require(localName) : require(`@rollup/rollup-${packageBase}`);
|
|
75091
75091
|
module2.exports.parse = parse;
|
|
75092
75092
|
module2.exports.parseAsync = parseAsync;
|
|
75093
75093
|
module2.exports.xxhashBase64Url = xxhashBase64Url;
|
|
@@ -111220,7 +111220,7 @@ var require_TransformerError = __commonJS({
|
|
|
111220
111220
|
TransformerError2.from = function(method) {
|
|
111221
111221
|
return function(errors) {
|
|
111222
111222
|
var body = errors.map(function(e) {
|
|
111223
|
-
var subject = e.explore.object === null ? "" :
|
|
111223
|
+
var subject = e.explore.object === null ? "" : join7(e.explore.object)(e.explore.property);
|
|
111224
111224
|
var type = "".concat(subject.length ? "".concat(subject, ": ") : "").concat(e.name);
|
|
111225
111225
|
return "- ".concat(type, "\n").concat(e.messages.map(function(msg) {
|
|
111226
111226
|
return " - ".concat(msg);
|
|
@@ -111232,7 +111232,7 @@ var require_TransformerError = __commonJS({
|
|
|
111232
111232
|
});
|
|
111233
111233
|
};
|
|
111234
111234
|
};
|
|
111235
|
-
var
|
|
111235
|
+
var join7 = function(object) {
|
|
111236
111236
|
return function(key) {
|
|
111237
111237
|
if (key === null)
|
|
111238
111238
|
return object.name;
|
|
@@ -117312,13 +117312,13 @@ var require_application_object = __commonJS({
|
|
|
117312
117312
|
return __assign2(__assign2({ type: "object", properties, nullable: options.purpose === "swagger" ? nullable : void 0, required: required.length ? required : void 0, description: obj.description }, options.surplus ? { "x-typia-jsDocTags": obj.jsDocTags } : {}), options.purpose === "ajv" ? extraProps : options.surplus ? {
|
|
117313
117313
|
"x-typia-additionalProperties": extraProps.additionalProperties,
|
|
117314
117314
|
"x-typia-patternProperties": extraProps.patternProperties,
|
|
117315
|
-
additionalProperties:
|
|
117315
|
+
additionalProperties: join7(options)(components)(extraMeta)
|
|
117316
117316
|
} : {});
|
|
117317
117317
|
};
|
|
117318
117318
|
};
|
|
117319
117319
|
};
|
|
117320
117320
|
};
|
|
117321
|
-
var
|
|
117321
|
+
var join7 = function(options) {
|
|
117322
117322
|
return function(components) {
|
|
117323
117323
|
return function(extra) {
|
|
117324
117324
|
var _a;
|
|
@@ -126509,10 +126509,6 @@ Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
|
|
|
126509
126509
|
return result;
|
|
126510
126510
|
}
|
|
126511
126511
|
|
|
126512
|
-
// packages/config-tools/src/utilities/get-default-config.ts
|
|
126513
|
-
var import_node_fs2 = require("node:fs");
|
|
126514
|
-
var import_node_path2 = require("node:path");
|
|
126515
|
-
|
|
126516
126512
|
// node_modules/.pnpm/zod@3.22.4/node_modules/zod/lib/index.mjs
|
|
126517
126513
|
var util;
|
|
126518
126514
|
(function(util2) {
|
|
@@ -130173,51 +130169,6 @@ var DefaultStormConfig = {
|
|
|
130173
130169
|
colors: { ...DefaultColorConfig },
|
|
130174
130170
|
extensions: {}
|
|
130175
130171
|
};
|
|
130176
|
-
var getDefaultConfig = (config = {}, root) => {
|
|
130177
|
-
let name = "storm-workspace";
|
|
130178
|
-
let namespace = "storm-software";
|
|
130179
|
-
let repository = "https://github.com/storm-software/storm-ops";
|
|
130180
|
-
let license = DefaultStormConfig.license;
|
|
130181
|
-
let homepage = DefaultStormConfig.homepage;
|
|
130182
|
-
const workspaceRoot = findWorkspaceRoot(root);
|
|
130183
|
-
if ((0, import_node_fs2.existsSync)((0, import_node_path2.join)(workspaceRoot, "package.json"))) {
|
|
130184
|
-
const file = (0, import_node_fs2.readFileSync)((0, import_node_path2.join)(workspaceRoot, "package.json"), {
|
|
130185
|
-
encoding: "utf-8"
|
|
130186
|
-
});
|
|
130187
|
-
if (file) {
|
|
130188
|
-
const packageJson = JSON.parse(file);
|
|
130189
|
-
if (packageJson.name) {
|
|
130190
|
-
name = packageJson.name;
|
|
130191
|
-
}
|
|
130192
|
-
if (packageJson.namespace) {
|
|
130193
|
-
namespace = packageJson.namespace;
|
|
130194
|
-
}
|
|
130195
|
-
if (packageJson.repository?.url) {
|
|
130196
|
-
repository = packageJson.repository?.url;
|
|
130197
|
-
}
|
|
130198
|
-
if (packageJson.license) {
|
|
130199
|
-
license = packageJson.license;
|
|
130200
|
-
}
|
|
130201
|
-
if (packageJson.homepage) {
|
|
130202
|
-
homepage = packageJson.homepage;
|
|
130203
|
-
}
|
|
130204
|
-
}
|
|
130205
|
-
}
|
|
130206
|
-
return StormConfigSchema.parse({
|
|
130207
|
-
...DefaultStormConfig,
|
|
130208
|
-
...config,
|
|
130209
|
-
colors: { ...DefaultColorConfig, ...config.colors },
|
|
130210
|
-
workspaceRoot,
|
|
130211
|
-
name,
|
|
130212
|
-
namespace,
|
|
130213
|
-
repository,
|
|
130214
|
-
license: license ?? DefaultStormConfig.license,
|
|
130215
|
-
homepage: homepage ?? DefaultStormConfig.homepage,
|
|
130216
|
-
extensions: {
|
|
130217
|
-
...config.extensions
|
|
130218
|
-
}
|
|
130219
|
-
});
|
|
130220
|
-
};
|
|
130221
130172
|
|
|
130222
130173
|
// packages/config-tools/src/utilities/get-log-level.ts
|
|
130223
130174
|
var getLogLevel = (label) => {
|
|
@@ -130619,27 +130570,22 @@ var getConfigEnv = () => {
|
|
|
130619
130570
|
|
|
130620
130571
|
// packages/config-tools/src/create-storm-config.ts
|
|
130621
130572
|
var loadStormConfig = async (workspaceRoot) => {
|
|
130622
|
-
let config = {};
|
|
130623
130573
|
let _workspaceRoot = workspaceRoot;
|
|
130624
130574
|
if (!_workspaceRoot) {
|
|
130625
130575
|
_workspaceRoot = findWorkspaceRoot();
|
|
130626
130576
|
}
|
|
130627
|
-
const configFile =
|
|
130628
|
-
|
|
130629
|
-
|
|
130630
|
-
|
|
130631
|
-
|
|
130632
|
-
_workspaceRoot
|
|
130633
|
-
);
|
|
130634
|
-
if (configFile) {
|
|
130635
|
-
config = StormConfigSchema.parse(configFile);
|
|
130636
|
-
} else {
|
|
130637
|
-
writeWarning(
|
|
130638
|
-
config,
|
|
130639
|
-
"No Storm config file found in the current workspace. Please ensure this is the expected behavior - you can add a `storm.config.js` file to the root of your workspace if it is not."
|
|
130640
|
-
);
|
|
130641
|
-
}
|
|
130577
|
+
const configFile = {
|
|
130578
|
+
...await getConfigFile(_workspaceRoot),
|
|
130579
|
+
...getConfigEnv()
|
|
130580
|
+
};
|
|
130581
|
+
const config = StormConfigSchema.parse(configFile);
|
|
130642
130582
|
setConfigEnv(config);
|
|
130583
|
+
console.debug("\n\n");
|
|
130584
|
+
console.debug(`Loaded Storm config from ${config.configFile}`);
|
|
130585
|
+
for (const key of Object.keys(configFile)) {
|
|
130586
|
+
console.debug(configFile[key]);
|
|
130587
|
+
}
|
|
130588
|
+
console.debug("\n\n");
|
|
130643
130589
|
return config;
|
|
130644
130590
|
};
|
|
130645
130591
|
|
|
@@ -131429,9 +131375,9 @@ ${commentStart} ----------------------------------------------------------------
|
|
|
131429
131375
|
};
|
|
131430
131376
|
|
|
131431
131377
|
// packages/workspace-tools/src/executors/tsup/executor.ts
|
|
131432
|
-
var
|
|
131378
|
+
var import_node_fs2 = require("node:fs");
|
|
131433
131379
|
var import_promises2 = require("node:fs/promises");
|
|
131434
|
-
var
|
|
131380
|
+
var import_node_path3 = require("node:path");
|
|
131435
131381
|
var import_esbuild_decorators = __toESM(require_src2());
|
|
131436
131382
|
var import_devkit3 = __toESM(require_devkit());
|
|
131437
131383
|
var import_js2 = __toESM(require_src());
|
|
@@ -137663,13 +137609,13 @@ var import_tsup = __toESM(require_dist6());
|
|
|
137663
137609
|
var ts = __toESM(require("typescript"));
|
|
137664
137610
|
|
|
137665
137611
|
// packages/workspace-tools/src/utils/file-path-utils.ts
|
|
137666
|
-
var
|
|
137612
|
+
var import_node_path2 = require("node:path");
|
|
137667
137613
|
var removeExtension = (filePath) => {
|
|
137668
137614
|
return filePath.lastIndexOf(".") ? filePath.substring(0, filePath.lastIndexOf(".")) : filePath;
|
|
137669
137615
|
};
|
|
137670
137616
|
function findFileName(filePath) {
|
|
137671
137617
|
return filePath?.split(
|
|
137672
|
-
filePath?.includes(
|
|
137618
|
+
filePath?.includes(import_node_path2.sep) ? import_node_path2.sep : filePath?.includes("/") ? "/" : "\\"
|
|
137673
137619
|
)?.pop() ?? "";
|
|
137674
137620
|
}
|
|
137675
137621
|
|
|
@@ -137795,9 +137741,9 @@ ${Object.keys(options).map(
|
|
|
137795
137741
|
if (!result.success) {
|
|
137796
137742
|
throw new Error("The Build process failed trying to copy assets");
|
|
137797
137743
|
}
|
|
137798
|
-
const pathToPackageJson = (0,
|
|
137744
|
+
const pathToPackageJson = (0, import_node_path3.join)(context.root, projectRoot, "package.json");
|
|
137799
137745
|
const packageJson = (0, import_fileutils.fileExists)(pathToPackageJson) ? (0, import_devkit3.readJsonFile)(pathToPackageJson) : { name: context.projectName, version: "0.0.1" };
|
|
137800
|
-
const workspacePackageJson = (0, import_devkit3.readJsonFile)((0,
|
|
137746
|
+
const workspacePackageJson = (0, import_devkit3.readJsonFile)((0, import_node_path3.join)(workspaceRoot, "package.json"));
|
|
137801
137747
|
options.external = options.external || [];
|
|
137802
137748
|
if (workspacePackageJson?.dependencies) {
|
|
137803
137749
|
options.external = Object.keys(workspacePackageJson?.dependencies).reduce(
|
|
@@ -137956,11 +137902,11 @@ ${externalDependencies.map((dep) => {
|
|
|
137956
137902
|
},
|
|
137957
137903
|
...(options.additionalEntryPoints ?? []).map((entryPoint) => ({
|
|
137958
137904
|
[removeExtension(entryPoint).replace(sourceRoot, "")]: {
|
|
137959
|
-
types: (0,
|
|
137905
|
+
types: (0, import_node_path3.join)(
|
|
137960
137906
|
`./${distPaths[0]}`,
|
|
137961
137907
|
`${removeExtension(entryPoint.replace(sourceRoot, ""))}.d.ts`
|
|
137962
137908
|
),
|
|
137963
|
-
default: (0,
|
|
137909
|
+
default: (0, import_node_path3.join)(
|
|
137964
137910
|
`./${distPaths[0]}`,
|
|
137965
137911
|
`${removeExtension(entryPoint.replace(sourceRoot, ""))}.js`
|
|
137966
137912
|
)
|
|
@@ -138006,7 +137952,7 @@ ${externalDependencies.map((dep) => {
|
|
|
138006
137952
|
if (distSrc.startsWith("/")) {
|
|
138007
137953
|
distSrc = distSrc.substring(1);
|
|
138008
137954
|
}
|
|
138009
|
-
packageJson.source ??= `${(0,
|
|
137955
|
+
packageJson.source ??= `${(0, import_node_path3.join)(distSrc, "index.ts").replaceAll("\\", "/")}`;
|
|
138010
137956
|
}
|
|
138011
137957
|
packageJson.sideEffects ??= false;
|
|
138012
137958
|
packageJson.files ??= ["dist/**/*"];
|
|
@@ -138024,10 +137970,10 @@ ${externalDependencies.map((dep) => {
|
|
|
138024
137970
|
packageJson.license ??= workspacePackageJson.license;
|
|
138025
137971
|
packageJson.keywords ??= workspacePackageJson.keywords;
|
|
138026
137972
|
packageJson.repository ??= workspacePackageJson.repository;
|
|
138027
|
-
packageJson.repository.directory ??= projectRoot ? projectRoot : (0,
|
|
138028
|
-
const packageJsonPath = (0,
|
|
137973
|
+
packageJson.repository.directory ??= projectRoot ? projectRoot : (0, import_node_path3.join)("packages", context.projectName);
|
|
137974
|
+
const packageJsonPath = (0, import_node_path3.join)(context.root, options.outputPath, "package.json");
|
|
138029
137975
|
writeDebug(config, `\u26A1 Writing package.json file to: ${packageJsonPath}`);
|
|
138030
|
-
(0,
|
|
137976
|
+
(0, import_node_fs2.writeFileSync)(
|
|
138031
137977
|
packageJsonPath,
|
|
138032
137978
|
await (0, import_prettier.format)(JSON.stringify(packageJson), {
|
|
138033
137979
|
...prettierOptions,
|
|
@@ -138051,7 +137997,7 @@ ${externalDependencies.map((dep) => {
|
|
|
138051
137997
|
await (0, import_prettier.format)(
|
|
138052
137998
|
`${options.banner ? options.banner.startsWith("//") ? options.banner : `// ${options.banner}` : ""}
|
|
138053
137999
|
|
|
138054
|
-
${(0,
|
|
138000
|
+
${(0, import_node_fs2.readFileSync)(file, "utf-8")}`,
|
|
138055
138001
|
{
|
|
138056
138002
|
...prettierOptions,
|
|
138057
138003
|
parser: "typescript"
|
|
@@ -138156,11 +138102,11 @@ function getNormalizedTsConfig(workspaceRoot, outputPath, options) {
|
|
|
138156
138102
|
emitDeclarationOnly: true,
|
|
138157
138103
|
declaration: true,
|
|
138158
138104
|
declarationMap: true,
|
|
138159
|
-
declarationDir: (0,
|
|
138105
|
+
declarationDir: (0, import_node_path3.join)(workspaceRoot, "tmp", ".tsup", "declaration")
|
|
138160
138106
|
}
|
|
138161
138107
|
},
|
|
138162
138108
|
ts.sys,
|
|
138163
|
-
(0,
|
|
138109
|
+
(0, import_node_path3.dirname)(options.tsConfig)
|
|
138164
138110
|
);
|
|
138165
138111
|
tsConfig.options.pathsBasePath = workspaceRoot;
|
|
138166
138112
|
if (tsConfig.options.incremental && !tsConfig.options.tsBuildInfoFile) {
|
|
@@ -139838,12 +139784,12 @@ var generator_default3 = withRunGenerator(
|
|
|
139838
139784
|
);
|
|
139839
139785
|
|
|
139840
139786
|
// packages/workspace-tools/src/utils/find-cache-dir.ts
|
|
139841
|
-
var
|
|
139842
|
-
var
|
|
139787
|
+
var import_node_fs3 = require("node:fs");
|
|
139788
|
+
var import_node_path4 = require("node:path");
|
|
139843
139789
|
var import_node_process = require("node:process");
|
|
139844
139790
|
var isWritable2 = (path3) => {
|
|
139845
139791
|
try {
|
|
139846
|
-
(0,
|
|
139792
|
+
(0, import_node_fs3.accessSync)(path3, import_node_fs3.constants.W_OK);
|
|
139847
139793
|
return true;
|
|
139848
139794
|
} catch {
|
|
139849
139795
|
return false;
|
|
@@ -139851,13 +139797,13 @@ var isWritable2 = (path3) => {
|
|
|
139851
139797
|
};
|
|
139852
139798
|
function useDirectory(directory, { create = true }) {
|
|
139853
139799
|
if (create) {
|
|
139854
|
-
(0,
|
|
139800
|
+
(0, import_node_fs3.mkdirSync)(directory, { recursive: true });
|
|
139855
139801
|
}
|
|
139856
139802
|
return directory;
|
|
139857
139803
|
}
|
|
139858
139804
|
function getNodeModuleDirectory(workspaceRoot) {
|
|
139859
|
-
const nodeModules = (0,
|
|
139860
|
-
if ((0,
|
|
139805
|
+
const nodeModules = (0, import_node_path4.join)(workspaceRoot, "node_modules");
|
|
139806
|
+
if ((0, import_node_fs3.existsSync)(nodeModules) && !isWritable2(nodeModules)) {
|
|
139861
139807
|
throw new Error("Cannot write to node_modules directory");
|
|
139862
139808
|
}
|
|
139863
139809
|
return nodeModules;
|
|
@@ -139873,10 +139819,10 @@ function findCacheDirectory({
|
|
|
139873
139819
|
create: true
|
|
139874
139820
|
}) {
|
|
139875
139821
|
if (import_node_process.env.CACHE_DIR && !["true", "false", "1", "0"].includes(import_node_process.env.CACHE_DIR)) {
|
|
139876
|
-
return useDirectory((0,
|
|
139822
|
+
return useDirectory((0, import_node_path4.join)(import_node_process.env.CACHE_DIR, name, cacheName), { create });
|
|
139877
139823
|
}
|
|
139878
139824
|
if (import_node_process.env.STORM_CACHE_DIR && !["true", "false", "1", "0"].includes(import_node_process.env.STORM_CACHE_DIR)) {
|
|
139879
|
-
return useDirectory((0,
|
|
139825
|
+
return useDirectory((0, import_node_path4.join)(import_node_process.env.STORM_CACHE_DIR, name, cacheName), {
|
|
139880
139826
|
create
|
|
139881
139827
|
});
|
|
139882
139828
|
}
|
|
@@ -139885,14 +139831,14 @@ function findCacheDirectory({
|
|
|
139885
139831
|
throw new Error("Cannot find node_modules directory");
|
|
139886
139832
|
}
|
|
139887
139833
|
return useDirectory(
|
|
139888
|
-
(0,
|
|
139834
|
+
(0, import_node_path4.join)(workspaceRoot, "node_modules", ".cache", name, cacheName),
|
|
139889
139835
|
{ create }
|
|
139890
139836
|
);
|
|
139891
139837
|
}
|
|
139892
139838
|
|
|
139893
139839
|
// packages/workspace-tools/src/utils/workspace-storage.ts
|
|
139894
|
-
var
|
|
139895
|
-
var
|
|
139840
|
+
var import_node_fs4 = require("node:fs");
|
|
139841
|
+
var import_node_path5 = require("node:path");
|
|
139896
139842
|
var WorkspaceStorage = class {
|
|
139897
139843
|
constructor({
|
|
139898
139844
|
cacheName,
|
|
@@ -139912,9 +139858,9 @@ var WorkspaceStorage = class {
|
|
|
139912
139858
|
* @returns The value of the key
|
|
139913
139859
|
*/
|
|
139914
139860
|
getItem(key) {
|
|
139915
|
-
const cacheFile = (0,
|
|
139916
|
-
if ((0,
|
|
139917
|
-
return (0,
|
|
139861
|
+
const cacheFile = (0, import_node_path5.join)(this.cacheDir, key);
|
|
139862
|
+
if ((0, import_node_fs4.existsSync)(cacheFile)) {
|
|
139863
|
+
return (0, import_node_fs4.readFileSync)(cacheFile, "utf-8");
|
|
139918
139864
|
}
|
|
139919
139865
|
return void 0;
|
|
139920
139866
|
}
|
|
@@ -139925,7 +139871,7 @@ var WorkspaceStorage = class {
|
|
|
139925
139871
|
* @param value - The value to set
|
|
139926
139872
|
*/
|
|
139927
139873
|
setItem(key, value) {
|
|
139928
|
-
(0,
|
|
139874
|
+
(0, import_node_fs4.writeFileSync)((0, import_node_path5.join)(this.cacheDir, key), value, { encoding: "utf-8" });
|
|
139929
139875
|
}
|
|
139930
139876
|
/**
|
|
139931
139877
|
* Remove item from cache
|
|
@@ -139933,14 +139879,14 @@ var WorkspaceStorage = class {
|
|
|
139933
139879
|
* @param key - The key to remove
|
|
139934
139880
|
*/
|
|
139935
139881
|
removeItem(key) {
|
|
139936
|
-
(0,
|
|
139882
|
+
(0, import_node_fs4.rmSync)((0, import_node_path5.join)(this.cacheDir, key), { force: true, recursive: true });
|
|
139937
139883
|
}
|
|
139938
139884
|
/**
|
|
139939
139885
|
* Clear the cache
|
|
139940
139886
|
*/
|
|
139941
139887
|
clear() {
|
|
139942
|
-
(0,
|
|
139943
|
-
(0,
|
|
139888
|
+
(0, import_node_fs4.readdirSync)(this.cacheDir).forEach((cacheFile) => {
|
|
139889
|
+
(0, import_node_fs4.rmSync)(cacheFile, { force: true, recursive: true });
|
|
139944
139890
|
});
|
|
139945
139891
|
}
|
|
139946
139892
|
/**
|
|
@@ -139950,7 +139896,7 @@ var WorkspaceStorage = class {
|
|
|
139950
139896
|
* @returns The key at the index
|
|
139951
139897
|
*/
|
|
139952
139898
|
key(index) {
|
|
139953
|
-
const files = (0,
|
|
139899
|
+
const files = (0, import_node_fs4.readdirSync)(this.cacheDir);
|
|
139954
139900
|
if (index < files.length && index >= 0) {
|
|
139955
139901
|
return files[index];
|
|
139956
139902
|
}
|