@adonisjs/assembler 8.0.0-next.3 → 8.0.0-next.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +87 -59
- package/build/codemod_exception-vyN1VXuX.js +137 -0
- package/build/helpers-DDurYRsZ.js +72 -0
- package/build/index.d.ts +4 -0
- package/build/index.js +925 -1319
- package/build/main-BeV45LeF.js +246 -0
- package/build/main-CknPN3rJ.js +188 -0
- package/build/src/bundler.d.ts +44 -3
- package/build/src/code_scanners/routes_scanner/main.d.ts +63 -11
- package/build/src/code_scanners/routes_scanner/main.js +4 -0
- package/build/src/code_scanners/routes_scanner/validator_extractor.d.ts +12 -4
- package/build/src/code_transformer/main.d.ts +53 -43
- package/build/src/code_transformer/main.js +354 -599
- package/build/src/code_transformer/rc_file_transformer.d.ts +83 -5
- package/build/src/debug.d.ts +13 -1
- package/build/src/dev_server.d.ts +92 -17
- package/build/src/exceptions/codemod_exception.d.ts +178 -0
- package/build/src/file_buffer.d.ts +87 -0
- package/build/src/file_system.d.ts +46 -8
- package/build/src/helpers.d.ts +79 -4
- package/build/src/helpers.js +2 -0
- package/build/src/index_generator/main.d.ts +68 -0
- package/build/src/index_generator/main.js +3 -0
- package/build/src/index_generator/source.d.ts +60 -0
- package/build/src/paths_resolver.d.ts +29 -3
- package/build/src/shortcuts_manager.d.ts +42 -4
- package/build/src/test_runner.d.ts +57 -12
- package/build/src/types/code_scanners.d.ts +160 -30
- package/build/src/types/code_transformer.d.ts +69 -19
- package/build/src/types/common.d.ts +233 -55
- package/build/src/types/hooks.d.ts +238 -22
- package/build/src/types/main.d.ts +15 -1
- package/build/src/types/main.js +1 -0
- package/build/src/utils.d.ts +96 -15
- package/build/src/virtual_file_system.d.ts +112 -0
- package/build/virtual_file_system-bGeoWsK-.js +285 -0
- package/package.json +46 -36
- package/build/chunk-RR4HCA4M.js +0 -7
- package/build/src/ast_file_system.d.ts +0 -17
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { copyFile, mkdir, readFile } from "node:fs/promises";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import string from "@poppinss/utils/string";
|
|
4
|
+
import { relative } from "node:path/posix";
|
|
5
|
+
import Cache from "tmp-cache";
|
|
6
|
+
import { isJunk } from "junk";
|
|
7
|
+
import fastGlob from "fast-glob";
|
|
8
|
+
import Hooks from "@poppinss/hooks";
|
|
9
|
+
import { existsSync } from "node:fs";
|
|
10
|
+
import getRandomPort from "get-port";
|
|
11
|
+
import { execa, execaNode } from "execa";
|
|
12
|
+
import { importDefault, naturalSort } from "@poppinss/utils";
|
|
13
|
+
import { EnvLoader, EnvParser } from "@adonisjs/env";
|
|
14
|
+
import chokidar from "chokidar";
|
|
15
|
+
import { parseTsconfig } from "get-tsconfig";
|
|
16
|
+
import { basename, dirname as dirname$1, isAbsolute, join as join$1, relative as relative$1 } from "node:path";
|
|
17
|
+
import { debuglog } from "node:util";
|
|
18
|
+
import { fdir } from "fdir";
|
|
19
|
+
import lodash from "@poppinss/utils/lodash";
|
|
20
|
+
import { Lang, parse } from "@ast-grep/napi";
|
|
21
|
+
import picomatch from "picomatch";
|
|
22
|
+
var debug_default = debuglog("adonisjs:assembler");
|
|
23
|
+
const DEFAULT_NODE_ARGS = ["--import=@poppinss/ts-exec", "--enable-source-maps"];
|
|
24
|
+
function parseConfig(cwd, ts) {
|
|
25
|
+
const cwdPath = typeof cwd === "string" ? cwd : fileURLToPath(cwd);
|
|
26
|
+
const configFile = join$1(cwdPath, "tsconfig.json");
|
|
27
|
+
debug_default("parsing config file \"%s\"", configFile);
|
|
28
|
+
let hardException = null;
|
|
29
|
+
const parsedConfig = ts.getParsedCommandLineOfConfigFile(configFile, {}, {
|
|
30
|
+
...ts.sys,
|
|
31
|
+
useCaseSensitiveFileNames: true,
|
|
32
|
+
getCurrentDirectory: () => cwdPath,
|
|
33
|
+
onUnRecoverableConfigFileDiagnostic: (error) => hardException = error
|
|
34
|
+
});
|
|
35
|
+
if (hardException) {
|
|
36
|
+
const compilerHost = ts.createCompilerHost({});
|
|
37
|
+
console.log(ts.formatDiagnosticsWithColorAndContext([hardException], compilerHost));
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
if (parsedConfig.errors.length) {
|
|
41
|
+
const compilerHost = ts.createCompilerHost({});
|
|
42
|
+
console.log(ts.formatDiagnosticsWithColorAndContext(parsedConfig.errors, compilerHost));
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (parsedConfig.raw.include) parsedConfig.raw.include = parsedConfig.raw.include.map((includePath) => {
|
|
46
|
+
return includePath.replace("${configDir}/", "");
|
|
47
|
+
});
|
|
48
|
+
if (parsedConfig.raw.exclude) parsedConfig.raw.exclude = parsedConfig.raw.exclude.map((excludePath) => {
|
|
49
|
+
return excludePath.replace("${configDir}/", "");
|
|
50
|
+
});
|
|
51
|
+
return parsedConfig;
|
|
52
|
+
}
|
|
53
|
+
function readTsConfig(cwd) {
|
|
54
|
+
const tsConfigPath = join$1(cwd, "tsconfig.json");
|
|
55
|
+
debug_default("reading config file from location \"%s\"", tsConfigPath);
|
|
56
|
+
try {
|
|
57
|
+
const tsConfig = parseTsconfig(tsConfigPath);
|
|
58
|
+
if (tsConfig.include) tsConfig.include = tsConfig.include.map((resolvedPath) => {
|
|
59
|
+
return resolvedPath.replace(cwd, "");
|
|
60
|
+
});
|
|
61
|
+
if (tsConfig.exclude) tsConfig.exclude = tsConfig.exclude.map((resolvedPath) => {
|
|
62
|
+
return resolvedPath.replace(cwd, "");
|
|
63
|
+
});
|
|
64
|
+
debug_default("read tsconfig %O", tsConfig);
|
|
65
|
+
return {
|
|
66
|
+
path: tsConfigPath,
|
|
67
|
+
config: tsConfig
|
|
68
|
+
};
|
|
69
|
+
} catch {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function runNode(cwd, options) {
|
|
74
|
+
return execaNode(options.script, options.scriptArgs, {
|
|
75
|
+
nodeOptions: DEFAULT_NODE_ARGS.concat(options.nodeArgs),
|
|
76
|
+
preferLocal: true,
|
|
77
|
+
windowsHide: false,
|
|
78
|
+
localDir: cwd,
|
|
79
|
+
cwd,
|
|
80
|
+
reject: options.reject ?? false,
|
|
81
|
+
buffer: false,
|
|
82
|
+
stdio: options.stdio || "inherit",
|
|
83
|
+
env: {
|
|
84
|
+
...options.stdio === "pipe" ? { FORCE_COLOR: "true" } : {},
|
|
85
|
+
...options.env
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
function run(cwd, options) {
|
|
90
|
+
return execa(options.script, options.scriptArgs, {
|
|
91
|
+
preferLocal: true,
|
|
92
|
+
windowsHide: false,
|
|
93
|
+
localDir: cwd,
|
|
94
|
+
cwd,
|
|
95
|
+
buffer: false,
|
|
96
|
+
stdio: options.stdio || "inherit",
|
|
97
|
+
env: {
|
|
98
|
+
...options.stdio === "pipe" ? { FORCE_COLOR: "true" } : {},
|
|
99
|
+
...options.env
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
function watch(options) {
|
|
104
|
+
return chokidar.watch(["."], options);
|
|
105
|
+
}
|
|
106
|
+
async function getPort(cwd) {
|
|
107
|
+
if (process.env.PORT) return getRandomPort({ port: Number(process.env.PORT) });
|
|
108
|
+
const files = await new EnvLoader(cwd).load();
|
|
109
|
+
for (let file of files) {
|
|
110
|
+
const envVariables = await new EnvParser(file.contents, cwd).parse();
|
|
111
|
+
if (envVariables.PORT) return getRandomPort({ port: Number(envVariables.PORT) });
|
|
112
|
+
}
|
|
113
|
+
return getRandomPort({ port: 3333 });
|
|
114
|
+
}
|
|
115
|
+
async function copyFiles(files, cwd, outDir) {
|
|
116
|
+
const { paths, patterns } = files.reduce((result, file) => {
|
|
117
|
+
if (fastGlob.isDynamicPattern(file)) {
|
|
118
|
+
result.patterns.push(file);
|
|
119
|
+
return result;
|
|
120
|
+
}
|
|
121
|
+
if (existsSync(join$1(cwd, file))) result.paths.push(file);
|
|
122
|
+
return result;
|
|
123
|
+
}, {
|
|
124
|
+
patterns: [],
|
|
125
|
+
paths: []
|
|
126
|
+
});
|
|
127
|
+
debug_default("copyFiles inputs: %O, paths: %O, patterns: %O", files, paths, patterns);
|
|
128
|
+
const filePaths = paths.concat(await fastGlob(patterns, {
|
|
129
|
+
cwd,
|
|
130
|
+
dot: true
|
|
131
|
+
})).filter((file) => {
|
|
132
|
+
return !isJunk(basename(file));
|
|
133
|
+
});
|
|
134
|
+
debug_default("copying files %O to destination \"%s\"", filePaths, outDir);
|
|
135
|
+
const copyPromises = filePaths.map(async (file) => {
|
|
136
|
+
const src = isAbsolute(file) ? file : join$1(cwd, file);
|
|
137
|
+
const dest = join$1(outDir, relative$1(cwd, src));
|
|
138
|
+
await mkdir(dirname$1(dest), { recursive: true });
|
|
139
|
+
return copyFile(src, dest);
|
|
140
|
+
});
|
|
141
|
+
return await Promise.all(copyPromises);
|
|
142
|
+
}
|
|
143
|
+
function memoize(fn, maxKeys) {
|
|
144
|
+
const cache = new Cache({ max: maxKeys });
|
|
145
|
+
return (input, ...args) => {
|
|
146
|
+
if (cache.has(input)) return cache.get(input);
|
|
147
|
+
return fn(input, ...args);
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
function isRelative(pathValue) {
|
|
151
|
+
return pathValue.startsWith("./") || pathValue.startsWith("../");
|
|
152
|
+
}
|
|
153
|
+
async function loadHooks(rcFileHooks, names) {
|
|
154
|
+
const groups = names.map((name) => {
|
|
155
|
+
return {
|
|
156
|
+
group: name,
|
|
157
|
+
hooks: rcFileHooks?.[name] ?? []
|
|
158
|
+
};
|
|
159
|
+
});
|
|
160
|
+
const hooks = new Hooks();
|
|
161
|
+
for (const { group, hooks: collection } of groups) for (const item of collection) if ("run" in item) hooks.add(group, item.run);
|
|
162
|
+
else hooks.add(group, await importDefault(item));
|
|
163
|
+
return hooks;
|
|
164
|
+
}
|
|
165
|
+
function throttle(fn, name) {
|
|
166
|
+
name = name || "throttled";
|
|
167
|
+
let isBusy = false;
|
|
168
|
+
let hasQueuedCalls = false;
|
|
169
|
+
let lastCallArgs;
|
|
170
|
+
async function throttled(...args) {
|
|
171
|
+
if (isBusy) {
|
|
172
|
+
debug_default("ignoring \"%s\" invocation as current execution is in progress", name);
|
|
173
|
+
hasQueuedCalls = true;
|
|
174
|
+
lastCallArgs = args;
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
isBusy = true;
|
|
178
|
+
debug_default("executing throttled function \"%s\"", name);
|
|
179
|
+
await fn(...args);
|
|
180
|
+
debug_default("executed throttled function \"%s\"", name);
|
|
181
|
+
isBusy = false;
|
|
182
|
+
if (hasQueuedCalls) {
|
|
183
|
+
hasQueuedCalls = false;
|
|
184
|
+
debug_default("resuming and running latest \"%s\" invocation", name);
|
|
185
|
+
await throttled(...lastCallArgs);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return throttled;
|
|
189
|
+
}
|
|
190
|
+
function removeExtension(filePath) {
|
|
191
|
+
return filePath.substring(0, filePath.lastIndexOf("."));
|
|
192
|
+
}
|
|
193
|
+
const BYPASS_FN = (input) => input;
|
|
194
|
+
const DEFAULT_GLOB = [
|
|
195
|
+
"**/!(*.d).ts",
|
|
196
|
+
"**/*.tsx",
|
|
197
|
+
"**/*.js"
|
|
198
|
+
];
|
|
199
|
+
var VirtualFileSystem = class {
|
|
200
|
+
#source;
|
|
201
|
+
#options;
|
|
202
|
+
#files = /* @__PURE__ */ new Map();
|
|
203
|
+
#astCache = new Cache({ max: 60 });
|
|
204
|
+
#matcher;
|
|
205
|
+
#picoMatchOptions;
|
|
206
|
+
constructor(source, options) {
|
|
207
|
+
this.#source = source;
|
|
208
|
+
this.#options = options ?? {};
|
|
209
|
+
this.#picoMatchOptions = { cwd: this.#source };
|
|
210
|
+
this.#matcher = picomatch(this.#options.glob ?? DEFAULT_GLOB, this.#picoMatchOptions);
|
|
211
|
+
}
|
|
212
|
+
async scan() {
|
|
213
|
+
debug_default("fetching entities from source \"%s\"", this.#source);
|
|
214
|
+
const crawler = new fdir().globWithOptions(this.#options.glob ?? DEFAULT_GLOB, this.#picoMatchOptions).withFullPaths();
|
|
215
|
+
if (this.#options.filter) crawler.filter(this.#options.filter);
|
|
216
|
+
const filesList = await crawler.crawl(this.#source).withPromise();
|
|
217
|
+
debug_default("scanned files %O", filesList);
|
|
218
|
+
const sortedFiles = filesList.sort(naturalSort);
|
|
219
|
+
this.#files.clear();
|
|
220
|
+
for (let filePath of sortedFiles) {
|
|
221
|
+
filePath = string.toUnixSlash(filePath);
|
|
222
|
+
const relativePath = removeExtension(relative(this.#source, filePath));
|
|
223
|
+
this.#files.set(filePath, relativePath);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
has(filePath) {
|
|
227
|
+
if (this.#files.has(filePath)) return true;
|
|
228
|
+
if (!filePath.startsWith(this.#source)) return false;
|
|
229
|
+
return this.#matcher(filePath);
|
|
230
|
+
}
|
|
231
|
+
asList(options) {
|
|
232
|
+
const list = {};
|
|
233
|
+
const transformKey = options?.transformKey ?? BYPASS_FN;
|
|
234
|
+
const transformValue = options?.transformValue ?? BYPASS_FN;
|
|
235
|
+
for (const [filePath, relativePath] of this.#files) list[transformKey(relativePath)] = transformValue(filePath);
|
|
236
|
+
return list;
|
|
237
|
+
}
|
|
238
|
+
asTree(options) {
|
|
239
|
+
const list = {};
|
|
240
|
+
const transformKey = options?.transformKey ?? BYPASS_FN;
|
|
241
|
+
const transformValue = options?.transformValue ?? BYPASS_FN;
|
|
242
|
+
for (const [filePath, relativePath] of this.#files) {
|
|
243
|
+
const key = transformKey(relativePath);
|
|
244
|
+
lodash.set(list, key.split("/"), transformValue(filePath, key));
|
|
245
|
+
}
|
|
246
|
+
return list;
|
|
247
|
+
}
|
|
248
|
+
add(filePath) {
|
|
249
|
+
if (this.has(filePath)) {
|
|
250
|
+
debug_default("adding new \"%s\" file to the virtual file system", filePath);
|
|
251
|
+
const relativePath = removeExtension(relative(this.#source, filePath));
|
|
252
|
+
this.#files.set(filePath, relativePath);
|
|
253
|
+
return true;
|
|
254
|
+
}
|
|
255
|
+
return false;
|
|
256
|
+
}
|
|
257
|
+
remove(filePath) {
|
|
258
|
+
debug_default("removing \"%s\" file from virtual file system", filePath);
|
|
259
|
+
return this.#files.delete(filePath);
|
|
260
|
+
}
|
|
261
|
+
async get(filePath) {
|
|
262
|
+
const cached = this.#astCache.get(filePath);
|
|
263
|
+
if (cached) {
|
|
264
|
+
debug_default("returning AST nodes from cache \"%s\"", filePath);
|
|
265
|
+
return cached;
|
|
266
|
+
}
|
|
267
|
+
const fileContents = await readFile(filePath, "utf-8");
|
|
268
|
+
debug_default("parsing \"%s\" file to AST", filePath);
|
|
269
|
+
this.#astCache.set(filePath, parse(Lang.TypeScript, fileContents).root());
|
|
270
|
+
return this.#astCache.get(filePath);
|
|
271
|
+
}
|
|
272
|
+
invalidate(filePath) {
|
|
273
|
+
if (filePath) {
|
|
274
|
+
debug_default("invalidate AST cache \"%s\"", filePath);
|
|
275
|
+
this.#astCache.delete(filePath);
|
|
276
|
+
} else {
|
|
277
|
+
debug_default("clear AST cache");
|
|
278
|
+
this.#astCache.clear();
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
clear() {
|
|
282
|
+
this.#files.clear();
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
export { loadHooks as a, readTsConfig as c, runNode as d, throttle as f, isRelative as i, removeExtension as l, debug_default as m, copyFiles as n, memoize as o, watch as p, getPort as r, parseConfig as s, VirtualFileSystem as t, run as u };
|
package/package.json
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonisjs/assembler",
|
|
3
3
|
"description": "Provides utilities to run AdonisJS development server and build project for production",
|
|
4
|
-
"version": "8.0.0-next.
|
|
4
|
+
"version": "8.0.0-next.30",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=24.0.0"
|
|
7
7
|
},
|
|
8
|
-
"imports": {
|
|
9
|
-
"#tests/*": "./tests/*.ts"
|
|
10
|
-
},
|
|
11
8
|
"main": "build/index.js",
|
|
12
9
|
"type": "module",
|
|
13
10
|
"files": [
|
|
@@ -19,6 +16,8 @@
|
|
|
19
16
|
".": "./build/index.js",
|
|
20
17
|
"./code_transformer": "./build/src/code_transformer/main.js",
|
|
21
18
|
"./routes_scanner": "./build/src/code_scanners/routes_scanner/main.js",
|
|
19
|
+
"./index_generator": "./build/src/index_generator/main.js",
|
|
20
|
+
"./helpers": "./build/src/helpers.js",
|
|
22
21
|
"./types": "./build/src/types/main.js"
|
|
23
22
|
},
|
|
24
23
|
"scripts": {
|
|
@@ -29,56 +28,61 @@
|
|
|
29
28
|
"clean": "del-cli build",
|
|
30
29
|
"typecheck": "tsc --noEmit",
|
|
31
30
|
"precompile": "npm run lint && npm run clean",
|
|
32
|
-
"compile": "
|
|
31
|
+
"compile": "tsdown && tsc --emitDeclarationOnly --declaration",
|
|
33
32
|
"build": "npm run compile",
|
|
33
|
+
"docs": "typedoc",
|
|
34
34
|
"release": "release-it",
|
|
35
35
|
"version": "npm run build",
|
|
36
36
|
"prepublishOnly": "npm run build",
|
|
37
|
-
"quick:test": "cross-env NODE_DEBUG=adonisjs:assembler node --enable-source-maps --import=@poppinss/ts-exec
|
|
37
|
+
"quick:test": "cross-env NODE_DEBUG=adonisjs:assembler node --enable-source-maps --import=@poppinss/ts-exec bin/test.ts"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@adonisjs/eslint-config": "^3.0.0-next.
|
|
40
|
+
"@adonisjs/eslint-config": "^3.0.0-next.9",
|
|
41
41
|
"@adonisjs/prettier-config": "^1.4.5",
|
|
42
|
-
"@adonisjs/tsconfig": "^2.0.0-next.
|
|
43
|
-
"@japa/assert": "^4.
|
|
44
|
-
"@japa/file-system": "^
|
|
45
|
-
"@japa/runner": "^
|
|
46
|
-
"@japa/snapshot": "^2.0.
|
|
42
|
+
"@adonisjs/tsconfig": "^2.0.0-next.3",
|
|
43
|
+
"@japa/assert": "^4.2.0",
|
|
44
|
+
"@japa/file-system": "^3.0.0",
|
|
45
|
+
"@japa/runner": "^5.0.0",
|
|
46
|
+
"@japa/snapshot": "^2.0.10",
|
|
47
47
|
"@poppinss/ts-exec": "^1.4.1",
|
|
48
|
-
"@release-it/conventional-changelog": "^10.0.
|
|
49
|
-
"@types/node": "^
|
|
48
|
+
"@release-it/conventional-changelog": "^10.0.4",
|
|
49
|
+
"@types/node": "^25.0.5",
|
|
50
50
|
"@types/picomatch": "^4.0.2",
|
|
51
51
|
"@types/pretty-hrtime": "^1.0.3",
|
|
52
52
|
"c8": "^10.1.3",
|
|
53
|
-
"cross-env": "^10.
|
|
54
|
-
"del-cli": "^
|
|
55
|
-
"eslint": "^9.
|
|
56
|
-
"hot-hook": "^0.4.1-next.
|
|
57
|
-
"p-event": "^
|
|
58
|
-
"prettier": "^3.
|
|
59
|
-
"release-it": "^19.
|
|
60
|
-
"
|
|
61
|
-
"
|
|
53
|
+
"cross-env": "^10.1.0",
|
|
54
|
+
"del-cli": "^7.0.0",
|
|
55
|
+
"eslint": "^9.39.2",
|
|
56
|
+
"hot-hook": "^0.4.1-next.2",
|
|
57
|
+
"p-event": "^7.0.2",
|
|
58
|
+
"prettier": "^3.7.4",
|
|
59
|
+
"release-it": "^19.2.3",
|
|
60
|
+
"tsdown": "^0.19.0",
|
|
61
|
+
"typedoc": "^0.28.15",
|
|
62
|
+
"typescript": "^5.9.3"
|
|
62
63
|
},
|
|
63
64
|
"dependencies": {
|
|
64
|
-
"@adonisjs/env": "^
|
|
65
|
+
"@adonisjs/env": "^7.0.0-next.3",
|
|
65
66
|
"@antfu/install-pkg": "^1.1.0",
|
|
66
|
-
"@ast-grep/napi": "^0.
|
|
67
|
-
"@poppinss/cliui": "^6.
|
|
68
|
-
"@poppinss/hooks": "^7.
|
|
69
|
-
"@poppinss/utils": "^7.0.0-next.
|
|
70
|
-
"chokidar": "^
|
|
71
|
-
"dedent": "^1.
|
|
72
|
-
"execa": "^9.6.
|
|
67
|
+
"@ast-grep/napi": "^0.40.4",
|
|
68
|
+
"@poppinss/cliui": "^6.6.0",
|
|
69
|
+
"@poppinss/hooks": "^7.3.0",
|
|
70
|
+
"@poppinss/utils": "^7.0.0-next.5",
|
|
71
|
+
"chokidar": "^5.0.0",
|
|
72
|
+
"dedent": "^1.7.1",
|
|
73
|
+
"execa": "^9.6.1",
|
|
73
74
|
"fast-glob": "^3.3.3",
|
|
75
|
+
"fdir": "^6.5.0",
|
|
74
76
|
"get-port": "^7.1.0",
|
|
77
|
+
"get-tsconfig": "^4.13.0",
|
|
78
|
+
"import-meta-resolve": "^4.2.0",
|
|
75
79
|
"junk": "^4.0.1",
|
|
76
|
-
"open": "^
|
|
77
|
-
"parse-imports": "^
|
|
80
|
+
"open": "^11.0.0",
|
|
81
|
+
"parse-imports": "^3.0.0",
|
|
78
82
|
"picomatch": "^4.0.3",
|
|
79
83
|
"pretty-hrtime": "^1.0.3",
|
|
80
84
|
"tmp-cache": "^1.1.0",
|
|
81
|
-
"ts-morph": "^
|
|
85
|
+
"ts-morph": "^27.0.2"
|
|
82
86
|
},
|
|
83
87
|
"peerDependencies": {
|
|
84
88
|
"typescript": "^4.0.0 || ^5.0.0"
|
|
@@ -101,17 +105,23 @@
|
|
|
101
105
|
"publishConfig": {
|
|
102
106
|
"provenance": true
|
|
103
107
|
},
|
|
104
|
-
"
|
|
108
|
+
"tsdown": {
|
|
105
109
|
"entry": [
|
|
106
110
|
"./index.ts",
|
|
107
111
|
"./src/types/main.ts",
|
|
112
|
+
"./src/helpers.ts",
|
|
113
|
+
"./src/code_scanners/routes_scanner/main.ts",
|
|
114
|
+
"./src/index_generator/main.ts",
|
|
108
115
|
"./src/code_transformer/main.ts"
|
|
109
116
|
],
|
|
110
117
|
"outDir": "./build",
|
|
111
118
|
"clean": true,
|
|
112
119
|
"format": "esm",
|
|
120
|
+
"minify": "dce-only",
|
|
121
|
+
"fixedExtension": false,
|
|
113
122
|
"dts": false,
|
|
114
|
-
"
|
|
123
|
+
"treeshake": false,
|
|
124
|
+
"sourcemaps": false,
|
|
115
125
|
"target": "esnext"
|
|
116
126
|
},
|
|
117
127
|
"release-it": {
|
package/build/chunk-RR4HCA4M.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { type SgNode } from '@ast-grep/napi';
|
|
2
|
-
/**
|
|
3
|
-
* An abstraction around converting files to an AST and caching
|
|
4
|
-
* them forever. The cache could be cleared manually.
|
|
5
|
-
*/
|
|
6
|
-
export declare class AstFileSystem {
|
|
7
|
-
#private;
|
|
8
|
-
/**
|
|
9
|
-
* Returns the file contents as AST-grep node and caches it
|
|
10
|
-
* forever.
|
|
11
|
-
*/
|
|
12
|
-
get(filePath: string): Promise<SgNode>;
|
|
13
|
-
/**
|
|
14
|
-
* Clear AST cache for a single file or all the files
|
|
15
|
-
*/
|
|
16
|
-
clear(filePath?: string): void;
|
|
17
|
-
}
|