@adonisjs/assembler 8.0.0-next.17 → 8.0.0-next.19
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/build/{chunk-YFDLKKOA.js → chunk-4452KFDQ.js} +1 -1
- package/build/{chunk-RSWZKA6F.js → chunk-CSRLGGAO.js} +8 -4
- package/build/{chunk-HRE5L24F.js → chunk-JFBQ4OEM.js} +4 -27
- package/build/index.js +13 -10
- package/build/src/code_scanners/routes_scanner/main.js +2 -2
- package/build/src/index_generator/main.js +2 -2
- package/build/src/paths_resolver.d.ts +1 -1
- package/build/src/types/common.d.ts +23 -0
- package/package.json +1 -1
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
VirtualFileSystem,
|
|
11
11
|
debug_default,
|
|
12
12
|
isRelative
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-JFBQ4OEM.js";
|
|
14
14
|
|
|
15
15
|
// src/code_scanners/routes_scanner/main.ts
|
|
16
16
|
import { cliui } from "@poppinss/cliui";
|
|
@@ -64,7 +64,7 @@ var PathsResolver = class {
|
|
|
64
64
|
* const path = resolver.resolve('#app/models/user')
|
|
65
65
|
* const path2 = resolver.resolve('@/utils/helper')
|
|
66
66
|
*/
|
|
67
|
-
resolve(specifier) {
|
|
67
|
+
resolve(specifier, rewriteAliasImportExtension = false) {
|
|
68
68
|
if (isRelative(specifier)) {
|
|
69
69
|
throw new Error("Cannot resolve relative paths using PathsResolver");
|
|
70
70
|
}
|
|
@@ -73,7 +73,11 @@ var PathsResolver = class {
|
|
|
73
73
|
if (cached) {
|
|
74
74
|
return cached;
|
|
75
75
|
}
|
|
76
|
-
|
|
76
|
+
let resolvedPath = fileURLToPath(this.#resolver(specifier, this.#appRoot));
|
|
77
|
+
if (rewriteAliasImportExtension && specifier.startsWith("#") && resolvedPath.endsWith(".js")) {
|
|
78
|
+
resolvedPath = resolvedPath.replace(/\.js$/, ".ts");
|
|
79
|
+
}
|
|
80
|
+
this.#resolvedPaths[cacheKey] = resolvedPath;
|
|
77
81
|
return this.#resolvedPaths[cacheKey];
|
|
78
82
|
}
|
|
79
83
|
};
|
|
@@ -264,7 +268,7 @@ var RoutesScanner = class {
|
|
|
264
268
|
return {
|
|
265
269
|
name,
|
|
266
270
|
method: method ?? "handle",
|
|
267
|
-
path: string2.toUnixSlash(this.pathsResolver.resolve(specifier)),
|
|
271
|
+
path: string2.toUnixSlash(this.pathsResolver.resolve(specifier, true)),
|
|
268
272
|
import: {
|
|
269
273
|
specifier,
|
|
270
274
|
type: "default",
|
|
@@ -73,14 +73,15 @@ function readTsConfig(cwd) {
|
|
|
73
73
|
const tsConfig = parseTsconfig(tsConfigPath);
|
|
74
74
|
if (tsConfig.include) {
|
|
75
75
|
tsConfig.include = tsConfig.include.map((resolvedPath) => {
|
|
76
|
-
return resolvedPath.replace(
|
|
76
|
+
return resolvedPath.replace(cwd, "");
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
79
|
if (tsConfig.exclude) {
|
|
80
80
|
tsConfig.exclude = tsConfig.exclude.map((resolvedPath) => {
|
|
81
|
-
return resolvedPath.replace(
|
|
81
|
+
return resolvedPath.replace(cwd, "");
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
|
+
debug_default("read tsconfig %O", tsConfig);
|
|
84
85
|
return {
|
|
85
86
|
path: tsConfigPath,
|
|
86
87
|
config: tsConfig
|
|
@@ -268,30 +269,6 @@ var VirtualFileSystem = class {
|
|
|
268
269
|
};
|
|
269
270
|
this.#matcher = picomatch(this.#options.glob ?? DEFAULT_GLOB, this.#picoMatchOptions);
|
|
270
271
|
}
|
|
271
|
-
/**
|
|
272
|
-
* Currently the PathsResolver relies on a non-standard way of resolving
|
|
273
|
-
* absolute paths or paths with subpath imports. Because of which, the
|
|
274
|
-
* on-disk file could be TypeScript, while the resolved filepath is
|
|
275
|
-
* JavaScript.
|
|
276
|
-
*
|
|
277
|
-
* To overcome this limitation, we start by first looking for a `.ts` file
|
|
278
|
-
* (because of high probability) and then look for `.js` file
|
|
279
|
-
*/
|
|
280
|
-
async #readTSOrJSFile(filePath) {
|
|
281
|
-
if (filePath.endsWith(".js")) {
|
|
282
|
-
try {
|
|
283
|
-
const contents = await readFile(filePath.replace(/\.js$/, ".ts"), "utf-8");
|
|
284
|
-
debug_default('read as TypeScript file "%s"', filePath);
|
|
285
|
-
return contents;
|
|
286
|
-
} catch (error) {
|
|
287
|
-
if (error.code === "ENOENT") {
|
|
288
|
-
return readFile(filePath, "utf-8");
|
|
289
|
-
}
|
|
290
|
-
throw error;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
return readFile(filePath, "utf-8");
|
|
294
|
-
}
|
|
295
272
|
/**
|
|
296
273
|
* Scans the filesystem to collect the files. Newly files must
|
|
297
274
|
* be added via the ".add" method.
|
|
@@ -406,7 +383,7 @@ var VirtualFileSystem = class {
|
|
|
406
383
|
debug_default('returning AST nodes from cache "%s"', filePath);
|
|
407
384
|
return cached;
|
|
408
385
|
}
|
|
409
|
-
const fileContents = await
|
|
386
|
+
const fileContents = await readFile(filePath, "utf-8");
|
|
410
387
|
debug_default('parsing "%s" file to AST', filePath);
|
|
411
388
|
this.#astCache.set(filePath, parse(Lang.TypeScript, fileContents).root());
|
|
412
389
|
return this.#astCache.get(filePath);
|
package/build/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
FileBuffer,
|
|
3
3
|
IndexGenerator
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-4452KFDQ.js";
|
|
5
5
|
import {
|
|
6
6
|
RoutesScanner
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-CSRLGGAO.js";
|
|
8
8
|
import "./chunk-TIKQQRMX.js";
|
|
9
9
|
import {
|
|
10
10
|
VirtualFileSystem,
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
runNode,
|
|
20
20
|
throttle,
|
|
21
21
|
watch
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-JFBQ4OEM.js";
|
|
23
23
|
|
|
24
24
|
// src/bundler.ts
|
|
25
25
|
import dedent from "dedent";
|
|
@@ -998,7 +998,7 @@ var DevServer = class _DevServer {
|
|
|
998
998
|
this.#handleFileChange(relativePath, absolutePath, "add");
|
|
999
999
|
});
|
|
1000
1000
|
this.#hooks.add("fileChanged", (relativePath, absolutePath, info) => {
|
|
1001
|
-
if (info.hotReloaded) {
|
|
1001
|
+
if (info.hotReloaded || !info.hotReloaded && !info.fullReload) {
|
|
1002
1002
|
this.#reScanRoutes(absolutePath);
|
|
1003
1003
|
}
|
|
1004
1004
|
this.#handleFileChange(relativePath, absolutePath, "update", info);
|
|
@@ -1091,20 +1091,23 @@ var DevServer = class _DevServer {
|
|
|
1091
1091
|
await this.#processRoutes(message.routesFileLocation);
|
|
1092
1092
|
} else if (this.#mode === "hmr" && this.#isHotHookMessage(message)) {
|
|
1093
1093
|
debug_default("received hot-hook message %O", message);
|
|
1094
|
-
const absolutePath = message.path ? string3.toUnixSlash(message.path) : "";
|
|
1095
|
-
const relativePath = relative3(this.cwdPath, absolutePath);
|
|
1096
1094
|
if (message.type === "hot-hook:file-changed") {
|
|
1097
|
-
const
|
|
1098
|
-
|
|
1095
|
+
const absolutePath = message.path ? string3.toUnixSlash(message.path) : "";
|
|
1096
|
+
const relativePath = relative3(this.cwdPath, absolutePath);
|
|
1097
|
+
if (message.action === "add") {
|
|
1099
1098
|
this.#hooks.runner("fileAdded").run(relativePath, absolutePath, this);
|
|
1100
|
-
} else if (action === "change") {
|
|
1099
|
+
} else if (message.action === "change") {
|
|
1101
1100
|
this.#hooks.runner("fileChanged").run(relativePath, absolutePath, _DevServer.#HOT_HOOK_CHANGE_INFO, this);
|
|
1102
|
-
} else if (action === "unlink") {
|
|
1101
|
+
} else if (message.action === "unlink") {
|
|
1103
1102
|
this.#hooks.runner("fileRemoved").run(relativePath, absolutePath, this);
|
|
1104
1103
|
}
|
|
1105
1104
|
} else if (message.type === "hot-hook:full-reload") {
|
|
1105
|
+
const absolutePath = message.path ? string3.toUnixSlash(message.path) : "";
|
|
1106
|
+
const relativePath = relative3(this.cwdPath, absolutePath);
|
|
1106
1107
|
this.#hooks.runner("fileChanged").run(relativePath, absolutePath, _DevServer.#HOT_HOOK_FULL_RELOAD_INFO, this);
|
|
1107
1108
|
} else if (message.type === "hot-hook:invalidated") {
|
|
1109
|
+
const absolutePath = message.paths[0] ? string3.toUnixSlash(message.paths[0]) : "";
|
|
1110
|
+
const relativePath = relative3(this.cwdPath, absolutePath);
|
|
1108
1111
|
this.#hooks.runner("fileChanged").run(relativePath, absolutePath, _DevServer.#HOT_HOOK_INVALIDATED_INFO, this);
|
|
1109
1112
|
}
|
|
1110
1113
|
}
|
|
@@ -37,5 +37,5 @@ export declare class PathsResolver {
|
|
|
37
37
|
* const path = resolver.resolve('#app/models/user')
|
|
38
38
|
* const path2 = resolver.resolve('@/utils/helper')
|
|
39
39
|
*/
|
|
40
|
-
resolve(specifier: string): string;
|
|
40
|
+
resolve(specifier: string, rewriteAliasImportExtension?: boolean): string;
|
|
41
41
|
}
|
|
@@ -343,3 +343,26 @@ export interface ShortcutsManagerOptions {
|
|
|
343
343
|
/** Callback functions for different shortcut actions */
|
|
344
344
|
callbacks: KeyboardShortcutsCallbacks;
|
|
345
345
|
}
|
|
346
|
+
export type AdonisJSServerReadyMessage = {
|
|
347
|
+
isAdonisJS: true;
|
|
348
|
+
environment: 'web';
|
|
349
|
+
port: number;
|
|
350
|
+
host: string;
|
|
351
|
+
duration?: [number, number];
|
|
352
|
+
};
|
|
353
|
+
export type AdonisJSRoutesSharedMessage = {
|
|
354
|
+
isAdonisJS: true;
|
|
355
|
+
routesFileLocation: string;
|
|
356
|
+
};
|
|
357
|
+
export type HotHookMessage = {
|
|
358
|
+
type: 'hot-hook:full-reload';
|
|
359
|
+
path: string;
|
|
360
|
+
shouldBeReloadable?: boolean;
|
|
361
|
+
} | {
|
|
362
|
+
type: 'hot-hook:invalidated';
|
|
363
|
+
paths: string[];
|
|
364
|
+
} | {
|
|
365
|
+
type: 'hot-hook:file-changed';
|
|
366
|
+
path: string;
|
|
367
|
+
action: 'change' | 'add' | 'unlink';
|
|
368
|
+
};
|
package/package.json
CHANGED