@adonisjs/assembler 8.0.0-next.28 → 8.0.0-next.29
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.
|
@@ -139,7 +139,7 @@ export default defineConfig({
|
|
|
139
139
|
}`);
|
|
140
140
|
return this;
|
|
141
141
|
}
|
|
142
|
-
addAssemblerHook(type,
|
|
142
|
+
addAssemblerHook(type, value, raw = false) {
|
|
143
143
|
const hooks = this.#getPropertyAssignmentInDefineConfigCall("hooks", "{}").getInitializerIfKindOrThrow(SyntaxKind.ObjectLiteralExpression);
|
|
144
144
|
let hookArray = hooks.getProperty(type);
|
|
145
145
|
if (!hookArray) {
|
|
@@ -150,8 +150,25 @@ export default defineConfig({
|
|
|
150
150
|
hookArray = hooks.getProperty(type);
|
|
151
151
|
}
|
|
152
152
|
const hooksArray = hookArray.getInitializerIfKindOrThrow(SyntaxKind.ArrayLiteralExpression);
|
|
153
|
-
if (
|
|
154
|
-
|
|
153
|
+
if (raw) hooksArray.addElement(value);
|
|
154
|
+
else {
|
|
155
|
+
if (this.#extractModulesFromArray(hooksArray).includes(value)) return this;
|
|
156
|
+
hooksArray.addElement(`() => import('${value}')`);
|
|
157
|
+
}
|
|
158
|
+
return this;
|
|
159
|
+
}
|
|
160
|
+
addNamedImport(specifier, names) {
|
|
161
|
+
this.#getRcFileOrThrow().addImportDeclaration({
|
|
162
|
+
moduleSpecifier: specifier,
|
|
163
|
+
namedImports: names
|
|
164
|
+
});
|
|
165
|
+
return this;
|
|
166
|
+
}
|
|
167
|
+
addDefaultImport(specifier, name) {
|
|
168
|
+
this.#getRcFileOrThrow().addImportDeclaration({
|
|
169
|
+
moduleSpecifier: specifier,
|
|
170
|
+
defaultImport: name
|
|
171
|
+
});
|
|
155
172
|
return this;
|
|
156
173
|
}
|
|
157
174
|
getDirectory(key, defaultValue) {
|
|
@@ -82,12 +82,30 @@ export declare class RcFileTransformer {
|
|
|
82
82
|
addSuite(suiteName: string, files: string | string[], timeout?: number): this;
|
|
83
83
|
/**
|
|
84
84
|
* Add a new assembler hook
|
|
85
|
+
* The format `thunk` write `() => import(path)`.
|
|
85
86
|
*
|
|
86
87
|
* @param type - The type of hook to add
|
|
87
|
-
* @param
|
|
88
|
+
* @param value - The path to the hook file or value to write
|
|
89
|
+
* @param raw - Wether to write a thunk import or as raw value
|
|
88
90
|
* @returns This RcFileTransformer instance for method chaining
|
|
89
91
|
*/
|
|
90
|
-
addAssemblerHook(type: keyof Exclude<AssemblerRcFile['hooks'], undefined>,
|
|
92
|
+
addAssemblerHook(type: keyof Exclude<AssemblerRcFile['hooks'], undefined>, value: string, raw?: boolean): this;
|
|
93
|
+
/**
|
|
94
|
+
* Add a named import
|
|
95
|
+
*
|
|
96
|
+
* @param specifier - The module specifier to import
|
|
97
|
+
* @param names - Names to import from the module
|
|
98
|
+
* @returns This RcFileTransformer instance for method chaining
|
|
99
|
+
*/
|
|
100
|
+
addNamedImport(specifier: string, names: string[]): this;
|
|
101
|
+
/**
|
|
102
|
+
* Add a default import
|
|
103
|
+
*
|
|
104
|
+
* @param specifier - The module specifier to import
|
|
105
|
+
* @param name - Name of the default import
|
|
106
|
+
* @returns This RcFileTransformer instance for method chaining
|
|
107
|
+
*/
|
|
108
|
+
addDefaultImport(specifier: string, name: string): this;
|
|
91
109
|
/**
|
|
92
110
|
* Get a directory value from the directories configuration.
|
|
93
111
|
*
|
|
@@ -90,6 +90,14 @@ export type EnvValidationNode = {
|
|
|
90
90
|
*/
|
|
91
91
|
variables: Record<string, string>;
|
|
92
92
|
};
|
|
93
|
+
export type HookNode = {
|
|
94
|
+
type: 'thunk';
|
|
95
|
+
path: string;
|
|
96
|
+
} | {
|
|
97
|
+
type: 'import';
|
|
98
|
+
path: string;
|
|
99
|
+
name?: string;
|
|
100
|
+
};
|
|
93
101
|
/**
|
|
94
102
|
* The supported package managers for installing packages and managing lockfiles.
|
|
95
103
|
* Each package manager has specific lockfiles and install commands.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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.29",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=24.0.0"
|
|
7
7
|
},
|
|
@@ -37,7 +37,7 @@
|
|
|
37
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
42
|
"@adonisjs/tsconfig": "^2.0.0-next.3",
|
|
43
43
|
"@japa/assert": "^4.2.0",
|
|
@@ -62,12 +62,12 @@
|
|
|
62
62
|
"typescript": "^5.9.3"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@adonisjs/env": "^7.0.0-next.
|
|
65
|
+
"@adonisjs/env": "^7.0.0-next.3",
|
|
66
66
|
"@antfu/install-pkg": "^1.1.0",
|
|
67
67
|
"@ast-grep/napi": "^0.40.3",
|
|
68
68
|
"@poppinss/cliui": "^6.6.0",
|
|
69
69
|
"@poppinss/hooks": "^7.3.0",
|
|
70
|
-
"@poppinss/utils": "^7.0.0-next.
|
|
70
|
+
"@poppinss/utils": "^7.0.0-next.5",
|
|
71
71
|
"chokidar": "^5.0.0",
|
|
72
72
|
"dedent": "^1.7.1",
|
|
73
73
|
"execa": "^9.6.1",
|