@awsless/ts-file-cache 0.0.16 → 0.0.18

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/index.js CHANGED
@@ -1,274 +1,381 @@
1
- // src/index.ts
2
- import { readdir } from "fs/promises";
3
-
4
- // src/hash.ts
1
+ import { builtinModules } from "node:module";
2
+ import { lstat, readFile, readdir, stat } from "fs/promises";
3
+ import { basename, dirname, extname, isAbsolute, join, normalize, relative, resolve, sep } from "path";
5
4
  import { createHash } from "crypto";
6
- import { readFile } from "fs/promises";
7
- import { builtinModules } from "module";
8
- import { relative } from "path";
9
-
10
- // src/import.ts
11
5
  import { parse } from "@swc/core";
12
- import { dirname, resolve } from "path";
13
6
  import { simple } from "swc-walk";
14
- var findImports = async (file, code) => {
15
- const ast = await parse(code, {
16
- syntax: "typescript"
17
- });
18
- const importing = /* @__PURE__ */ new Set();
19
- try {
20
- simple(ast, {
21
- ImportDeclaration(node) {
22
- importing.add(node.source.value);
23
- },
24
- ExportAllDeclaration(node) {
25
- importing.add(node.source.value);
26
- },
27
- ExportNamedDeclaration(node) {
28
- if (node.source) {
29
- importing.add(node.source.value);
30
- }
31
- },
32
- CallExpression(node) {
33
- if (node.callee.type === "Import") {
34
- const first = node.arguments.at(0);
35
- if (first && first.expression.type === "StringLiteral") {
36
- importing.add(first.expression.value);
37
- }
38
- }
39
- }
40
- });
41
- } catch (_) {
42
- return [];
43
- }
44
- return [...importing].map((importee) => {
45
- if (importee.startsWith(".")) {
46
- return resolve(dirname(file), importee);
47
- }
48
- const parts = importee.split("/");
49
- if (parts.length > 2) {
50
- return parts.slice(0, 2).join("/");
51
- }
52
- return importee;
53
- });
7
+ import { BaseVisitor } from "swc-walk/baseVisitor";
8
+ import { parse as parse$1 } from "yaml";
9
+ //#region src/import.ts
10
+ var PatchedBaseVisitor = class extends BaseVisitor {
11
+ FunctionBody(node, state, callback) {
12
+ for (const statement of node.stmts) callback(statement, state);
13
+ }
54
14
  };
55
-
56
- // src/module.ts
57
- import { stat } from "fs/promises";
58
- import { basename, isAbsolute, join } from "path";
59
- var findFile = async (files) => {
60
- for (const file of files) {
61
- try {
62
- const s = await stat(file);
63
- if (s.isFile()) {
64
- return file;
65
- }
66
- } catch (_) {
67
- continue;
68
- }
69
- }
70
- throw new Error(`No such file: ${files.join(", ")}`);
15
+ const baseVisitor = new PatchedBaseVisitor();
16
+ const parseOptions = (file) => {
17
+ if (file.endsWith(".tsx")) return {
18
+ syntax: "typescript",
19
+ tsx: true,
20
+ decorators: true
21
+ };
22
+ if (file.endsWith(".ts") || file.endsWith(".mts") || file.endsWith(".cts")) return {
23
+ syntax: "typescript",
24
+ decorators: true
25
+ };
26
+ return {
27
+ syntax: "ecmascript",
28
+ jsx: true,
29
+ decorators: true
30
+ };
71
31
  };
72
- var resolveModuleImportFile = (file, allowedExtensions) => {
73
- if (file.endsWith(".js") && allowedExtensions.includes("js") && allowedExtensions.includes("ts")) {
74
- return findFile([file, file.substring(0, file.length - 3) + ".ts"]);
75
- }
76
- if (!basename(file).includes(".")) {
77
- return findFile([
78
- file,
79
- ...allowedExtensions.map((exp) => `${file}.${exp}`),
80
- ...allowedExtensions.map((exp) => join(file, `/index.${exp}`))
81
- ]);
82
- }
83
- return file;
32
+ const findImports = async (file, code) => {
33
+ let ast;
34
+ try {
35
+ ast = await parse(code, parseOptions(file));
36
+ } catch (error) {
37
+ throw new Error(`Failed to parse: ${file}`, { cause: error });
38
+ }
39
+ const importing = /* @__PURE__ */ new Set();
40
+ try {
41
+ simple(ast, {
42
+ ImportDeclaration(node) {
43
+ importing.add(node.source.value);
44
+ },
45
+ ExportAllDeclaration(node) {
46
+ importing.add(node.source.value);
47
+ },
48
+ ExportNamedDeclaration(node) {
49
+ if (node.source) importing.add(node.source.value);
50
+ },
51
+ CallExpression(node) {
52
+ if (node.callee.type === "Import") {
53
+ const first = node.arguments.at(0);
54
+ if (first && first.expression.type === "StringLiteral") importing.add(first.expression.value);
55
+ }
56
+ },
57
+ TsImportEqualsDeclaration(node) {
58
+ if (node.moduleRef.type === "TsExternalModuleReference") importing.add(node.moduleRef.expression.value);
59
+ }
60
+ }, baseVisitor);
61
+ } catch (error) {
62
+ throw new Error(`Failed to walk the AST of: ${file}`, { cause: error });
63
+ }
64
+ return [...importing].map((importee) => {
65
+ if (importee.startsWith(".")) return resolve(dirname(file), importee);
66
+ const parts = importee.split("/");
67
+ if (parts.length > 2) return parts.slice(0, 2).join("/");
68
+ return importee;
69
+ });
84
70
  };
85
- var isLocalCodeFile = (file) => {
86
- return file.startsWith("/") || file.startsWith(".");
71
+ //#endregion
72
+ //#region src/module.ts
73
+ const findFile = async (files) => {
74
+ for (const file of files) try {
75
+ if ((await stat(file)).isFile()) return file;
76
+ } catch (_) {
77
+ continue;
78
+ }
79
+ throw new Error(`No such file: ${files.join(", ")}`);
87
80
  };
88
- var toAbsolute = (file) => {
89
- if (isAbsolute(file)) {
90
- return file;
91
- }
92
- return join(process.cwd(), file);
81
+ const alternateExtensions = {
82
+ ".js": [".ts", ".tsx"],
83
+ ".mjs": [".mts"],
84
+ ".cjs": [".cts"],
85
+ ".jsx": [".tsx"]
93
86
  };
94
-
95
- // src/hash.ts
96
- var generateRecursiveFileHashes = async (workspace, file, sourceFile, allowedExtensions, hashes) => {
97
- if (isLocalCodeFile(file)) {
98
- try {
99
- file = await resolveModuleImportFile(file, allowedExtensions);
100
- } catch (error) {
101
- throw new Error(`Can't find imported file: "${file}" inside the source: "${sourceFile}"`);
102
- }
103
- const relFile = relative(workspace.cwd, file);
104
- if (hashes.has(relFile)) {
105
- return;
106
- }
107
- const code = await readFile(file, "utf8");
108
- const ext = file.split(".").pop();
109
- const hash = createHash("sha1").update(code).digest();
110
- hashes.set(relFile, hash);
111
- if (!ext || !allowedExtensions.includes(ext)) {
112
- return;
113
- }
114
- const deps = await findImports(file, code);
115
- for (const dep of deps) {
116
- await generateRecursiveFileHashes(workspace, dep, file, allowedExtensions, hashes);
117
- }
118
- return;
119
- }
120
- const module = getPackageName(file);
121
- if (hashes.has(module)) {
122
- return;
123
- }
124
- const dependency = findDependency(workspace, module, sourceFile);
125
- if (dependency) {
126
- if (dependency.type === "package") {
127
- hashes.set(module, Buffer.from(`${module}:${dependency.version}`, "utf8"));
128
- } else {
129
- const localPackage = workspace.packages[module];
130
- if (!localPackage) {
131
- throw new Error(`Can't find the local workspace package for: ${file}`);
132
- }
133
- if (!localPackage.main) {
134
- throw new Error(`Workspace package doesn't have a main entry: ${file}`);
135
- }
136
- await generateRecursiveFileHashes(
137
- workspace,
138
- localPackage.main,
139
- localPackage.main,
140
- allowedExtensions,
141
- hashes
142
- );
143
- }
144
- return;
145
- }
146
- if (builtinModules.includes(module.replace(/^node\:/, ""))) {
147
- return;
148
- }
149
- throw new Error(`Can't find the dependency version for: ${file} inside the source: ${sourceFile}`);
87
+ const resolveModuleImportFile = (file, allowedExtensions) => {
88
+ const extension = extname(file);
89
+ const alternates = alternateExtensions[extension];
90
+ if (alternates) {
91
+ const candidates = [file];
92
+ for (const alternate of alternates) if (allowedExtensions.includes(alternate.substring(1))) candidates.push(file.substring(0, file.length - extension.length) + alternate);
93
+ return findFile(candidates);
94
+ }
95
+ if (!basename(file).includes(".")) return findFile([
96
+ file,
97
+ ...allowedExtensions.map((ext) => `${file}.${ext}`),
98
+ ...allowedExtensions.map((ext) => join(file, `index.${ext}`))
99
+ ]);
100
+ return file;
150
101
  };
151
- var mergeHashes = (hashes) => {
152
- const merge = Buffer.concat(Array.from(hashes.values()).sort());
153
- return createHash("sha1").update(merge).digest("hex");
102
+ const isLocalCodeFile = (file) => {
103
+ return file.startsWith("/") || file.startsWith(".");
154
104
  };
155
- var getPackageName = (importee) => {
156
- const parts = importee.split("/");
157
- if (importee.startsWith("@")) {
158
- if (parts.length >= 2) {
159
- return `${parts[0]}/${parts[1]}`;
160
- }
161
- } else if (parts.length >= 1) {
162
- return parts[0];
163
- }
164
- throw new Error(`Malformed importee: ${importee}`);
105
+ const toAbsolute = (file) => {
106
+ if (isAbsolute(file)) return file;
107
+ return join(process.cwd(), file);
165
108
  };
166
- var findDependency = (workspace, module, source) => {
167
- const pkg = Object.values(workspace.packages).filter((p) => source.startsWith(p.path)).sort((a, b) => b.path.split("/").length - a.path.split("/").length).find((p) => p.dependencies[module]);
168
- if (!pkg) {
169
- return;
170
- }
171
- return pkg.dependencies[module];
109
+ //#endregion
110
+ //#region src/hash.ts
111
+ const generateRecursiveFileHashes = async (workspace, file, sourceFile, allowedExtensions, hashes) => {
112
+ if (isLocalCodeFile(file)) {
113
+ try {
114
+ file = await resolveModuleImportFile(file, allowedExtensions);
115
+ } catch (error) {
116
+ throw new Error(`Can't find imported file: "${file}" inside the source: "${sourceFile}"`);
117
+ }
118
+ const relFile = relative(workspace.cwd, file).split(sep).join("/");
119
+ if (hashes.has(relFile)) return;
120
+ const code = await readFile(file, "utf8");
121
+ const ext = file.split(".").pop();
122
+ const hash = createHash("sha1").update(code).digest();
123
+ hashes.set(relFile, hash);
124
+ if (!ext || !allowedExtensions.includes(ext)) return;
125
+ const deps = await findImports(file, code);
126
+ for (const dep of deps) await generateRecursiveFileHashes(workspace, dep, file, allowedExtensions, hashes);
127
+ return;
128
+ }
129
+ const module = getPackageName(file);
130
+ if (hashes.has(module)) return;
131
+ const dependency = findDependency(workspace, module, sourceFile);
132
+ if (dependency) {
133
+ if (dependency.type === "package") hashes.set(module, Buffer.from(`${module}:${dependency.version}`, "utf8"));
134
+ else {
135
+ const localPackage = workspace.packages[dependency.link];
136
+ if (!localPackage) throw new Error(`Can't find the local workspace package for: ${file}`);
137
+ if (!localPackage.main) throw new Error(`Workspace package doesn't have a main entry: ${file}`);
138
+ await generateRecursiveFileHashes(workspace, localPackage.main, localPackage.main, allowedExtensions, hashes);
139
+ }
140
+ return;
141
+ }
142
+ if (builtinModules.includes(module.replace(/^node\:/, ""))) return;
143
+ throw new Error(`Can't find the dependency version for: ${file} inside the source: ${sourceFile}`);
172
144
  };
173
-
174
- // src/index.ts
175
- import { extname, resolve as resolve2 } from "path";
176
-
177
- // src/package-manager/pnpm.ts
178
- import { lstat, readFile as readFile2 } from "fs/promises";
179
- import { join as join2, normalize } from "path";
180
- import { parse as parse2 } from "yaml";
181
- var pnpm = async (search) => {
182
- const [cwd, lockFile] = await findLockFile(search);
183
- const data = parse2(lockFile);
184
- const packages = {};
185
- await Promise.all(
186
- Object.entries(data.importers).map(async ([path, importee]) => {
187
- const deps = { ...importee.devDependencies, ...importee.dependencies };
188
- const dependencies = {};
189
- const packageJson = await readFile2(join2(cwd, path, "package.json"), "utf8");
190
- const packageData = JSON.parse(packageJson);
191
- for (const [name, entry2] of Object.entries(deps)) {
192
- if (entry2.version.startsWith("link:")) {
193
- dependencies[name] = {
194
- type: "workspace",
195
- link: join2(cwd, path, entry2.version.substring(5))
196
- };
197
- } else {
198
- dependencies[name] = {
199
- type: "package",
200
- version: entry2.version
201
- };
202
- }
203
- }
204
- const entry = packageData.module ?? packageData.main;
205
- packages[packageData.name] = {
206
- name: packageData.name,
207
- path: join2(cwd, path),
208
- main: entry ? join2(cwd, path, entry) : void 0,
209
- dependencies
210
- };
211
- })
212
- );
213
- return {
214
- cwd,
215
- packages
216
- };
145
+ const mergeHashes = (hashes) => {
146
+ const names = Array.from(hashes.keys()).sort();
147
+ const merged = createHash("sha1");
148
+ for (const name of names) {
149
+ merged.update(name);
150
+ merged.update(hashes.get(name));
151
+ }
152
+ return merged.digest("hex");
217
153
  };
218
- var findLockFile = async (path, level = 5) => {
219
- if (!level) {
220
- throw new TypeError("No pnpm lock file found");
221
- }
222
- const file = join2(path, "pnpm-lock.yaml");
223
- const exists = await fileExist(file);
224
- if (exists) {
225
- return [path, await readFile2(file, "utf8")];
226
- }
227
- return findLockFile(normalize(join2(path, "..")), level - 1);
154
+ const getPackageName = (importee) => {
155
+ const parts = importee.split("/");
156
+ if (importee.startsWith("@")) {
157
+ if (parts.length >= 2) return `${parts[0]}/${parts[1]}`;
158
+ } else if (parts.length >= 1) return parts[0];
159
+ throw new Error(`Malformed importee: ${importee}`);
228
160
  };
229
- var fileExist = async (file) => {
230
- try {
231
- const stat2 = await lstat(file);
232
- if (stat2.isFile()) {
233
- return true;
234
- }
235
- } catch (error) {
236
- }
237
- return false;
161
+ const findDependency = (workspace, module, source) => {
162
+ const pkg = Object.values(workspace.packages).filter((p) => source === p.path || source.startsWith(p.path + sep)).sort((a, b) => b.path.split(sep).length - a.path.split(sep).length).find((p) => p.dependencies[module]);
163
+ if (!pkg) return;
164
+ return pkg.dependencies[module];
238
165
  };
239
-
240
- // src/index.ts
241
- var loadWorkspace = async (search) => {
242
- const { cwd, packages } = await pnpm(toAbsolute(search));
243
- return {
244
- cwd,
245
- packages
246
- };
166
+ //#endregion
167
+ //#region src/package-manager/bun.ts
168
+ const bun = async (cwd, lockFile) => {
169
+ const data = parseJsonc(lockFile);
170
+ const resolvedVersions = {};
171
+ for (const [key, entry] of Object.entries(data.packages ?? {})) {
172
+ const resolution = entry[0];
173
+ const at = resolution.lastIndexOf("@");
174
+ const version = resolution.substring(at + 1);
175
+ if (!version.startsWith("workspace:")) resolvedVersions[key] = version;
176
+ }
177
+ const workspacePaths = {};
178
+ for (const [path, workspace] of Object.entries(data.workspaces)) if (workspace.name) workspacePaths[workspace.name] = path;
179
+ const importers = {};
180
+ for (const [path, workspace] of Object.entries(data.workspaces)) {
181
+ const deps = {
182
+ ...workspace.devDependencies,
183
+ ...workspace.optionalDependencies,
184
+ ...workspace.dependencies
185
+ };
186
+ const dependencies = {};
187
+ for (const [name, specifier] of Object.entries(deps)) {
188
+ if (specifier.startsWith("workspace:")) {
189
+ const target = specifier.substring(10);
190
+ const workspacePath = workspacePaths[name];
191
+ if (workspacePath !== void 0) dependencies[name] = {
192
+ type: "workspace",
193
+ link: join(cwd, workspacePath)
194
+ };
195
+ else dependencies[name] = {
196
+ type: "workspace",
197
+ link: join(cwd, path, target)
198
+ };
199
+ continue;
200
+ }
201
+ const version = resolvedVersions[name] ?? resolvedVersions[`${workspace.name}/${name}`];
202
+ if (version) dependencies[name] = {
203
+ type: "package",
204
+ version
205
+ };
206
+ else dependencies[name] = {
207
+ type: "package",
208
+ version: specifier
209
+ };
210
+ }
211
+ importers[path] = dependencies;
212
+ }
213
+ return {
214
+ cwd,
215
+ packages: await buildPackages(cwd, importers)
216
+ };
247
217
  };
248
- var defaultOptions = {
249
- extensions: ["js", "mjs", "jsx", "ts", "mts", "tsx"]
218
+ const parseJsonc = (text) => {
219
+ try {
220
+ return JSON.parse(text);
221
+ } catch (_) {
222
+ return JSON.parse(stripJsoncSyntax(text));
223
+ }
250
224
  };
251
- var generateFileHash = async (workspace, file, opts = {}) => {
252
- const options = { ...defaultOptions, ...opts };
253
- const hashes = /* @__PURE__ */ new Map();
254
- const absoluteFile = toAbsolute(file);
255
- await generateRecursiveFileHashes(workspace, absoluteFile, absoluteFile, options.extensions, hashes);
256
- return mergeHashes(hashes);
225
+ const stripJsoncSyntax = (text) => {
226
+ let result = "";
227
+ let index = 0;
228
+ while (index < text.length) {
229
+ const char = text[index];
230
+ if (char === "\"") {
231
+ result += char;
232
+ index++;
233
+ while (index < text.length) {
234
+ const stringChar = text[index];
235
+ result += stringChar;
236
+ index++;
237
+ if (stringChar === "\\") {
238
+ result += text[index] ?? "";
239
+ index++;
240
+ continue;
241
+ }
242
+ if (stringChar === "\"") break;
243
+ }
244
+ continue;
245
+ }
246
+ if (char === "/" && text[index + 1] === "/") {
247
+ while (index < text.length && text[index] !== "\n") index++;
248
+ continue;
249
+ }
250
+ if (char === "/" && text[index + 1] === "*") {
251
+ index += 2;
252
+ while (index < text.length && !(text[index] === "*" && text[index + 1] === "/")) index++;
253
+ index += 2;
254
+ continue;
255
+ }
256
+ if (char === ",") {
257
+ let ahead = index + 1;
258
+ while (ahead < text.length && /\s/.test(text[ahead])) ahead++;
259
+ if (text[ahead] === "}" || text[ahead] === "]") {
260
+ index++;
261
+ continue;
262
+ }
263
+ }
264
+ result += char;
265
+ index++;
266
+ }
267
+ return result;
257
268
  };
258
- var generateFolderHash = async (workspace, folder, opts = {}) => {
259
- const options = { ...defaultOptions, ...opts };
260
- const hashes = /* @__PURE__ */ new Map();
261
- const files = await readdir(folder, { recursive: true, withFileTypes: true });
262
- for (const file of files) {
263
- if (file.isFile() && options.extensions.includes(extname(file.name).substring(1))) {
264
- const f = resolve2(file.parentPath, file.name);
265
- await generateRecursiveFileHashes(workspace, f, f, options.extensions, hashes);
266
- }
267
- }
268
- return mergeHashes(hashes);
269
+ //#endregion
270
+ //#region src/package-manager/pnpm.ts
271
+ const pnpm = async (cwd, lockFile) => {
272
+ const data = parse$1(lockFile);
273
+ const importers = {};
274
+ for (const [path, importee] of Object.entries(data.importers)) {
275
+ const deps = {
276
+ ...importee.devDependencies,
277
+ ...importee.optionalDependencies,
278
+ ...importee.dependencies
279
+ };
280
+ const dependencies = {};
281
+ for (const [name, entry] of Object.entries(deps)) if (entry.version.startsWith("link:")) dependencies[name] = {
282
+ type: "workspace",
283
+ link: join(cwd, path, entry.version.substring(5))
284
+ };
285
+ else dependencies[name] = {
286
+ type: "package",
287
+ version: entry.version
288
+ };
289
+ importers[path] = dependencies;
290
+ }
291
+ return {
292
+ cwd,
293
+ packages: await buildPackages(cwd, importers)
294
+ };
269
295
  };
270
- export {
271
- generateFileHash,
272
- generateFolderHash,
273
- loadWorkspace
296
+ //#endregion
297
+ //#region src/package-manager/util.ts
298
+ const parsers = {
299
+ "pnpm-lock.yaml": pnpm,
300
+ "bun.lock": bun
274
301
  };
302
+ const loadPackageManager = async (search, level = 5) => {
303
+ if (!level) throw new TypeError("No pnpm or bun lock file found");
304
+ for (const [lockFileName, parser] of Object.entries(parsers)) {
305
+ const file = join(search, lockFileName);
306
+ if (await fileExist(file)) {
307
+ const content = await readFile(file, "utf8");
308
+ return {
309
+ ...await parser(search, content),
310
+ lockfileHash: createHash("sha1").update(content).digest("hex")
311
+ };
312
+ }
313
+ }
314
+ return loadPackageManager(normalize(join(search, "..")), level - 1);
315
+ };
316
+ const fileExist = async (file) => {
317
+ try {
318
+ if ((await lstat(file)).isFile()) return true;
319
+ } catch (error) {}
320
+ return false;
321
+ };
322
+ const buildPackages = async (cwd, importers) => {
323
+ const packages = {};
324
+ await Promise.all(Object.entries(importers).map(async ([path, dependencies]) => {
325
+ const packageJson = await readFile(join(cwd, path, "package.json"), "utf8");
326
+ const packageData = JSON.parse(packageJson);
327
+ const entry = packageData.module ?? packageData.main;
328
+ packages[join(cwd, path)] = {
329
+ name: packageData.name,
330
+ path: join(cwd, path),
331
+ main: entry ? join(cwd, path, entry) : void 0,
332
+ dependencies
333
+ };
334
+ }));
335
+ return packages;
336
+ };
337
+ //#endregion
338
+ //#region src/index.ts
339
+ const loadWorkspace = async (search) => {
340
+ return loadPackageManager(toAbsolute(search));
341
+ };
342
+ const defaultOptions = { extensions: [
343
+ "js",
344
+ "mjs",
345
+ "jsx",
346
+ "ts",
347
+ "mts",
348
+ "tsx"
349
+ ] };
350
+ const seedHashes = (workspace) => {
351
+ return /* @__PURE__ */ new Map([["#lockfile", Buffer.from(workspace.lockfileHash, "hex")]]);
352
+ };
353
+ const generateFileHash = async (workspace, file, opts = {}) => {
354
+ const options = {
355
+ ...defaultOptions,
356
+ ...opts
357
+ };
358
+ const hashes = seedHashes(workspace);
359
+ const absoluteFile = toAbsolute(file);
360
+ await generateRecursiveFileHashes(workspace, absoluteFile, absoluteFile, options.extensions, hashes);
361
+ return mergeHashes(hashes);
362
+ };
363
+ const generateFolderHash = async (workspace, folder, opts = {}) => {
364
+ const options = {
365
+ ...defaultOptions,
366
+ ...opts
367
+ };
368
+ const hashes = seedHashes(workspace);
369
+ const absoluteFolder = toAbsolute(folder);
370
+ const files = await readdir(absoluteFolder, {
371
+ recursive: true,
372
+ withFileTypes: true
373
+ });
374
+ for (const file of files) if (file.isFile() && options.extensions.includes(extname(file.name).substring(1))) {
375
+ const f = resolve(file.parentPath, file.name);
376
+ await generateRecursiveFileHashes(workspace, f, f, options.extensions, hashes);
377
+ }
378
+ return mergeHashes(hashes);
379
+ };
380
+ //#endregion
381
+ export { generateFileHash, generateFolderHash, loadWorkspace };
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@awsless/ts-file-cache",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
+ "bugs": {
5
+ "url": "https://github.com/awsless/awsless/issues"
6
+ },
4
7
  "license": "MIT",
5
- "type": "module",
6
8
  "repository": {
7
9
  "type": "git",
8
10
  "url": "https://github.com/awsless/awsless.git"
9
11
  },
10
- "bugs": {
11
- "url": "https://github.com/awsless/awsless/issues"
12
- },
13
12
  "files": [
14
13
  "dist"
15
14
  ],
15
+ "type": "module",
16
16
  "main": "./dist/index.cjs",
17
17
  "module": "./dist/index.js",
18
18
  "types": "./dist/index.d.ts",
@@ -24,13 +24,13 @@
24
24
  }
25
25
  },
26
26
  "dependencies": {
27
- "@swc/core": "^1.10.18",
28
- "swc-walk": "1.0.0-rc.2",
29
- "yaml": "^2.5.0"
27
+ "@swc/core": "1.16.1",
28
+ "swc-walk": "3.0.0-rc.0",
29
+ "yaml": "2.9.0"
30
30
  },
31
31
  "scripts": {
32
- "test": "pnpm code test",
33
- "build": "pnpm tsup src/index.ts --format cjs,esm --dts --clean",
32
+ "test": "pnpm vitest run -c ../../vitest.shared.ts",
33
+ "build": "pnpm tsdown --no-fixed-extension src/index.ts --format cjs,esm --dts --clean",
34
34
  "prepublish": "if pnpm test; then pnpm build; else exit; fi"
35
35
  }
36
36
  }