@storm-software/workspace-tools 1.43.7 → 1.43.8
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 +8 -0
- package/index.js +55 -115
- package/meta.json +1 -1
- package/package.json +1 -1
- package/src/base/index.js +7 -68
- package/src/executors/design-tokens/executor.js +20 -81
- package/src/executors/tsup/executor.js +34 -94
- package/src/executors/tsup-browser/executor.js +34 -94
- package/src/executors/tsup-neutral/executor.js +34 -94
- package/src/executors/tsup-node/executor.js +34 -94
- package/src/generators/browser-library/generator.js +7 -68
- package/src/generators/config-schema/generator.js +5 -66
- package/src/generators/neutral-library/generator.js +7 -68
- package/src/generators/node-library/generator.js +7 -68
- package/src/generators/preset/generator.js +5 -66
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## [1.43.7](https://github.com/storm-software/storm-ops/compare/workspace-tools-v1.43.6...workspace-tools-v1.43.7) (2024-01-17)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **config-tools:** Resolved issue with bad config file lookup logic ([9967de4](https://github.com/storm-software/storm-ops/commit/9967de48b063a83f42c74c3f6dd667d31123dc6f))
|
|
7
|
+
* **workspace-tools:** Resolved issue with config file names changing ([f18c40c](https://github.com/storm-software/storm-ops/commit/f18c40c1be8c154aff163692e79351b34accb991))
|
|
8
|
+
|
|
1
9
|
## [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
10
|
|
|
3
11
|
|
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,26 +130570,15 @@ 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);
|
|
130643
130583
|
return config;
|
|
130644
130584
|
};
|
|
@@ -131429,9 +131369,9 @@ ${commentStart} ----------------------------------------------------------------
|
|
|
131429
131369
|
};
|
|
131430
131370
|
|
|
131431
131371
|
// packages/workspace-tools/src/executors/tsup/executor.ts
|
|
131432
|
-
var
|
|
131372
|
+
var import_node_fs2 = require("node:fs");
|
|
131433
131373
|
var import_promises2 = require("node:fs/promises");
|
|
131434
|
-
var
|
|
131374
|
+
var import_node_path3 = require("node:path");
|
|
131435
131375
|
var import_esbuild_decorators = __toESM(require_src2());
|
|
131436
131376
|
var import_devkit3 = __toESM(require_devkit());
|
|
131437
131377
|
var import_js2 = __toESM(require_src());
|
|
@@ -137663,13 +137603,13 @@ var import_tsup = __toESM(require_dist6());
|
|
|
137663
137603
|
var ts = __toESM(require("typescript"));
|
|
137664
137604
|
|
|
137665
137605
|
// packages/workspace-tools/src/utils/file-path-utils.ts
|
|
137666
|
-
var
|
|
137606
|
+
var import_node_path2 = require("node:path");
|
|
137667
137607
|
var removeExtension = (filePath) => {
|
|
137668
137608
|
return filePath.lastIndexOf(".") ? filePath.substring(0, filePath.lastIndexOf(".")) : filePath;
|
|
137669
137609
|
};
|
|
137670
137610
|
function findFileName(filePath) {
|
|
137671
137611
|
return filePath?.split(
|
|
137672
|
-
filePath?.includes(
|
|
137612
|
+
filePath?.includes(import_node_path2.sep) ? import_node_path2.sep : filePath?.includes("/") ? "/" : "\\"
|
|
137673
137613
|
)?.pop() ?? "";
|
|
137674
137614
|
}
|
|
137675
137615
|
|
|
@@ -137795,9 +137735,9 @@ ${Object.keys(options).map(
|
|
|
137795
137735
|
if (!result.success) {
|
|
137796
137736
|
throw new Error("The Build process failed trying to copy assets");
|
|
137797
137737
|
}
|
|
137798
|
-
const pathToPackageJson = (0,
|
|
137738
|
+
const pathToPackageJson = (0, import_node_path3.join)(context.root, projectRoot, "package.json");
|
|
137799
137739
|
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,
|
|
137740
|
+
const workspacePackageJson = (0, import_devkit3.readJsonFile)((0, import_node_path3.join)(workspaceRoot, "package.json"));
|
|
137801
137741
|
options.external = options.external || [];
|
|
137802
137742
|
if (workspacePackageJson?.dependencies) {
|
|
137803
137743
|
options.external = Object.keys(workspacePackageJson?.dependencies).reduce(
|
|
@@ -137956,11 +137896,11 @@ ${externalDependencies.map((dep) => {
|
|
|
137956
137896
|
},
|
|
137957
137897
|
...(options.additionalEntryPoints ?? []).map((entryPoint) => ({
|
|
137958
137898
|
[removeExtension(entryPoint).replace(sourceRoot, "")]: {
|
|
137959
|
-
types: (0,
|
|
137899
|
+
types: (0, import_node_path3.join)(
|
|
137960
137900
|
`./${distPaths[0]}`,
|
|
137961
137901
|
`${removeExtension(entryPoint.replace(sourceRoot, ""))}.d.ts`
|
|
137962
137902
|
),
|
|
137963
|
-
default: (0,
|
|
137903
|
+
default: (0, import_node_path3.join)(
|
|
137964
137904
|
`./${distPaths[0]}`,
|
|
137965
137905
|
`${removeExtension(entryPoint.replace(sourceRoot, ""))}.js`
|
|
137966
137906
|
)
|
|
@@ -138006,7 +137946,7 @@ ${externalDependencies.map((dep) => {
|
|
|
138006
137946
|
if (distSrc.startsWith("/")) {
|
|
138007
137947
|
distSrc = distSrc.substring(1);
|
|
138008
137948
|
}
|
|
138009
|
-
packageJson.source ??= `${(0,
|
|
137949
|
+
packageJson.source ??= `${(0, import_node_path3.join)(distSrc, "index.ts").replaceAll("\\", "/")}`;
|
|
138010
137950
|
}
|
|
138011
137951
|
packageJson.sideEffects ??= false;
|
|
138012
137952
|
packageJson.files ??= ["dist/**/*"];
|
|
@@ -138024,10 +137964,10 @@ ${externalDependencies.map((dep) => {
|
|
|
138024
137964
|
packageJson.license ??= workspacePackageJson.license;
|
|
138025
137965
|
packageJson.keywords ??= workspacePackageJson.keywords;
|
|
138026
137966
|
packageJson.repository ??= workspacePackageJson.repository;
|
|
138027
|
-
packageJson.repository.directory ??= projectRoot ? projectRoot : (0,
|
|
138028
|
-
const packageJsonPath = (0,
|
|
137967
|
+
packageJson.repository.directory ??= projectRoot ? projectRoot : (0, import_node_path3.join)("packages", context.projectName);
|
|
137968
|
+
const packageJsonPath = (0, import_node_path3.join)(context.root, options.outputPath, "package.json");
|
|
138029
137969
|
writeDebug(config, `\u26A1 Writing package.json file to: ${packageJsonPath}`);
|
|
138030
|
-
(0,
|
|
137970
|
+
(0, import_node_fs2.writeFileSync)(
|
|
138031
137971
|
packageJsonPath,
|
|
138032
137972
|
await (0, import_prettier.format)(JSON.stringify(packageJson), {
|
|
138033
137973
|
...prettierOptions,
|
|
@@ -138051,7 +137991,7 @@ ${externalDependencies.map((dep) => {
|
|
|
138051
137991
|
await (0, import_prettier.format)(
|
|
138052
137992
|
`${options.banner ? options.banner.startsWith("//") ? options.banner : `// ${options.banner}` : ""}
|
|
138053
137993
|
|
|
138054
|
-
${(0,
|
|
137994
|
+
${(0, import_node_fs2.readFileSync)(file, "utf-8")}`,
|
|
138055
137995
|
{
|
|
138056
137996
|
...prettierOptions,
|
|
138057
137997
|
parser: "typescript"
|
|
@@ -138156,11 +138096,11 @@ function getNormalizedTsConfig(workspaceRoot, outputPath, options) {
|
|
|
138156
138096
|
emitDeclarationOnly: true,
|
|
138157
138097
|
declaration: true,
|
|
138158
138098
|
declarationMap: true,
|
|
138159
|
-
declarationDir: (0,
|
|
138099
|
+
declarationDir: (0, import_node_path3.join)(workspaceRoot, "tmp", ".tsup", "declaration")
|
|
138160
138100
|
}
|
|
138161
138101
|
},
|
|
138162
138102
|
ts.sys,
|
|
138163
|
-
(0,
|
|
138103
|
+
(0, import_node_path3.dirname)(options.tsConfig)
|
|
138164
138104
|
);
|
|
138165
138105
|
tsConfig.options.pathsBasePath = workspaceRoot;
|
|
138166
138106
|
if (tsConfig.options.incremental && !tsConfig.options.tsBuildInfoFile) {
|
|
@@ -139838,12 +139778,12 @@ var generator_default3 = withRunGenerator(
|
|
|
139838
139778
|
);
|
|
139839
139779
|
|
|
139840
139780
|
// packages/workspace-tools/src/utils/find-cache-dir.ts
|
|
139841
|
-
var
|
|
139842
|
-
var
|
|
139781
|
+
var import_node_fs3 = require("node:fs");
|
|
139782
|
+
var import_node_path4 = require("node:path");
|
|
139843
139783
|
var import_node_process = require("node:process");
|
|
139844
139784
|
var isWritable2 = (path3) => {
|
|
139845
139785
|
try {
|
|
139846
|
-
(0,
|
|
139786
|
+
(0, import_node_fs3.accessSync)(path3, import_node_fs3.constants.W_OK);
|
|
139847
139787
|
return true;
|
|
139848
139788
|
} catch {
|
|
139849
139789
|
return false;
|
|
@@ -139851,13 +139791,13 @@ var isWritable2 = (path3) => {
|
|
|
139851
139791
|
};
|
|
139852
139792
|
function useDirectory(directory, { create = true }) {
|
|
139853
139793
|
if (create) {
|
|
139854
|
-
(0,
|
|
139794
|
+
(0, import_node_fs3.mkdirSync)(directory, { recursive: true });
|
|
139855
139795
|
}
|
|
139856
139796
|
return directory;
|
|
139857
139797
|
}
|
|
139858
139798
|
function getNodeModuleDirectory(workspaceRoot) {
|
|
139859
|
-
const nodeModules = (0,
|
|
139860
|
-
if ((0,
|
|
139799
|
+
const nodeModules = (0, import_node_path4.join)(workspaceRoot, "node_modules");
|
|
139800
|
+
if ((0, import_node_fs3.existsSync)(nodeModules) && !isWritable2(nodeModules)) {
|
|
139861
139801
|
throw new Error("Cannot write to node_modules directory");
|
|
139862
139802
|
}
|
|
139863
139803
|
return nodeModules;
|
|
@@ -139873,10 +139813,10 @@ function findCacheDirectory({
|
|
|
139873
139813
|
create: true
|
|
139874
139814
|
}) {
|
|
139875
139815
|
if (import_node_process.env.CACHE_DIR && !["true", "false", "1", "0"].includes(import_node_process.env.CACHE_DIR)) {
|
|
139876
|
-
return useDirectory((0,
|
|
139816
|
+
return useDirectory((0, import_node_path4.join)(import_node_process.env.CACHE_DIR, name, cacheName), { create });
|
|
139877
139817
|
}
|
|
139878
139818
|
if (import_node_process.env.STORM_CACHE_DIR && !["true", "false", "1", "0"].includes(import_node_process.env.STORM_CACHE_DIR)) {
|
|
139879
|
-
return useDirectory((0,
|
|
139819
|
+
return useDirectory((0, import_node_path4.join)(import_node_process.env.STORM_CACHE_DIR, name, cacheName), {
|
|
139880
139820
|
create
|
|
139881
139821
|
});
|
|
139882
139822
|
}
|
|
@@ -139885,14 +139825,14 @@ function findCacheDirectory({
|
|
|
139885
139825
|
throw new Error("Cannot find node_modules directory");
|
|
139886
139826
|
}
|
|
139887
139827
|
return useDirectory(
|
|
139888
|
-
(0,
|
|
139828
|
+
(0, import_node_path4.join)(workspaceRoot, "node_modules", ".cache", name, cacheName),
|
|
139889
139829
|
{ create }
|
|
139890
139830
|
);
|
|
139891
139831
|
}
|
|
139892
139832
|
|
|
139893
139833
|
// packages/workspace-tools/src/utils/workspace-storage.ts
|
|
139894
|
-
var
|
|
139895
|
-
var
|
|
139834
|
+
var import_node_fs4 = require("node:fs");
|
|
139835
|
+
var import_node_path5 = require("node:path");
|
|
139896
139836
|
var WorkspaceStorage = class {
|
|
139897
139837
|
constructor({
|
|
139898
139838
|
cacheName,
|
|
@@ -139912,9 +139852,9 @@ var WorkspaceStorage = class {
|
|
|
139912
139852
|
* @returns The value of the key
|
|
139913
139853
|
*/
|
|
139914
139854
|
getItem(key) {
|
|
139915
|
-
const cacheFile = (0,
|
|
139916
|
-
if ((0,
|
|
139917
|
-
return (0,
|
|
139855
|
+
const cacheFile = (0, import_node_path5.join)(this.cacheDir, key);
|
|
139856
|
+
if ((0, import_node_fs4.existsSync)(cacheFile)) {
|
|
139857
|
+
return (0, import_node_fs4.readFileSync)(cacheFile, "utf-8");
|
|
139918
139858
|
}
|
|
139919
139859
|
return void 0;
|
|
139920
139860
|
}
|
|
@@ -139925,7 +139865,7 @@ var WorkspaceStorage = class {
|
|
|
139925
139865
|
* @param value - The value to set
|
|
139926
139866
|
*/
|
|
139927
139867
|
setItem(key, value) {
|
|
139928
|
-
(0,
|
|
139868
|
+
(0, import_node_fs4.writeFileSync)((0, import_node_path5.join)(this.cacheDir, key), value, { encoding: "utf-8" });
|
|
139929
139869
|
}
|
|
139930
139870
|
/**
|
|
139931
139871
|
* Remove item from cache
|
|
@@ -139933,14 +139873,14 @@ var WorkspaceStorage = class {
|
|
|
139933
139873
|
* @param key - The key to remove
|
|
139934
139874
|
*/
|
|
139935
139875
|
removeItem(key) {
|
|
139936
|
-
(0,
|
|
139876
|
+
(0, import_node_fs4.rmSync)((0, import_node_path5.join)(this.cacheDir, key), { force: true, recursive: true });
|
|
139937
139877
|
}
|
|
139938
139878
|
/**
|
|
139939
139879
|
* Clear the cache
|
|
139940
139880
|
*/
|
|
139941
139881
|
clear() {
|
|
139942
|
-
(0,
|
|
139943
|
-
(0,
|
|
139882
|
+
(0, import_node_fs4.readdirSync)(this.cacheDir).forEach((cacheFile) => {
|
|
139883
|
+
(0, import_node_fs4.rmSync)(cacheFile, { force: true, recursive: true });
|
|
139944
139884
|
});
|
|
139945
139885
|
}
|
|
139946
139886
|
/**
|
|
@@ -139950,7 +139890,7 @@ var WorkspaceStorage = class {
|
|
|
139950
139890
|
* @returns The key at the index
|
|
139951
139891
|
*/
|
|
139952
139892
|
key(index) {
|
|
139953
|
-
const files = (0,
|
|
139893
|
+
const files = (0, import_node_fs4.readdirSync)(this.cacheDir);
|
|
139954
139894
|
if (index < files.length && index >= 0) {
|
|
139955
139895
|
return files[index];
|
|
139956
139896
|
}
|