@adonisjs/assembler 7.6.0 → 7.7.0
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/index.js +13 -21
- package/build/index.js.map +1 -1
- package/build/src/bundler.d.ts +1 -1
- package/build/src/code_transformer/main.js +19 -0
- package/build/src/code_transformer/main.js.map +1 -1
- package/build/src/code_transformer/rc_file_transformer.d.ts +5 -1
- package/build/src/hooks.d.ts +2 -6
- package/build/src/types.d.ts +2 -2
- package/package.json +11 -12
package/build/index.js
CHANGED
|
@@ -36,9 +36,6 @@ var AssemblerHooks = class {
|
|
|
36
36
|
),
|
|
37
37
|
...(this.#config?.onSourceFileChanged || []).map(
|
|
38
38
|
async (node) => this.#hooks.add("onSourceFileChanged", await this.#resolveHookNode(node))
|
|
39
|
-
),
|
|
40
|
-
...(this.#config?.onHttpServerMessage || []).map(
|
|
41
|
-
async (node) => this.#hooks.add("onHttpServerMessage", await this.#resolveHookNode(node))
|
|
42
39
|
)
|
|
43
40
|
]);
|
|
44
41
|
}
|
|
@@ -79,12 +76,6 @@ var AssemblerHooks = class {
|
|
|
79
76
|
async onBuildCompleted(...args) {
|
|
80
77
|
await this.#hooks.runner("onBuildCompleted").run(...args);
|
|
81
78
|
}
|
|
82
|
-
/**
|
|
83
|
-
* When a message is received from the HTTP server process
|
|
84
|
-
*/
|
|
85
|
-
async onHttpServerMessage(...args) {
|
|
86
|
-
await this.#hooks.runner("onHttpServerMessage").run(...args);
|
|
87
|
-
}
|
|
88
79
|
};
|
|
89
80
|
|
|
90
81
|
// src/helpers.ts
|
|
@@ -218,20 +209,24 @@ async function copyFiles(files, cwd, outDir) {
|
|
|
218
209
|
|
|
219
210
|
// src/bundler.ts
|
|
220
211
|
var SUPPORT_PACKAGE_MANAGERS = {
|
|
221
|
-
npm: {
|
|
222
|
-
|
|
212
|
+
"npm": {
|
|
213
|
+
packageManagerFiles: ["package-lock.json"],
|
|
223
214
|
installCommand: 'npm ci --omit="dev"'
|
|
224
215
|
},
|
|
225
|
-
yarn: {
|
|
226
|
-
|
|
216
|
+
"yarn": {
|
|
217
|
+
packageManagerFiles: ["yarn.lock"],
|
|
227
218
|
installCommand: "yarn install --production"
|
|
228
219
|
},
|
|
229
|
-
|
|
230
|
-
|
|
220
|
+
"yarn@berry": {
|
|
221
|
+
packageManagerFiles: ["yarn.lock", ".yarn/**/*", ".yarnrc.yml"],
|
|
222
|
+
installCommand: "yarn workspaces focus --production"
|
|
223
|
+
},
|
|
224
|
+
"pnpm": {
|
|
225
|
+
packageManagerFiles: ["pnpm-lock.yaml"],
|
|
231
226
|
installCommand: "pnpm i --prod"
|
|
232
227
|
},
|
|
233
|
-
bun: {
|
|
234
|
-
|
|
228
|
+
"bun": {
|
|
229
|
+
packageManagerFiles: ["bun.lockb"],
|
|
235
230
|
installCommand: "bun install --production"
|
|
236
231
|
}
|
|
237
232
|
};
|
|
@@ -392,7 +387,7 @@ var Bundler = class {
|
|
|
392
387
|
return false;
|
|
393
388
|
}
|
|
394
389
|
const pkgManager = await this.#getPackageManager(client);
|
|
395
|
-
const pkgFiles = pkgManager ? ["package.json", pkgManager.
|
|
390
|
+
const pkgFiles = pkgManager ? ["package.json", ...pkgManager.packageManagerFiles] : ["package.json"];
|
|
396
391
|
this.#logger.info("copying meta files to the output directory");
|
|
397
392
|
await this.#copyMetaFiles(outDir, pkgFiles);
|
|
398
393
|
this.#logger.success("build completed");
|
|
@@ -632,9 +627,6 @@ var DevServer = class {
|
|
|
632
627
|
scriptArgs: this.#options.scriptArgs
|
|
633
628
|
});
|
|
634
629
|
this.#httpServer.on("message", async (message) => {
|
|
635
|
-
this.#hooks.onHttpServerMessage(hooksArgs, message, {
|
|
636
|
-
restartServer: () => this.#restartHTTPServer(port)
|
|
637
|
-
});
|
|
638
630
|
if (this.#isHotHookMessage(message)) {
|
|
639
631
|
const path = relative3(fileURLToPath3(this.#cwd), message.path || message.paths?.[0]);
|
|
640
632
|
this.#hooks.onSourceFileChanged(hooksArgs, path);
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/bundler.ts","../src/hooks.ts","../src/helpers.ts","../src/debug.ts","../src/dev_server.ts","../src/assets_dev_server.ts","../src/test_runner.ts"],"sourcesContent":["/*\n * @adonisjs/assembler\n *\n * (c) AdonisJS\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport slash from 'slash'\nimport dedent from 'dedent'\nimport fs from 'node:fs/promises'\nimport type tsStatic from 'typescript'\nimport { fileURLToPath } from 'node:url'\nimport { join, relative } from 'node:path'\nimport { cliui, type Logger } from '@poppinss/cliui'\nimport { detectPackageManager } from '@antfu/install-pkg'\n\nimport { AssemblerHooks } from './hooks.js'\nimport type { BundlerOptions } from './types.js'\nimport { run, parseConfig, copyFiles } from './helpers.js'\n\ntype SupportedPackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun'\n\n/**\n * List of package managers we support in order to\n * copy lockfiles\n */\nconst SUPPORT_PACKAGE_MANAGERS: {\n [K in SupportedPackageManager]: {\n lockFile: string\n installCommand: string\n }\n} = {\n npm: {\n lockFile: 'package-lock.json',\n installCommand: 'npm ci --omit=\"dev\"',\n },\n yarn: {\n lockFile: 'yarn.lock',\n installCommand: 'yarn install --production',\n },\n pnpm: {\n lockFile: 'pnpm-lock.yaml',\n installCommand: 'pnpm i --prod',\n },\n bun: {\n lockFile: 'bun.lockb',\n installCommand: 'bun install --production',\n },\n}\n\n/**\n * Instance of CLIUI\n */\nconst ui = cliui()\n\n/**\n * The bundler class exposes the API to build an AdonisJS project.\n */\nexport class Bundler {\n #cwd: URL\n #cwdPath: string\n #ts: typeof tsStatic\n #logger = ui.logger\n #hooks: AssemblerHooks\n #options: BundlerOptions\n\n /**\n * Getting reference to colors library from logger\n */\n get #colors() {\n return this.#logger.getColors()\n }\n\n constructor(cwd: URL, ts: typeof tsStatic, options: BundlerOptions) {\n this.#cwd = cwd\n this.#cwdPath = fileURLToPath(this.#cwd)\n this.#ts = ts\n this.#options = options\n this.#hooks = new AssemblerHooks(options.hooks)\n }\n\n /**\n * Returns the relative unix path for an absolute\n * file path\n */\n #getRelativeName(filePath: string) {\n return slash(relative(this.#cwdPath, filePath))\n }\n\n /**\n * Cleans up the build directory\n */\n async #cleanupBuildDirectory(outDir: string) {\n await fs.rm(outDir, { recursive: true, force: true, maxRetries: 5 })\n }\n\n /**\n * Runs assets bundler command to build assets\n */\n async #buildAssets(): Promise<boolean> {\n const assetsBundler = this.#options.assets\n if (!assetsBundler?.enabled) {\n return true\n }\n\n try {\n this.#logger.info('compiling frontend assets', { suffix: assetsBundler.cmd })\n await run(this.#cwd, {\n stdio: 'inherit',\n script: assetsBundler.cmd,\n scriptArgs: assetsBundler.args,\n })\n return true\n } catch {\n return false\n }\n }\n\n /**\n * Runs tsc command to build the source.\n */\n async #runTsc(outDir: string): Promise<boolean> {\n try {\n await run(this.#cwd, {\n stdio: 'inherit',\n script: 'tsc',\n scriptArgs: ['--outDir', outDir],\n })\n return true\n } catch {\n return false\n }\n }\n\n /**\n * Copy meta files to the output directory\n */\n async #copyMetaFiles(outDir: string, additionalFilesToCopy: string[]) {\n const metaFiles = (this.#options.metaFiles || [])\n .map((file) => file.pattern)\n .concat(additionalFilesToCopy)\n\n await copyFiles(metaFiles, this.#cwdPath, outDir)\n }\n\n /**\n * Detect the package manager used by the project\n * and return the lockfile name and install command\n * related to it.\n */\n async #getPackageManager(client?: SupportedPackageManager) {\n let pkgManager: string | null | undefined = client\n\n if (!pkgManager) {\n pkgManager = await detectPackageManager(this.#cwdPath)\n }\n if (!pkgManager) {\n pkgManager = 'npm'\n }\n\n if (!Object.keys(SUPPORT_PACKAGE_MANAGERS).includes(pkgManager)) {\n return null\n }\n\n return SUPPORT_PACKAGE_MANAGERS[pkgManager as SupportedPackageManager]\n }\n\n /**\n * Rewrite the ace file since the original one\n * is importing ts-node which is not installed\n * in a production environment.\n */\n async #createAceFile(outDir: string) {\n const aceFileLocation = join(outDir, 'ace.js')\n const aceFileContent = dedent(/* JavaScript */ `\n /**\n * This file is auto-generated by the build process.\n * If you had any custom code inside this file, then\n * instead write it inside the \"bin/console.js\" file.\n */\n\n await import('./bin/console.js')\n `)\n\n await fs.writeFile(aceFileLocation, aceFileContent)\n this.#logger.info('rewrited ace file', { suffix: this.#getRelativeName(aceFileLocation) })\n }\n\n /**\n * Set a custom CLI UI logger\n */\n setLogger(logger: Logger) {\n this.#logger = logger\n return this\n }\n\n /**\n * Bundles the application to be run in production\n */\n async bundle(stopOnError: boolean = true, client?: SupportedPackageManager): Promise<boolean> {\n await this.#hooks.registerBuildHooks()\n\n /**\n * Step 1: Parse config file to get the build output directory\n */\n const config = parseConfig(this.#cwd, this.#ts)\n if (!config) {\n return false\n }\n\n /**\n * Step 2: Cleanup existing build directory (if any)\n */\n const outDir = config.options.outDir || fileURLToPath(new URL('build/', this.#cwd))\n this.#logger.info('cleaning up output directory', { suffix: this.#getRelativeName(outDir) })\n await this.#cleanupBuildDirectory(outDir)\n\n /**\n * Step 3: Build frontend assets\n */\n if (!(await this.#buildAssets())) {\n return false\n }\n\n /**\n * Step 4: Execute build starting hook\n */\n await this.#hooks.onBuildStarting({ colors: ui.colors, logger: this.#logger })\n\n /**\n * Step 5: Build typescript source code\n */\n this.#logger.info('compiling typescript source', { suffix: 'tsc' })\n const buildCompleted = await this.#runTsc(outDir)\n await this.#createAceFile(outDir)\n\n /**\n * Remove incomplete build directory when tsc build\n * failed and stopOnError is set to true.\n */\n if (!buildCompleted && stopOnError) {\n await this.#cleanupBuildDirectory(outDir)\n const instructions = ui\n .sticker()\n .fullScreen()\n .drawBorder((borderChar, colors) => colors.red(borderChar))\n\n instructions.add(\n this.#colors.red('Cannot complete the build process as there are TypeScript errors.')\n )\n instructions.add(\n this.#colors.red(\n 'Use \"--ignore-ts-errors\" flag to ignore TypeScript errors and continue the build.'\n )\n )\n\n this.#logger.logError(instructions.prepare())\n return false\n }\n\n /**\n * Step 6: Copy meta files to the build directory\n */\n const pkgManager = await this.#getPackageManager(client)\n const pkgFiles = pkgManager ? ['package.json', pkgManager.lockFile] : ['package.json']\n this.#logger.info('copying meta files to the output directory')\n await this.#copyMetaFiles(outDir, pkgFiles)\n\n this.#logger.success('build completed')\n this.#logger.log('')\n\n /**\n * Step 7: Execute build completed hook\n */\n await this.#hooks.onBuildCompleted({ colors: ui.colors, logger: this.#logger })\n\n /**\n * Next steps\n */\n ui.instructions()\n .useRenderer(this.#logger.getRenderer())\n .heading('Run the following commands to start the server in production')\n .add(this.#colors.cyan(`cd ${this.#getRelativeName(outDir)}`))\n .add(\n this.#colors.cyan(\n pkgManager ? pkgManager.installCommand : 'Install production dependencies'\n )\n )\n .add(this.#colors.cyan('node bin/server.js'))\n .render()\n\n return true\n }\n}\n","/*\n * @adonisjs/assembler\n *\n * (c) AdonisJS\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport {\n RcFile,\n AssemblerHookNode,\n AssemblerHookHandler,\n HttpServerMessageHookHandler,\n SourceFileChangedHookHandler,\n} from '@adonisjs/application/types'\nimport { RuntimeException } from '@poppinss/utils'\nimport Hooks from '@poppinss/hooks'\n\nexport class AssemblerHooks {\n #config: RcFile['unstable_assembler']\n\n #hooks = new Hooks<{\n onBuildStarting: [Parameters<AssemblerHookHandler>, []]\n onBuildCompleted: [Parameters<AssemblerHookHandler>, []]\n onDevServerStarted: [Parameters<AssemblerHookHandler>, []]\n onSourceFileChanged: [Parameters<SourceFileChangedHookHandler>, []]\n onHttpServerMessage: [Parameters<HttpServerMessageHookHandler>, []]\n }>()\n\n constructor(config: RcFile['unstable_assembler']) {\n this.#config = config\n }\n\n /**\n * Resolve the hook by importing the file and returning the default export\n */\n async #resolveHookNode(node: AssemblerHookNode<any>) {\n const exports = await node()\n\n if (!exports.default) {\n throw new RuntimeException('Assembler hook must be defined using the default export')\n }\n\n return exports.default\n }\n\n /**\n * Resolve hooks needed for dev-time and register them to the Hooks instance\n */\n async registerDevServerHooks() {\n await Promise.all([\n ...(this.#config?.onDevServerStarted || []).map(async (node) =>\n this.#hooks.add('onDevServerStarted', await this.#resolveHookNode(node))\n ),\n ...(this.#config?.onSourceFileChanged || []).map(async (node) =>\n this.#hooks.add('onSourceFileChanged', await this.#resolveHookNode(node))\n ),\n ...(this.#config?.onHttpServerMessage || []).map(async (node) =>\n this.#hooks.add('onHttpServerMessage', await this.#resolveHookNode(node))\n ),\n ])\n }\n\n /**\n * Resolve hooks needed for build-time and register them to the Hooks instance\n */\n async registerBuildHooks() {\n await Promise.all([\n ...(this.#config?.onBuildStarting || []).map(async (node) =>\n this.#hooks.add('onBuildStarting', await this.#resolveHookNode(node))\n ),\n ...(this.#config?.onBuildCompleted || []).map(async (node) =>\n this.#hooks.add('onBuildCompleted', await this.#resolveHookNode(node))\n ),\n ])\n }\n\n /**\n * When the dev server is started\n */\n async onDevServerStarted(...args: Parameters<AssemblerHookHandler>) {\n await this.#hooks.runner('onDevServerStarted').run(...args)\n }\n\n /**\n * When a source file changes\n */\n async onSourceFileChanged(...args: Parameters<SourceFileChangedHookHandler>) {\n await this.#hooks.runner('onSourceFileChanged').run(...args)\n }\n\n /**\n * When the build process is starting\n */\n async onBuildStarting(...args: Parameters<AssemblerHookHandler>) {\n await this.#hooks.runner('onBuildStarting').run(...args)\n }\n\n /**\n * When the build process is completed\n */\n async onBuildCompleted(...args: Parameters<AssemblerHookHandler>) {\n await this.#hooks.runner('onBuildCompleted').run(...args)\n }\n\n /**\n * When a message is received from the HTTP server process\n */\n async onHttpServerMessage(...args: Parameters<HttpServerMessageHookHandler>) {\n await this.#hooks.runner('onHttpServerMessage').run(...args)\n }\n}\n","/*\n * @adonisjs/assembler\n *\n * (c) AdonisJS\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport { isJunk } from 'junk'\nimport fastGlob from 'fast-glob'\nimport getRandomPort from 'get-port'\nimport { existsSync } from 'node:fs'\nimport type tsStatic from 'typescript'\nimport { fileURLToPath } from 'node:url'\nimport { execaNode, execa } from 'execa'\nimport { copyFile, mkdir } from 'node:fs/promises'\nimport { EnvLoader, EnvParser } from '@adonisjs/env'\nimport { ConfigParser, Watcher } from '@poppinss/chokidar-ts'\nimport { basename, dirname, isAbsolute, join, relative } from 'node:path'\n\nimport type { RunOptions, WatchOptions } from './types.js'\nimport debug from './debug.js'\n\n/**\n * Default set of args to pass in order to run TypeScript\n * source. Used by \"run\" and \"runNode\" scripts\n */\nconst DEFAULT_NODE_ARGS = [\n // Use ts-node/esm loader. The project must install it\n '--loader=ts-node/esm',\n // Enable source maps, since TSNode source maps are broken\n '--enable-source-maps',\n]\n\n/**\n * Disable experimental warnings, since the ts-node loader hook\n * uses an expiremental feature. We are waiting for them to\n * cut a new release and support the newer `--import` flag\n * instead\n */\nif (process.allowedNodeEnvironmentFlags.has('--disable-warning')) {\n // supported in node>=v21.13.0\n DEFAULT_NODE_ARGS.push('--disable-warning=ExperimentalWarning')\n} else {\n DEFAULT_NODE_ARGS.push('--no-warnings')\n}\n\n/**\n * Parses tsconfig.json and prints errors using typescript compiler\n * host\n */\nexport function parseConfig(cwd: string | URL, ts: typeof tsStatic) {\n const { config, error } = new ConfigParser(cwd, 'tsconfig.json', ts).parse()\n if (error) {\n const compilerHost = ts.createCompilerHost({})\n console.log(ts.formatDiagnosticsWithColorAndContext([error], compilerHost))\n return\n }\n\n if (config!.errors.length) {\n const compilerHost = ts.createCompilerHost({})\n console.log(ts.formatDiagnosticsWithColorAndContext(config!.errors, compilerHost))\n return\n }\n\n return config\n}\n\n/**\n * Runs a Node.js script as a child process and inherits the stdio streams\n */\nexport function runNode(cwd: string | URL, options: RunOptions) {\n const childProcess = execaNode(options.script, options.scriptArgs, {\n nodeOptions: DEFAULT_NODE_ARGS.concat(options.nodeArgs),\n preferLocal: true,\n windowsHide: false,\n localDir: cwd,\n cwd,\n buffer: false,\n stdio: options.stdio || 'inherit',\n env: {\n ...(options.stdio === 'pipe' ? { FORCE_COLOR: 'true' } : {}),\n ...options.env,\n },\n })\n\n return childProcess\n}\n\n/**\n * Runs a script as a child process and inherits the stdio streams\n */\nexport function run(cwd: string | URL, options: Omit<RunOptions, 'nodeArgs'>) {\n const childProcess = execa(options.script, options.scriptArgs, {\n preferLocal: true,\n windowsHide: false,\n localDir: cwd,\n cwd,\n buffer: false,\n stdio: options.stdio || 'inherit',\n env: {\n ...(options.stdio === 'pipe' ? { FORCE_COLOR: 'true' } : {}),\n ...options.env,\n },\n })\n\n return childProcess\n}\n\n/**\n * Watches the file system using tsconfig file\n */\nexport function watch(cwd: string | URL, ts: typeof tsStatic, options: WatchOptions) {\n const config = parseConfig(cwd, ts)\n if (!config) {\n return\n }\n\n const watcher = new Watcher(typeof cwd === 'string' ? cwd : fileURLToPath(cwd), config!)\n const chokidar = watcher.watch(['.'], { usePolling: options.poll })\n return { watcher, chokidar }\n}\n\n/**\n * Check if file is an .env file\n */\nexport function isDotEnvFile(filePath: string) {\n if (filePath === '.env') {\n return true\n }\n\n return filePath.includes('.env.')\n}\n\n/**\n * Returns the port to use after inspect the dot-env files inside\n * a given directory.\n *\n * A random port is used when the specified port is in use. Following\n * is the logic for finding a specified port.\n *\n * - The \"process.env.PORT\" value is used if exists.\n * - The dot-env files are loaded using the \"EnvLoader\" and the PORT\n * value is used by iterating over all the loaded files. The\n * iteration stops after first find.\n */\nexport async function getPort(cwd: URL): Promise<number> {\n /**\n * Use existing port if exists\n */\n if (process.env.PORT) {\n return getRandomPort({ port: Number(process.env.PORT) })\n }\n\n /**\n * Loop over files and use the port from their contents. Stops\n * after first match\n */\n const files = await new EnvLoader(cwd).load()\n for (let file of files) {\n const envVariables = await new EnvParser(file.contents).parse()\n if (envVariables.PORT) {\n return getRandomPort({ port: Number(envVariables.PORT) })\n }\n }\n\n /**\n * Use 3333 as the port\n */\n return getRandomPort({ port: 3333 })\n}\n\n/**\n * Helper function to copy files from relative paths or glob\n * patterns\n */\nexport async function copyFiles(files: string[], cwd: string, outDir: string) {\n /**\n * Looping over files and create a new collection with paths\n * and glob patterns\n */\n const { paths, patterns } = files.reduce<{ patterns: string[]; paths: string[] }>(\n (result, file) => {\n /**\n * If file is a glob pattern, then push it to patterns\n */\n if (fastGlob.isDynamicPattern(file)) {\n result.patterns.push(file)\n return result\n }\n\n /**\n * Otherwise, check if file exists and push it to paths to copy\n */\n if (existsSync(join(cwd, file))) {\n result.paths.push(file)\n }\n\n return result\n },\n { patterns: [], paths: [] }\n )\n\n debug('copyFiles inputs: %O, paths: %O, patterns: %O', files, paths, patterns)\n\n /**\n * Getting list of relative paths from glob patterns\n */\n const filePaths = paths.concat(await fastGlob(patterns, { cwd, dot: true })).filter((file) => {\n return !isJunk(basename(file))\n })\n\n /**\n * Finally copy files to the destination by keeping the same\n * directory structure and ignoring junk files\n */\n debug('copying files %O to destination \"%s\"', filePaths, outDir)\n const copyPromises = filePaths.map(async (file) => {\n const src = isAbsolute(file) ? file : join(cwd, file)\n const dest = join(outDir, relative(cwd, src))\n\n await mkdir(dirname(dest), { recursive: true })\n return copyFile(src, dest)\n })\n\n return await Promise.all(copyPromises)\n}\n","/*\n * @adonisjs/assembler\n *\n * (c) AdonisJS\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport { debuglog } from 'node:util'\n\nexport default debuglog('adonisjs:assembler')\n","/*\n * @adonisjs/assembler\n *\n * (c) AdonisJS\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport picomatch from 'picomatch'\nimport { relative } from 'node:path'\nimport type tsStatic from 'typescript'\nimport prettyHrtime from 'pretty-hrtime'\nimport { fileURLToPath } from 'node:url'\nimport { type ExecaChildProcess } from 'execa'\nimport { cliui, type Logger } from '@poppinss/cliui'\nimport type { Watcher } from '@poppinss/chokidar-ts'\n\nimport { AssemblerHooks } from './hooks.js'\nimport type { DevServerOptions } from './types.js'\nimport { AssetsDevServer } from './assets_dev_server.js'\nimport { getPort, isDotEnvFile, runNode, watch } from './helpers.js'\n\n/**\n * Instance of CLIUI\n */\nconst ui = cliui()\n\n/**\n * Exposes the API to start the development. Optionally, the watch API can be\n * used to watch for file changes and restart the development server.\n *\n * The Dev server performs the following actions\n *\n * - Assigns a random PORT, when PORT inside .env file is in use.\n * - Uses tsconfig.json file to collect a list of files to watch.\n * - Uses metaFiles from adonisrc.ts file to collect a list of files to watch.\n * - Restart HTTP server on every file change.\n */\nexport class DevServer {\n #cwd: URL\n #logger = ui.logger\n #options: DevServerOptions\n\n /**\n * Flag to know if the dev server is running in watch\n * mode\n */\n #isWatching: boolean = false\n\n /**\n * Script file to start the development server\n */\n #scriptFile: string = 'bin/server.js'\n\n /**\n * Picomatch matcher function to know if a file path is a\n * meta file with reloadServer option enabled\n */\n #isMetaFileWithReloadsEnabled: picomatch.Matcher\n\n /**\n * Picomatch matcher function to know if a file path is a\n * meta file with reloadServer option disabled\n */\n #isMetaFileWithReloadsDisabled: picomatch.Matcher\n\n /**\n * External listeners that are invoked when child process\n * gets an error or closes\n */\n #onError?: (error: any) => any\n #onClose?: (exitCode: number) => any\n\n /**\n * Reference to the child process\n */\n #httpServer?: ExecaChildProcess<string>\n\n /**\n * Reference to the watcher\n */\n #watcher?: ReturnType<Watcher['watch']>\n\n /**\n * Reference to the assets server\n */\n #assetsServer?: AssetsDevServer\n\n /**\n * Hooks to execute custom actions during the dev server lifecycle\n */\n #hooks: AssemblerHooks\n\n /**\n * Getting reference to colors library from logger\n */\n get #colors() {\n return this.#logger.getColors()\n }\n\n constructor(cwd: URL, options: DevServerOptions) {\n this.#cwd = cwd\n this.#options = options\n this.#hooks = new AssemblerHooks(options.hooks)\n if (this.#options.hmr) {\n this.#options.nodeArgs = this.#options.nodeArgs.concat(['--import=hot-hook/register'])\n }\n\n this.#isMetaFileWithReloadsEnabled = picomatch(\n (this.#options.metaFiles || [])\n .filter(({ reloadServer }) => reloadServer === true)\n .map(({ pattern }) => pattern)\n )\n\n this.#isMetaFileWithReloadsDisabled = picomatch(\n (this.#options.metaFiles || [])\n .filter(({ reloadServer }) => reloadServer !== true)\n .map(({ pattern }) => pattern)\n )\n }\n\n /**\n * Inspect if child process message is from AdonisJS HTTP server\n */\n #isAdonisJSReadyMessage(message: unknown): message is {\n isAdonisJS: true\n environment: 'web'\n port: number\n host: string\n duration?: [number, number]\n } {\n return (\n message !== null &&\n typeof message === 'object' &&\n 'isAdonisJS' in message &&\n 'environment' in message &&\n message.environment === 'web'\n )\n }\n\n /**\n * Inspect if child process message is coming from Hot Hook\n */\n #isHotHookMessage(message: unknown): message is {\n type: string\n path: string\n paths?: string[]\n } {\n return (\n message !== null &&\n typeof message === 'object' &&\n 'type' in message &&\n typeof message.type === 'string' &&\n message.type.startsWith('hot-hook:')\n )\n }\n\n /**\n * Conditionally clear the terminal screen\n */\n #clearScreen() {\n if (this.#options.clearScreen) {\n process.stdout.write('\\u001Bc')\n }\n }\n\n /**\n * Starts the HTTP server\n */\n #startHTTPServer(port: string, mode: 'blocking' | 'nonblocking') {\n const hooksArgs = { colors: this.#colors, logger: this.#logger }\n this.#httpServer = runNode(this.#cwd, {\n script: this.#scriptFile,\n env: { PORT: port, ...this.#options.env },\n nodeArgs: this.#options.nodeArgs,\n scriptArgs: this.#options.scriptArgs,\n })\n\n this.#httpServer.on('message', async (message) => {\n this.#hooks.onHttpServerMessage(hooksArgs, message, {\n restartServer: () => this.#restartHTTPServer(port),\n })\n\n /**\n * Handle Hot-Hook messages\n */\n if (this.#isHotHookMessage(message)) {\n const path = relative(fileURLToPath(this.#cwd), message.path || message.paths?.[0]!)\n this.#hooks.onSourceFileChanged(hooksArgs, path)\n\n if (message.type === 'hot-hook:full-reload') {\n this.#clearScreen()\n this.#logger.log(`${this.#colors.green('full-reload')} ${path}`)\n this.#restartHTTPServer(port)\n this.#hooks.onDevServerStarted(hooksArgs)\n } else if (message.type === 'hot-hook:invalidated') {\n this.#logger.log(`${this.#colors.green('invalidated')} ${path}`)\n }\n }\n\n /**\n * Handle AdonisJS ready message\n */\n if (this.#isAdonisJSReadyMessage(message)) {\n const host = message.host === '0.0.0.0' ? '127.0.0.1' : message.host\n\n const displayMessage = ui\n .sticker()\n .useColors(this.#colors)\n .useRenderer(this.#logger.getRenderer())\n .add(`Server address: ${this.#colors.cyan(`http://${host}:${message.port}`)}`)\n\n const watchMode = this.#options.hmr ? 'HMR' : this.#isWatching ? 'Legacy' : 'None'\n displayMessage.add(`Watch Mode: ${this.#colors.cyan(watchMode)}`)\n\n if (message.duration) {\n displayMessage.add(`Ready in: ${this.#colors.cyan(prettyHrtime(message.duration))}`)\n }\n\n displayMessage.render()\n\n await this.#hooks.onDevServerStarted({ colors: ui.colors, logger: this.#logger })\n }\n })\n\n this.#httpServer\n .then((result) => {\n if (mode === 'nonblocking') {\n this.#onClose?.(result.exitCode)\n this.#watcher?.close()\n this.#assetsServer?.stop()\n } else {\n this.#logger.info('Underlying HTTP server closed. Still watching for changes')\n }\n })\n .catch((error) => {\n if (mode === 'nonblocking') {\n this.#onError?.(error)\n this.#watcher?.close()\n this.#assetsServer?.stop()\n } else {\n this.#logger.info('Underlying HTTP server died. Still watching for changes')\n }\n })\n }\n\n /**\n * Starts the assets server\n */\n #startAssetsServer() {\n this.#assetsServer = new AssetsDevServer(this.#cwd, this.#options.assets)\n this.#assetsServer.setLogger(this.#logger)\n this.#assetsServer.start()\n }\n\n /**\n * Restarts the HTTP server in the watch mode. Do not call this\n * method when not in watch mode\n */\n #restartHTTPServer(port: string) {\n if (this.#httpServer) {\n this.#httpServer.removeAllListeners()\n this.#httpServer.kill('SIGKILL')\n }\n\n this.#startHTTPServer(port, 'blocking')\n }\n\n /**\n * Handles a non TypeScript file change\n */\n #handleFileChange(action: string, port: string, relativePath: string) {\n if (isDotEnvFile(relativePath)) {\n this.#clearScreen()\n this.#logger.log(`${this.#colors.green(action)} ${relativePath}`)\n this.#restartHTTPServer(port)\n return\n }\n\n if (this.#isMetaFileWithReloadsEnabled(relativePath)) {\n this.#clearScreen()\n this.#logger.log(`${this.#colors.green(action)} ${relativePath}`)\n this.#restartHTTPServer(port)\n return\n }\n\n if (this.#isMetaFileWithReloadsDisabled(relativePath)) {\n this.#clearScreen()\n this.#logger.log(`${this.#colors.green(action)} ${relativePath}`)\n }\n }\n\n /**\n * Handles TypeScript source file change\n */\n async #handleSourceFileChange(action: string, port: string, relativePath: string) {\n await this.#hooks.onSourceFileChanged({ colors: ui.colors, logger: this.#logger }, relativePath)\n\n this.#clearScreen()\n this.#logger.log(`${this.#colors.green(action)} ${relativePath}`)\n this.#restartHTTPServer(port)\n }\n\n /**\n * Set a custom CLI UI logger\n */\n setLogger(logger: Logger) {\n this.#logger = logger\n this.#assetsServer?.setLogger(logger)\n return this\n }\n\n /**\n * Add listener to get notified when dev server is\n * closed\n */\n onClose(callback: (exitCode: number) => any): this {\n this.#onClose = callback\n return this\n }\n\n /**\n * Add listener to get notified when dev server exists\n * with an error\n */\n onError(callback: (error: any) => any): this {\n this.#onError = callback\n return this\n }\n\n /**\n * Close watchers and running child processes\n */\n async close() {\n await this.#watcher?.close()\n this.#assetsServer?.stop()\n if (this.#httpServer) {\n this.#httpServer.removeAllListeners()\n this.#httpServer.kill('SIGKILL')\n }\n }\n\n /**\n * Start the development server\n */\n async start() {\n await this.#hooks.registerDevServerHooks()\n\n this.#clearScreen()\n this.#logger.info('starting HTTP server...')\n this.#startHTTPServer(String(await getPort(this.#cwd)), 'nonblocking')\n this.#startAssetsServer()\n }\n\n /**\n * Start the development server in watch mode\n */\n async startAndWatch(ts: typeof tsStatic, options?: { poll: boolean }) {\n await this.#hooks.registerDevServerHooks()\n\n const port = String(await getPort(this.#cwd))\n this.#isWatching = true\n\n this.#clearScreen()\n\n this.#logger.info('starting HTTP server...')\n this.#startHTTPServer(port, 'blocking')\n\n this.#startAssetsServer()\n\n /**\n * Create watcher using tsconfig.json file\n */\n const output = watch(this.#cwd, ts, options || {})\n if (!output) {\n this.#onClose?.(1)\n return\n }\n\n /**\n * Storing reference to watcher, so that we can close it\n * when HTTP server exists with error\n */\n this.#watcher = output.chokidar\n\n /**\n * Notify the watcher is ready\n */\n output.watcher.on('watcher:ready', () => {\n this.#logger.info('watching file system for changes...')\n })\n\n /**\n * Cleanup when watcher dies\n */\n output.chokidar.on('error', (error) => {\n this.#logger.warning('file system watcher failure')\n this.#logger.fatal(error)\n this.#onError?.(error)\n output.chokidar.close()\n })\n\n /**\n * Changes in TypeScript source file\n */\n output.watcher.on('source:add', ({ relativePath }) =>\n this.#handleSourceFileChange('add', port, relativePath)\n )\n output.watcher.on('source:change', ({ relativePath }) =>\n this.#handleSourceFileChange('update', port, relativePath)\n )\n output.watcher.on('source:unlink', ({ relativePath }) =>\n this.#handleSourceFileChange('delete', port, relativePath)\n )\n\n /**\n * Changes in non-TypeScript source files\n */\n output.watcher.on('add', ({ relativePath }) =>\n this.#handleFileChange('add', port, relativePath)\n )\n output.watcher.on('change', ({ relativePath }) =>\n this.#handleFileChange('update', port, relativePath)\n )\n output.watcher.on('unlink', ({ relativePath }) =>\n this.#handleFileChange('delete', port, relativePath)\n )\n }\n}\n","/*\n * @adonisjs/core\n *\n * (c) AdonisJS\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport type { ExecaChildProcess } from 'execa'\nimport { type Logger, cliui } from '@poppinss/cliui'\n\nimport { run } from './helpers.js'\nimport type { AssetsBundlerOptions } from './types.js'\n\n/**\n * Instance of CLIUI\n */\nconst ui = cliui()\n\n/**\n * Exposes the API to start the development server for processing assets during\n * development.\n *\n * - Here we are running the assets dev server in a child process.\n * - Piping the output from the child process and reformatting it before writing it to\n * process streams.\n *\n * AssetsDevServer is agnostic and can run any assets dev server. Be it Vite or Encore or\n * even Webpack directly.\n */\nexport class AssetsDevServer {\n #cwd: URL\n #logger = ui.logger\n #options?: AssetsBundlerOptions\n #devServer?: ExecaChildProcess<string>\n\n /**\n * Getting reference to colors library from logger\n */\n get #colors() {\n return this.#logger.getColors()\n }\n\n constructor(cwd: URL, options?: AssetsBundlerOptions) {\n this.#cwd = cwd\n this.#options = options\n }\n\n /**\n * Logs messages from vite dev server stdout and stderr\n */\n #logViteDevServerMessage(data: Buffer) {\n const dataString = data.toString()\n const lines = dataString.split('\\n')\n\n /**\n * Put a wrapper around vite network address log\n */\n if (dataString.includes('Local') && dataString.includes('Network')) {\n const sticker = ui.sticker().useColors(this.#colors).useRenderer(this.#logger.getRenderer())\n\n lines.forEach((line: string) => {\n if (line.trim()) {\n sticker.add(line)\n }\n })\n\n sticker.render()\n return\n }\n\n /**\n * Logging VITE ready in message with proper\n * spaces and newlines\n */\n if (dataString.includes('ready in')) {\n console.log('')\n console.log(dataString.trim())\n return\n }\n\n /**\n * Log rest of the lines\n */\n lines.forEach((line: string) => {\n if (line.trim()) {\n console.log(line)\n }\n })\n }\n\n /**\n * Logs messages from assets dev server stdout and stderr\n */\n #logAssetsDevServerMessage(data: Buffer) {\n const dataString = data.toString()\n const lines = dataString.split('\\n')\n lines.forEach((line: string) => {\n if (line.trim()) {\n console.log(line)\n }\n })\n }\n\n /**\n * Set a custom CLI UI logger\n */\n setLogger(logger: Logger) {\n this.#logger = logger\n return this\n }\n\n /**\n * Starts the assets bundler server. The assets bundler server process is\n * considered as the secondary process and therefore we do not perform\n * any cleanup if it dies.\n */\n start() {\n if (!this.#options?.enabled) {\n return\n }\n\n this.#logger.info(`starting \"${this.#options.driver}\" dev server...`)\n\n /**\n * Create child process\n */\n this.#devServer = run(this.#cwd, {\n script: this.#options.cmd,\n\n /**\n * We do not inherit the stdio for vite and encore, because in\n * inherit mode they own the stdin and interrupts the\n * `Ctrl + C` command.\n */\n stdio: 'pipe',\n scriptArgs: this.#options.args,\n })\n\n /**\n * Log child process messages\n */\n this.#devServer.stdout?.on('data', (data) => {\n if (this.#options!.driver === 'vite') {\n this.#logViteDevServerMessage(data)\n } else {\n this.#logAssetsDevServerMessage(data)\n }\n })\n\n this.#devServer.stderr?.on('data', (data) => {\n if (this.#options!.driver === 'vite') {\n this.#logViteDevServerMessage(data)\n } else {\n this.#logAssetsDevServerMessage(data)\n }\n })\n\n this.#devServer\n .then((result) => {\n this.#logger.warning(\n `\"${this.#options!.driver}\" dev server closed with status code \"${result.exitCode}\"`\n )\n })\n .catch((error) => {\n this.#logger.warning(`unable to connect to \"${this.#options!.driver}\" dev server`)\n this.#logger.fatal(error)\n })\n }\n\n /**\n * Stop the dev server\n */\n stop() {\n if (this.#devServer) {\n this.#devServer.removeAllListeners()\n this.#devServer.kill('SIGKILL')\n this.#devServer = undefined\n }\n }\n}\n","/*\n * @adonisjs/assembler\n *\n * (c) AdonisJS\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport picomatch from 'picomatch'\nimport type tsStatic from 'typescript'\nimport { type ExecaChildProcess } from 'execa'\nimport { cliui, type Logger } from '@poppinss/cliui'\nimport type { Watcher } from '@poppinss/chokidar-ts'\n\nimport type { TestRunnerOptions } from './types.js'\nimport { AssetsDevServer } from './assets_dev_server.js'\nimport { getPort, isDotEnvFile, runNode, watch } from './helpers.js'\n\n/**\n * Instance of CLIUI\n */\nconst ui = cliui()\n\n/**\n * Exposes the API to run Japa tests and optionally watch for file\n * changes to re-run the tests.\n *\n * The watch mode functions as follows.\n *\n * - If the changed file is a test file, then only tests for that file\n * will be re-run.\n * - Otherwise, all tests will re-run with respect to the initial\n * filters applied when running the `node ace test` command.\n *\n */\nexport class TestRunner {\n #cwd: URL\n #logger = ui.logger\n #options: TestRunnerOptions\n\n /**\n * The script file to run as a child process\n */\n #scriptFile: string = 'bin/test.js'\n\n /**\n * Pico matcher function to check if the filepath is\n * part of the `metaFiles` glob patterns\n */\n #isMetaFile: picomatch.Matcher\n\n /**\n * Pico matcher function to check if the filepath is\n * part of a test file.\n */\n #isTestFile: picomatch.Matcher\n\n /**\n * Arguments to pass to the \"bin/test.js\" file.\n */\n #scriptArgs: string[]\n\n /**\n * Set of initial filters applied when running the test\n * command. In watch mode, we will append an additional\n * filter to run tests only for the file that has been\n * changed.\n */\n #initialFiltersArgs: string[]\n\n /**\n * In watch mode, after a file is changed, we wait for the current\n * set of tests to finish before triggering a re-run. Therefore,\n * we use this flag to know if we are already busy in running\n * tests and ignore file-changes.\n */\n #isBusy: boolean = false\n\n /**\n * External listeners that are invoked when child process\n * gets an error or closes\n */\n #onError?: (error: any) => any\n #onClose?: (exitCode: number) => any\n\n /**\n * Reference to the test script child process\n */\n #testScript?: ExecaChildProcess<string>\n\n /**\n * Reference to the watcher\n */\n #watcher?: ReturnType<Watcher['watch']>\n\n /**\n * Reference to the assets server\n */\n #assetsServer?: AssetsDevServer\n\n /**\n * Getting reference to colors library from logger\n */\n get #colors() {\n return this.#logger.getColors()\n }\n\n constructor(cwd: URL, options: TestRunnerOptions) {\n this.#cwd = cwd\n this.#options = options\n\n this.#isMetaFile = picomatch((this.#options.metaFiles || []).map(({ pattern }) => pattern))\n\n /**\n * Create a test file watch by collection all the globs\n * used by all the suites. However, if a suite filter\n * was used, then we only collect glob for the mentioned\n * suites.\n */\n this.#isTestFile = picomatch(\n this.#options.suites\n .filter((suite) => {\n if (this.#options.filters.suites) {\n return this.#options.filters.suites.includes(suite.name)\n }\n return true\n })\n .map((suite) => suite.files)\n .flat(1)\n )\n\n this.#scriptArgs = this.#convertOptionsToArgs().concat(this.#options.scriptArgs)\n this.#initialFiltersArgs = this.#convertFiltersToArgs(this.#options.filters)\n }\n\n /**\n * Convert test runner options to the CLI args\n */\n #convertOptionsToArgs() {\n const args: string[] = []\n\n if (this.#options.reporters) {\n args.push('--reporters')\n args.push(this.#options.reporters.join(','))\n }\n\n if (this.#options.timeout !== undefined) {\n args.push('--timeout')\n args.push(String(this.#options.timeout))\n }\n\n if (this.#options.failed) {\n args.push('--failed')\n }\n\n if (this.#options.retries !== undefined) {\n args.push('--retries')\n args.push(String(this.#options.retries))\n }\n\n return args\n }\n\n /**\n * Converts all known filters to CLI args.\n *\n * The following code snippet may seem like repetitive code. But, it\n * is done intentionally to have visibility around how each filter\n * is converted to an arg.\n */\n #convertFiltersToArgs(filters: TestRunnerOptions['filters']): string[] {\n const args: string[] = []\n\n if (filters.suites) {\n args.push(...filters.suites)\n }\n\n if (filters.files) {\n args.push('--files')\n args.push(filters.files.join(','))\n }\n\n if (filters.groups) {\n args.push('--groups')\n args.push(filters.groups.join(','))\n }\n\n if (filters.tags) {\n args.push('--tags')\n args.push(filters.tags.join(','))\n }\n\n if (filters.tests) {\n args.push('--tests')\n args.push(filters.tests.join(','))\n }\n\n return args\n }\n\n /**\n * Conditionally clear the terminal screen\n */\n #clearScreen() {\n if (this.#options.clearScreen) {\n process.stdout.write('\\u001Bc')\n }\n }\n\n /**\n * Runs tests\n */\n #runTests(\n port: string,\n mode: 'blocking' | 'nonblocking',\n filters?: TestRunnerOptions['filters']\n ) {\n this.#isBusy = true\n\n /**\n * If inline filters are defined, then we ignore the\n * initial filters\n */\n const scriptArgs = filters\n ? this.#convertFiltersToArgs(filters).concat(this.#scriptArgs)\n : this.#initialFiltersArgs.concat(this.#scriptArgs)\n\n this.#testScript = runNode(this.#cwd, {\n script: this.#scriptFile,\n env: { PORT: port, ...this.#options.env },\n nodeArgs: this.#options.nodeArgs,\n scriptArgs,\n })\n\n this.#testScript\n .then((result) => {\n if (mode === 'nonblocking') {\n this.#onClose?.(result.exitCode)\n this.close()\n }\n })\n .catch((error) => {\n if (mode === 'nonblocking') {\n this.#onError?.(error)\n this.close()\n }\n })\n .finally(() => {\n this.#isBusy = false\n })\n }\n\n /**\n * Re-run tests with additional inline filters. Should be\n * executed in watch mode only.\n */\n #rerunTests(port: string, filters?: TestRunnerOptions['filters']) {\n if (this.#testScript) {\n this.#testScript.removeAllListeners()\n this.#testScript.kill('SIGKILL')\n }\n\n this.#runTests(port, 'blocking', filters)\n }\n\n /**\n * Starts the assets server\n */\n #startAssetsServer() {\n this.#assetsServer = new AssetsDevServer(this.#cwd, this.#options.assets)\n this.#assetsServer.setLogger(this.#logger)\n this.#assetsServer.start()\n }\n\n /**\n * Handles a non TypeScript file change\n */\n #handleFileChange(action: string, port: string, relativePath: string) {\n if (this.#isBusy) {\n return\n }\n\n if (isDotEnvFile(relativePath) || this.#isMetaFile(relativePath)) {\n this.#clearScreen()\n this.#logger.log(`${this.#colors.green(action)} ${relativePath}`)\n this.#rerunTests(port)\n }\n }\n\n /**\n * Handles TypeScript source file change\n */\n #handleSourceFileChange(action: string, port: string, relativePath: string) {\n if (this.#isBusy) {\n return\n }\n\n this.#clearScreen()\n this.#logger.log(`${this.#colors.green(action)} ${relativePath}`)\n\n /**\n * If changed file is a test file after considering the initial filters,\n * then only run that file\n */\n if (this.#isTestFile(relativePath)) {\n this.#rerunTests(port, {\n ...this.#options.filters,\n files: [relativePath],\n })\n return\n }\n\n this.#rerunTests(port)\n }\n\n /**\n * Set a custom CLI UI logger\n */\n setLogger(logger: Logger) {\n this.#logger = logger\n this.#assetsServer?.setLogger(logger)\n return this\n }\n\n /**\n * Add listener to get notified when dev server is\n * closed\n */\n onClose(callback: (exitCode: number) => any): this {\n this.#onClose = callback\n return this\n }\n\n /**\n * Add listener to get notified when dev server exists\n * with an error\n */\n onError(callback: (error: any) => any): this {\n this.#onError = callback\n return this\n }\n\n /**\n * Close watchers and running child processes\n */\n async close() {\n await this.#watcher?.close()\n this.#assetsServer?.stop()\n if (this.#testScript) {\n this.#testScript.removeAllListeners()\n this.#testScript.kill('SIGKILL')\n }\n }\n\n /**\n * Runs tests\n */\n async run() {\n const port = String(await getPort(this.#cwd))\n\n this.#clearScreen()\n this.#startAssetsServer()\n\n this.#logger.info('booting application to run tests...')\n this.#runTests(port, 'nonblocking')\n }\n\n /**\n * Run tests in watch mode\n */\n async runAndWatch(ts: typeof tsStatic, options?: { poll: boolean }) {\n const port = String(await getPort(this.#cwd))\n\n this.#clearScreen()\n this.#startAssetsServer()\n\n this.#logger.info('booting application to run tests...')\n this.#runTests(port, 'blocking')\n\n /**\n * Create watcher using tsconfig.json file\n */\n const output = watch(this.#cwd, ts, options || {})\n if (!output) {\n this.#onClose?.(1)\n return\n }\n\n /**\n * Storing reference to watcher, so that we can close it\n * when HTTP server exists with error\n */\n this.#watcher = output.chokidar\n\n /**\n * Notify the watcher is ready\n */\n output.watcher.on('watcher:ready', () => {\n this.#logger.info('watching file system for changes...')\n })\n\n /**\n * Cleanup when watcher dies\n */\n output.chokidar.on('error', (error) => {\n this.#logger.warning('file system watcher failure')\n this.#logger.fatal(error)\n this.#onError?.(error)\n output.chokidar.close()\n })\n\n /**\n * Changes in TypeScript source file\n */\n output.watcher.on('source:add', ({ relativePath }) =>\n this.#handleSourceFileChange('add', port, relativePath)\n )\n output.watcher.on('source:change', ({ relativePath }) =>\n this.#handleSourceFileChange('update', port, relativePath)\n )\n output.watcher.on('source:unlink', ({ relativePath }) =>\n this.#handleSourceFileChange('delete', port, relativePath)\n )\n\n /**\n * Changes in non-TypeScript source files\n */\n output.watcher.on('add', ({ relativePath }) =>\n this.#handleFileChange('add', port, relativePath)\n )\n output.watcher.on('change', ({ relativePath }) =>\n this.#handleFileChange('update', port, relativePath)\n )\n output.watcher.on('unlink', ({ relativePath }) =>\n this.#handleFileChange('delete', port, relativePath)\n )\n }\n}\n"],"mappings":";AASA,OAAO,WAAW;AAClB,OAAO,YAAY;AACnB,OAAO,QAAQ;AAEf,SAAS,iBAAAA,sBAAqB;AAC9B,SAAS,QAAAC,OAAM,YAAAC,iBAAgB;AAC/B,SAAS,aAA0B;AACnC,SAAS,4BAA4B;;;ACArC,SAAS,wBAAwB;AACjC,OAAO,WAAW;AAEX,IAAM,iBAAN,MAAqB;AAAA,EAC1B;AAAA,EAEA,SAAS,IAAI,MAMV;AAAA,EAEH,YAAY,QAAsC;AAChD,SAAK,UAAU;AAAA,EACjB;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,iBAAiB,MAA8B;AACnD,UAAM,UAAU,MAAM,KAAK;AAE3B,QAAI,CAAC,QAAQ,SAAS;AACpB,YAAM,IAAI,iBAAiB,yDAAyD;AAAA,IACtF;AAEA,WAAO,QAAQ;AAAA,E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AM,YAAY;AAAA,IAC3D;AAKA,WAAO,QAAQ;AAAA,MAAG;AAAA,MAAO,CAAC,EAAE,aAAa,MACvC,KAAK,kBAAkB,OAAO,MAAM,YAAY;AAAA,IAClD;AACA,WAAO,QAAQ;AAAA,MAAG;AAAA,MAAU,CAAC,EAAE,aAAa,MAC1C,KAAK,kBAAkB,UAAU,MAAM,YAAY;AAAA,IACrD;AACA,WAAO,QAAQ;AAAA,MAAG;AAAA,MAAU,CAAC,EAAE,aAAa,MAC1C,KAAK,kBAAkB,UAAU,MAAM,YAAY;AAAA,IACrD;AAAA,EACF;AACF;","names":["fileURLToPath","join","relative","fileURLToPath","relative","join","relative","fileURLToPath","cliui","cliui","ui","cliui","ui","cliui","relative","fileURLToPath","picomatch","cliui","ui","cliui","picomatch"]}
|
|
1
|
+
{"version":3,"sources":["../src/bundler.ts","../src/hooks.ts","../src/helpers.ts","../src/debug.ts","../src/dev_server.ts","../src/assets_dev_server.ts","../src/test_runner.ts"],"sourcesContent":["/*\n * @adonisjs/assembler\n *\n * (c) AdonisJS\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport slash from 'slash'\nimport dedent from 'dedent'\nimport fs from 'node:fs/promises'\nimport type tsStatic from 'typescript'\nimport { fileURLToPath } from 'node:url'\nimport { join, relative } from 'node:path'\nimport { cliui, type Logger } from '@poppinss/cliui'\nimport { detectPackageManager } from '@antfu/install-pkg'\n\nimport { AssemblerHooks } from './hooks.js'\nimport type { BundlerOptions } from './types.js'\nimport { run, parseConfig, copyFiles } from './helpers.js'\n\ntype SupportedPackageManager = 'npm' | 'yarn' | 'yarn@berry' | 'pnpm' | 'bun'\n\n/**\n * List of package managers we support in order to\n * copy lockfiles\n */\nconst SUPPORT_PACKAGE_MANAGERS: {\n [K in SupportedPackageManager]: {\n packageManagerFiles: string[]\n installCommand: string\n }\n} = {\n 'npm': {\n packageManagerFiles: ['package-lock.json'],\n installCommand: 'npm ci --omit=\"dev\"',\n },\n 'yarn': {\n packageManagerFiles: ['yarn.lock'],\n installCommand: 'yarn install --production',\n },\n 'yarn@berry': {\n packageManagerFiles: ['yarn.lock', '.yarn/**/*', '.yarnrc.yml'],\n installCommand: 'yarn workspaces focus --production',\n },\n 'pnpm': {\n packageManagerFiles: ['pnpm-lock.yaml'],\n installCommand: 'pnpm i --prod',\n },\n 'bun': {\n packageManagerFiles: ['bun.lockb'],\n installCommand: 'bun install --production',\n },\n}\n\n/**\n * Instance of CLIUI\n */\nconst ui = cliui()\n\n/**\n * The bundler class exposes the API to build an AdonisJS project.\n */\nexport class Bundler {\n #cwd: URL\n #cwdPath: string\n #ts: typeof tsStatic\n #logger = ui.logger\n #hooks: AssemblerHooks\n #options: BundlerOptions\n\n /**\n * Getting reference to colors library from logger\n */\n get #colors() {\n return this.#logger.getColors()\n }\n\n constructor(cwd: URL, ts: typeof tsStatic, options: BundlerOptions) {\n this.#cwd = cwd\n this.#cwdPath = fileURLToPath(this.#cwd)\n this.#ts = ts\n this.#options = options\n this.#hooks = new AssemblerHooks(options.hooks)\n }\n\n /**\n * Returns the relative unix path for an absolute\n * file path\n */\n #getRelativeName(filePath: string) {\n return slash(relative(this.#cwdPath, filePath))\n }\n\n /**\n * Cleans up the build directory\n */\n async #cleanupBuildDirectory(outDir: string) {\n await fs.rm(outDir, { recursive: true, force: true, maxRetries: 5 })\n }\n\n /**\n * Runs assets bundler command to build assets\n */\n async #buildAssets(): Promise<boolean> {\n const assetsBundler = this.#options.assets\n if (!assetsBundler?.enabled) {\n return true\n }\n\n try {\n this.#logger.info('compiling frontend assets', { suffix: assetsBundler.cmd })\n await run(this.#cwd, {\n stdio: 'inherit',\n script: assetsBundler.cmd,\n scriptArgs: assetsBundler.args,\n })\n return true\n } catch {\n return false\n }\n }\n\n /**\n * Runs tsc command to build the source.\n */\n async #runTsc(outDir: string): Promise<boolean> {\n try {\n await run(this.#cwd, {\n stdio: 'inherit',\n script: 'tsc',\n scriptArgs: ['--outDir', outDir],\n })\n return true\n } catch {\n return false\n }\n }\n\n /**\n * Copy meta files to the output directory\n */\n async #copyMetaFiles(outDir: string, additionalFilesToCopy: string[]) {\n const metaFiles = (this.#options.metaFiles || [])\n .map((file) => file.pattern)\n .concat(additionalFilesToCopy)\n\n await copyFiles(metaFiles, this.#cwdPath, outDir)\n }\n\n /**\n * Detect the package manager used by the project\n * and return the lockfile name and install command\n * related to it.\n */\n async #getPackageManager(client?: SupportedPackageManager) {\n let pkgManager: string | null | undefined = client\n\n if (!pkgManager) {\n pkgManager = await detectPackageManager(this.#cwdPath)\n }\n if (!pkgManager) {\n pkgManager = 'npm'\n }\n\n if (!Object.keys(SUPPORT_PACKAGE_MANAGERS).includes(pkgManager)) {\n return null\n }\n\n return SUPPORT_PACKAGE_MANAGERS[pkgManager as SupportedPackageManager]\n }\n\n /**\n * Rewrite the ace file since the original one\n * is importing ts-node which is not installed\n * in a production environment.\n */\n async #createAceFile(outDir: string) {\n const aceFileLocation = join(outDir, 'ace.js')\n const aceFileContent = dedent(/* JavaScript */ `\n /**\n * This file is auto-generated by the build process.\n * If you had any custom code inside this file, then\n * instead write it inside the \"bin/console.js\" file.\n */\n\n await import('./bin/console.js')\n `)\n\n await fs.writeFile(aceFileLocation, aceFileContent)\n this.#logger.info('rewrited ace file', { suffix: this.#getRelativeName(aceFileLocation) })\n }\n\n /**\n * Set a custom CLI UI logger\n */\n setLogger(logger: Logger) {\n this.#logger = logger\n return this\n }\n\n /**\n * Bundles the application to be run in production\n */\n async bundle(stopOnError: boolean = true, client?: SupportedPackageManager): Promise<boolean> {\n await this.#hooks.registerBuildHooks()\n\n /**\n * Step 1: Parse config file to get the build output directory\n */\n const config = parseConfig(this.#cwd, this.#ts)\n if (!config) {\n return false\n }\n\n /**\n * Step 2: Cleanup existing build directory (if any)\n */\n const outDir = config.options.outDir || fileURLToPath(new URL('build/', this.#cwd))\n this.#logger.info('cleaning up output directory', { suffix: this.#getRelativeName(outDir) })\n await this.#cleanupBuildDirectory(outDir)\n\n /**\n * Step 3: Build frontend assets\n */\n if (!(await this.#buildAssets())) {\n return false\n }\n\n /**\n * Step 4: Execute build starting hook\n */\n await this.#hooks.onBuildStarting({ colors: ui.colors, logger: this.#logger })\n\n /**\n * Step 5: Build typescript source code\n */\n this.#logger.info('compiling typescript source', { suffix: 'tsc' })\n const buildCompleted = await this.#runTsc(outDir)\n await this.#createAceFile(outDir)\n\n /**\n * Remove incomplete build directory when tsc build\n * failed and stopOnError is set to true.\n */\n if (!buildCompleted && stopOnError) {\n await this.#cleanupBuildDirectory(outDir)\n const instructions = ui\n .sticker()\n .fullScreen()\n .drawBorder((borderChar, colors) => colors.red(borderChar))\n\n instructions.add(\n this.#colors.red('Cannot complete the build process as there are TypeScript errors.')\n )\n instructions.add(\n this.#colors.red(\n 'Use \"--ignore-ts-errors\" flag to ignore TypeScript errors and continue the build.'\n )\n )\n\n this.#logger.logError(instructions.prepare())\n return false\n }\n\n /**\n * Step 6: Copy meta files to the build directory\n */\n const pkgManager = await this.#getPackageManager(client)\n const pkgFiles = pkgManager\n ? ['package.json', ...pkgManager.packageManagerFiles]\n : ['package.json']\n this.#logger.info('copying meta files to the output directory')\n await this.#copyMetaFiles(outDir, pkgFiles)\n\n this.#logger.success('build completed')\n this.#logger.log('')\n\n /**\n * Step 7: Execute build completed hook\n */\n await this.#hooks.onBuildCompleted({ colors: ui.colors, logger: this.#logger })\n\n /**\n * Next steps\n */\n ui.instructions()\n .useRenderer(this.#logger.getRenderer())\n .heading('Run the following commands to start the server in production')\n .add(this.#colors.cyan(`cd ${this.#getRelativeName(outDir)}`))\n .add(\n this.#colors.cyan(\n pkgManager ? pkgManager.installCommand : 'Install production dependencies'\n )\n )\n .add(this.#colors.cyan('node bin/server.js'))\n .render()\n\n return true\n }\n}\n","/*\n * @adonisjs/assembler\n *\n * (c) AdonisJS\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport {\n RcFile,\n AssemblerHookNode,\n AssemblerHookHandler,\n SourceFileChangedHookHandler,\n} from '@adonisjs/application/types'\nimport { RuntimeException } from '@poppinss/utils'\nimport Hooks from '@poppinss/hooks'\n\nexport class AssemblerHooks {\n #config: RcFile['hooks']\n\n #hooks = new Hooks<{\n onBuildStarting: [Parameters<AssemblerHookHandler>, []]\n onBuildCompleted: [Parameters<AssemblerHookHandler>, []]\n onDevServerStarted: [Parameters<AssemblerHookHandler>, []]\n onSourceFileChanged: [Parameters<SourceFileChangedHookHandler>, []]\n }>()\n\n constructor(config: RcFile['hooks']) {\n this.#config = config\n }\n\n /**\n * Resolve the hook by importing the file and returning the default export\n */\n async #resolveHookNode(node: AssemblerHookNode<any>) {\n const exports = await node()\n\n if (!exports.default) {\n throw new RuntimeException('Assembler hook must be defined using the default export')\n }\n\n return exports.default\n }\n\n /**\n * Resolve hooks needed for dev-time and register them to the Hooks instance\n */\n async registerDevServerHooks() {\n await Promise.all([\n ...(this.#config?.onDevServerStarted || []).map(async (node) =>\n this.#hooks.add('onDevServerStarted', await this.#resolveHookNode(node))\n ),\n ...(this.#config?.onSourceFileChanged || []).map(async (node) =>\n this.#hooks.add('onSourceFileChanged', await this.#resolveHookNode(node))\n ),\n ])\n }\n\n /**\n * Resolve hooks needed for build-time and register them to the Hooks instance\n */\n async registerBuildHooks() {\n await Promise.all([\n ...(this.#config?.onBuildStarting || []).map(async (node) =>\n this.#hooks.add('onBuildStarting', await this.#resolveHookNode(node))\n ),\n ...(this.#config?.onBuildCompleted || []).map(async (node) =>\n this.#hooks.add('onBuildCompleted', await this.#resolveHookNode(node))\n ),\n ])\n }\n\n /**\n * When the dev server is started\n */\n async onDevServerStarted(...args: Parameters<AssemblerHookHandler>) {\n await this.#hooks.runner('onDevServerStarted').run(...args)\n }\n\n /**\n * When a source file changes\n */\n async onSourceFileChanged(...args: Parameters<SourceFileChangedHookHandler>) {\n await this.#hooks.runner('onSourceFileChanged').run(...args)\n }\n\n /**\n * When the build process is starting\n */\n async onBuildStarting(...args: Parameters<AssemblerHookHandler>) {\n await this.#hooks.runner('onBuildStarting').run(...args)\n }\n\n /**\n * When the build process is completed\n */\n async onBuildCompleted(...args: Parameters<AssemblerHookHandler>) {\n await this.#hooks.runner('onBuildCompleted').run(...args)\n }\n}\n","/*\n * @adonisjs/assembler\n *\n * (c) AdonisJS\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport { isJunk } from 'junk'\nimport fastGlob from 'fast-glob'\nimport getRandomPort from 'get-port'\nimport { existsSync } from 'node:fs'\nimport type tsStatic from 'typescript'\nimport { fileURLToPath } from 'node:url'\nimport { execaNode, execa } from 'execa'\nimport { copyFile, mkdir } from 'node:fs/promises'\nimport { EnvLoader, EnvParser } from '@adonisjs/env'\nimport { ConfigParser, Watcher } from '@poppinss/chokidar-ts'\nimport { basename, dirname, isAbsolute, join, relative } from 'node:path'\n\nimport type { RunOptions, WatchOptions } from './types.js'\nimport debug from './debug.js'\n\n/**\n * Default set of args to pass in order to run TypeScript\n * source. Used by \"run\" and \"runNode\" scripts\n */\nconst DEFAULT_NODE_ARGS = [\n // Use ts-node/esm loader. The project must install it\n '--loader=ts-node/esm',\n // Enable source maps, since TSNode source maps are broken\n '--enable-source-maps',\n]\n\n/**\n * Disable experimental warnings, since the ts-node loader hook\n * uses an expiremental feature. We are waiting for them to\n * cut a new release and support the newer `--import` flag\n * instead\n */\nif (process.allowedNodeEnvironmentFlags.has('--disable-warning')) {\n // supported in node>=v21.13.0\n DEFAULT_NODE_ARGS.push('--disable-warning=ExperimentalWarning')\n} else {\n DEFAULT_NODE_ARGS.push('--no-warnings')\n}\n\n/**\n * Parses tsconfig.json and prints errors using typescript compiler\n * host\n */\nexport function parseConfig(cwd: string | URL, ts: typeof tsStatic) {\n const { config, error } = new ConfigParser(cwd, 'tsconfig.json', ts).parse()\n if (error) {\n const compilerHost = ts.createCompilerHost({})\n console.log(ts.formatDiagnosticsWithColorAndContext([error], compilerHost))\n return\n }\n\n if (config!.errors.length) {\n const compilerHost = ts.createCompilerHost({})\n console.log(ts.formatDiagnosticsWithColorAndContext(config!.errors, compilerHost))\n return\n }\n\n return config\n}\n\n/**\n * Runs a Node.js script as a child process and inherits the stdio streams\n */\nexport function runNode(cwd: string | URL, options: RunOptions) {\n const childProcess = execaNode(options.script, options.scriptArgs, {\n nodeOptions: DEFAULT_NODE_ARGS.concat(options.nodeArgs),\n preferLocal: true,\n windowsHide: false,\n localDir: cwd,\n cwd,\n buffer: false,\n stdio: options.stdio || 'inherit',\n env: {\n ...(options.stdio === 'pipe' ? { FORCE_COLOR: 'true' } : {}),\n ...options.env,\n },\n })\n\n return childProcess\n}\n\n/**\n * Runs a script as a child process and inherits the stdio streams\n */\nexport function run(cwd: string | URL, options: Omit<RunOptions, 'nodeArgs'>) {\n const childProcess = execa(options.script, options.scriptArgs, {\n preferLocal: true,\n windowsHide: false,\n localDir: cwd,\n cwd,\n buffer: false,\n stdio: options.stdio || 'inherit',\n env: {\n ...(options.stdio === 'pipe' ? { FORCE_COLOR: 'true' } : {}),\n ...options.env,\n },\n })\n\n return childProcess\n}\n\n/**\n * Watches the file system using tsconfig file\n */\nexport function watch(cwd: string | URL, ts: typeof tsStatic, options: WatchOptions) {\n const config = parseConfig(cwd, ts)\n if (!config) {\n return\n }\n\n const watcher = new Watcher(typeof cwd === 'string' ? cwd : fileURLToPath(cwd), config!)\n const chokidar = watcher.watch(['.'], { usePolling: options.poll })\n return { watcher, chokidar }\n}\n\n/**\n * Check if file is an .env file\n */\nexport function isDotEnvFile(filePath: string) {\n if (filePath === '.env') {\n return true\n }\n\n return filePath.includes('.env.')\n}\n\n/**\n * Returns the port to use after inspect the dot-env files inside\n * a given directory.\n *\n * A random port is used when the specified port is in use. Following\n * is the logic for finding a specified port.\n *\n * - The \"process.env.PORT\" value is used if exists.\n * - The dot-env files are loaded using the \"EnvLoader\" and the PORT\n * value is used by iterating over all the loaded files. The\n * iteration stops after first find.\n */\nexport async function getPort(cwd: URL): Promise<number> {\n /**\n * Use existing port if exists\n */\n if (process.env.PORT) {\n return getRandomPort({ port: Number(process.env.PORT) })\n }\n\n /**\n * Loop over files and use the port from their contents. Stops\n * after first match\n */\n const files = await new EnvLoader(cwd).load()\n for (let file of files) {\n const envVariables = await new EnvParser(file.contents).parse()\n if (envVariables.PORT) {\n return getRandomPort({ port: Number(envVariables.PORT) })\n }\n }\n\n /**\n * Use 3333 as the port\n */\n return getRandomPort({ port: 3333 })\n}\n\n/**\n * Helper function to copy files from relative paths or glob\n * patterns\n */\nexport async function copyFiles(files: string[], cwd: string, outDir: string) {\n /**\n * Looping over files and create a new collection with paths\n * and glob patterns\n */\n const { paths, patterns } = files.reduce<{ patterns: string[]; paths: string[] }>(\n (result, file) => {\n /**\n * If file is a glob pattern, then push it to patterns\n */\n if (fastGlob.isDynamicPattern(file)) {\n result.patterns.push(file)\n return result\n }\n\n /**\n * Otherwise, check if file exists and push it to paths to copy\n */\n if (existsSync(join(cwd, file))) {\n result.paths.push(file)\n }\n\n return result\n },\n { patterns: [], paths: [] }\n )\n\n debug('copyFiles inputs: %O, paths: %O, patterns: %O', files, paths, patterns)\n\n /**\n * Getting list of relative paths from glob patterns\n */\n const filePaths = paths.concat(await fastGlob(patterns, { cwd, dot: true })).filter((file) => {\n return !isJunk(basename(file))\n })\n\n /**\n * Finally copy files to the destination by keeping the same\n * directory structure and ignoring junk files\n */\n debug('copying files %O to destination \"%s\"', filePaths, outDir)\n const copyPromises = filePaths.map(async (file) => {\n const src = isAbsolute(file) ? file : join(cwd, file)\n const dest = join(outDir, relative(cwd, src))\n\n await mkdir(dirname(dest), { recursive: true })\n return copyFile(src, dest)\n })\n\n return await Promise.all(copyPromises)\n}\n","/*\n * @adonisjs/assembler\n *\n * (c) AdonisJS\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport { debuglog } from 'node:util'\n\nexport default debuglog('adonisjs:assembler')\n","/*\n * @adonisjs/assembler\n *\n * (c) AdonisJS\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport picomatch from 'picomatch'\nimport { relative } from 'node:path'\nimport type tsStatic from 'typescript'\nimport prettyHrtime from 'pretty-hrtime'\nimport { fileURLToPath } from 'node:url'\nimport { type ExecaChildProcess } from 'execa'\nimport { cliui, type Logger } from '@poppinss/cliui'\nimport type { Watcher } from '@poppinss/chokidar-ts'\n\nimport { AssemblerHooks } from './hooks.js'\nimport type { DevServerOptions } from './types.js'\nimport { AssetsDevServer } from './assets_dev_server.js'\nimport { getPort, isDotEnvFile, runNode, watch } from './helpers.js'\n\n/**\n * Instance of CLIUI\n */\nconst ui = cliui()\n\n/**\n * Exposes the API to start the development. Optionally, the watch API can be\n * used to watch for file changes and restart the development server.\n *\n * The Dev server performs the following actions\n *\n * - Assigns a random PORT, when PORT inside .env file is in use.\n * - Uses tsconfig.json file to collect a list of files to watch.\n * - Uses metaFiles from adonisrc.ts file to collect a list of files to watch.\n * - Restart HTTP server on every file change.\n */\nexport class DevServer {\n #cwd: URL\n #logger = ui.logger\n #options: DevServerOptions\n\n /**\n * Flag to know if the dev server is running in watch\n * mode\n */\n #isWatching: boolean = false\n\n /**\n * Script file to start the development server\n */\n #scriptFile: string = 'bin/server.js'\n\n /**\n * Picomatch matcher function to know if a file path is a\n * meta file with reloadServer option enabled\n */\n #isMetaFileWithReloadsEnabled: picomatch.Matcher\n\n /**\n * Picomatch matcher function to know if a file path is a\n * meta file with reloadServer option disabled\n */\n #isMetaFileWithReloadsDisabled: picomatch.Matcher\n\n /**\n * External listeners that are invoked when child process\n * gets an error or closes\n */\n #onError?: (error: any) => any\n #onClose?: (exitCode: number) => any\n\n /**\n * Reference to the child process\n */\n #httpServer?: ExecaChildProcess<string>\n\n /**\n * Reference to the watcher\n */\n #watcher?: ReturnType<Watcher['watch']>\n\n /**\n * Reference to the assets server\n */\n #assetsServer?: AssetsDevServer\n\n /**\n * Hooks to execute custom actions during the dev server lifecycle\n */\n #hooks: AssemblerHooks\n\n /**\n * Getting reference to colors library from logger\n */\n get #colors() {\n return this.#logger.getColors()\n }\n\n constructor(cwd: URL, options: DevServerOptions) {\n this.#cwd = cwd\n this.#options = options\n this.#hooks = new AssemblerHooks(options.hooks)\n if (this.#options.hmr) {\n this.#options.nodeArgs = this.#options.nodeArgs.concat(['--import=hot-hook/register'])\n }\n\n this.#isMetaFileWithReloadsEnabled = picomatch(\n (this.#options.metaFiles || [])\n .filter(({ reloadServer }) => reloadServer === true)\n .map(({ pattern }) => pattern)\n )\n\n this.#isMetaFileWithReloadsDisabled = picomatch(\n (this.#options.metaFiles || [])\n .filter(({ reloadServer }) => reloadServer !== true)\n .map(({ pattern }) => pattern)\n )\n }\n\n /**\n * Inspect if child process message is from AdonisJS HTTP server\n */\n #isAdonisJSReadyMessage(message: unknown): message is {\n isAdonisJS: true\n environment: 'web'\n port: number\n host: string\n duration?: [number, number]\n } {\n return (\n message !== null &&\n typeof message === 'object' &&\n 'isAdonisJS' in message &&\n 'environment' in message &&\n message.environment === 'web'\n )\n }\n\n /**\n * Inspect if child process message is coming from Hot Hook\n */\n #isHotHookMessage(message: unknown): message is {\n type: string\n path: string\n paths?: string[]\n } {\n return (\n message !== null &&\n typeof message === 'object' &&\n 'type' in message &&\n typeof message.type === 'string' &&\n message.type.startsWith('hot-hook:')\n )\n }\n\n /**\n * Conditionally clear the terminal screen\n */\n #clearScreen() {\n if (this.#options.clearScreen) {\n process.stdout.write('\\u001Bc')\n }\n }\n\n /**\n * Starts the HTTP server\n */\n #startHTTPServer(port: string, mode: 'blocking' | 'nonblocking') {\n const hooksArgs = { colors: this.#colors, logger: this.#logger }\n this.#httpServer = runNode(this.#cwd, {\n script: this.#scriptFile,\n env: { PORT: port, ...this.#options.env },\n nodeArgs: this.#options.nodeArgs,\n scriptArgs: this.#options.scriptArgs,\n })\n\n this.#httpServer.on('message', async (message) => {\n /**\n * Handle Hot-Hook messages\n */\n if (this.#isHotHookMessage(message)) {\n const path = relative(fileURLToPath(this.#cwd), message.path || message.paths?.[0]!)\n this.#hooks.onSourceFileChanged(hooksArgs, path)\n\n if (message.type === 'hot-hook:full-reload') {\n this.#clearScreen()\n this.#logger.log(`${this.#colors.green('full-reload')} ${path}`)\n this.#restartHTTPServer(port)\n this.#hooks.onDevServerStarted(hooksArgs)\n } else if (message.type === 'hot-hook:invalidated') {\n this.#logger.log(`${this.#colors.green('invalidated')} ${path}`)\n }\n }\n\n /**\n * Handle AdonisJS ready message\n */\n if (this.#isAdonisJSReadyMessage(message)) {\n const host = message.host === '0.0.0.0' ? '127.0.0.1' : message.host\n\n const displayMessage = ui\n .sticker()\n .useColors(this.#colors)\n .useRenderer(this.#logger.getRenderer())\n .add(`Server address: ${this.#colors.cyan(`http://${host}:${message.port}`)}`)\n\n const watchMode = this.#options.hmr ? 'HMR' : this.#isWatching ? 'Legacy' : 'None'\n displayMessage.add(`Watch Mode: ${this.#colors.cyan(watchMode)}`)\n\n if (message.duration) {\n displayMessage.add(`Ready in: ${this.#colors.cyan(prettyHrtime(message.duration))}`)\n }\n\n displayMessage.render()\n\n await this.#hooks.onDevServerStarted({ colors: ui.colors, logger: this.#logger })\n }\n })\n\n this.#httpServer\n .then((result) => {\n if (mode === 'nonblocking') {\n this.#onClose?.(result.exitCode)\n this.#watcher?.close()\n this.#assetsServer?.stop()\n } else {\n this.#logger.info('Underlying HTTP server closed. Still watching for changes')\n }\n })\n .catch((error) => {\n if (mode === 'nonblocking') {\n this.#onError?.(error)\n this.#watcher?.close()\n this.#assetsServer?.stop()\n } else {\n this.#logger.info('Underlying HTTP server died. Still watching for changes')\n }\n })\n }\n\n /**\n * Starts the assets server\n */\n #startAssetsServer() {\n this.#assetsServer = new AssetsDevServer(this.#cwd, this.#options.assets)\n this.#assetsServer.setLogger(this.#logger)\n this.#assetsServer.start()\n }\n\n /**\n * Restarts the HTTP server in the watch mode. Do not call this\n * method when not in watch mode\n */\n #restartHTTPServer(port: string) {\n if (this.#httpServer) {\n this.#httpServer.removeAllListeners()\n this.#httpServer.kill('SIGKILL')\n }\n\n this.#startHTTPServer(port, 'blocking')\n }\n\n /**\n * Handles a non TypeScript file change\n */\n #handleFileChange(action: string, port: string, relativePath: string) {\n if (isDotEnvFile(relativePath)) {\n this.#clearScreen()\n this.#logger.log(`${this.#colors.green(action)} ${relativePath}`)\n this.#restartHTTPServer(port)\n return\n }\n\n if (this.#isMetaFileWithReloadsEnabled(relativePath)) {\n this.#clearScreen()\n this.#logger.log(`${this.#colors.green(action)} ${relativePath}`)\n this.#restartHTTPServer(port)\n return\n }\n\n if (this.#isMetaFileWithReloadsDisabled(relativePath)) {\n this.#clearScreen()\n this.#logger.log(`${this.#colors.green(action)} ${relativePath}`)\n }\n }\n\n /**\n * Handles TypeScript source file change\n */\n async #handleSourceFileChange(action: string, port: string, relativePath: string) {\n await this.#hooks.onSourceFileChanged({ colors: ui.colors, logger: this.#logger }, relativePath)\n\n this.#clearScreen()\n this.#logger.log(`${this.#colors.green(action)} ${relativePath}`)\n this.#restartHTTPServer(port)\n }\n\n /**\n * Set a custom CLI UI logger\n */\n setLogger(logger: Logger) {\n this.#logger = logger\n this.#assetsServer?.setLogger(logger)\n return this\n }\n\n /**\n * Add listener to get notified when dev server is\n * closed\n */\n onClose(callback: (exitCode: number) => any): this {\n this.#onClose = callback\n return this\n }\n\n /**\n * Add listener to get notified when dev server exists\n * with an error\n */\n onError(callback: (error: any) => any): this {\n this.#onError = callback\n return this\n }\n\n /**\n * Close watchers and running child processes\n */\n async close() {\n await this.#watcher?.close()\n this.#assetsServer?.stop()\n if (this.#httpServer) {\n this.#httpServer.removeAllListeners()\n this.#httpServer.kill('SIGKILL')\n }\n }\n\n /**\n * Start the development server\n */\n async start() {\n await this.#hooks.registerDevServerHooks()\n\n this.#clearScreen()\n this.#logger.info('starting HTTP server...')\n this.#startHTTPServer(String(await getPort(this.#cwd)), 'nonblocking')\n this.#startAssetsServer()\n }\n\n /**\n * Start the development server in watch mode\n */\n async startAndWatch(ts: typeof tsStatic, options?: { poll: boolean }) {\n await this.#hooks.registerDevServerHooks()\n\n const port = String(await getPort(this.#cwd))\n this.#isWatching = true\n\n this.#clearScreen()\n\n this.#logger.info('starting HTTP server...')\n this.#startHTTPServer(port, 'blocking')\n\n this.#startAssetsServer()\n\n /**\n * Create watcher using tsconfig.json file\n */\n const output = watch(this.#cwd, ts, options || {})\n if (!output) {\n this.#onClose?.(1)\n return\n }\n\n /**\n * Storing reference to watcher, so that we can close it\n * when HTTP server exists with error\n */\n this.#watcher = output.chokidar\n\n /**\n * Notify the watcher is ready\n */\n output.watcher.on('watcher:ready', () => {\n this.#logger.info('watching file system for changes...')\n })\n\n /**\n * Cleanup when watcher dies\n */\n output.chokidar.on('error', (error) => {\n this.#logger.warning('file system watcher failure')\n this.#logger.fatal(error)\n this.#onError?.(error)\n output.chokidar.close()\n })\n\n /**\n * Changes in TypeScript source file\n */\n output.watcher.on('source:add', ({ relativePath }) =>\n this.#handleSourceFileChange('add', port, relativePath)\n )\n output.watcher.on('source:change', ({ relativePath }) =>\n this.#handleSourceFileChange('update', port, relativePath)\n )\n output.watcher.on('source:unlink', ({ relativePath }) =>\n this.#handleSourceFileChange('delete', port, relativePath)\n )\n\n /**\n * Changes in non-TypeScript source files\n */\n output.watcher.on('add', ({ relativePath }) =>\n this.#handleFileChange('add', port, relativePath)\n )\n output.watcher.on('change', ({ relativePath }) =>\n this.#handleFileChange('update', port, relativePath)\n )\n output.watcher.on('unlink', ({ relativePath }) =>\n this.#handleFileChange('delete', port, relativePath)\n )\n }\n}\n","/*\n * @adonisjs/core\n *\n * (c) AdonisJS\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport type { ExecaChildProcess } from 'execa'\nimport { type Logger, cliui } from '@poppinss/cliui'\n\nimport { run } from './helpers.js'\nimport type { AssetsBundlerOptions } from './types.js'\n\n/**\n * Instance of CLIUI\n */\nconst ui = cliui()\n\n/**\n * Exposes the API to start the development server for processing assets during\n * development.\n *\n * - Here we are running the assets dev server in a child process.\n * - Piping the output from the child process and reformatting it before writing it to\n * process streams.\n *\n * AssetsDevServer is agnostic and can run any assets dev server. Be it Vite or Encore or\n * even Webpack directly.\n */\nexport class AssetsDevServer {\n #cwd: URL\n #logger = ui.logger\n #options?: AssetsBundlerOptions\n #devServer?: ExecaChildProcess<string>\n\n /**\n * Getting reference to colors library from logger\n */\n get #colors() {\n return this.#logger.getColors()\n }\n\n constructor(cwd: URL, options?: AssetsBundlerOptions) {\n this.#cwd = cwd\n this.#options = options\n }\n\n /**\n * Logs messages from vite dev server stdout and stderr\n */\n #logViteDevServerMessage(data: Buffer) {\n const dataString = data.toString()\n const lines = dataString.split('\\n')\n\n /**\n * Put a wrapper around vite network address log\n */\n if (dataString.includes('Local') && dataString.includes('Network')) {\n const sticker = ui.sticker().useColors(this.#colors).useRenderer(this.#logger.getRenderer())\n\n lines.forEach((line: string) => {\n if (line.trim()) {\n sticker.add(line)\n }\n })\n\n sticker.render()\n return\n }\n\n /**\n * Logging VITE ready in message with proper\n * spaces and newlines\n */\n if (dataString.includes('ready in')) {\n console.log('')\n console.log(dataString.trim())\n return\n }\n\n /**\n * Log rest of the lines\n */\n lines.forEach((line: string) => {\n if (line.trim()) {\n console.log(line)\n }\n })\n }\n\n /**\n * Logs messages from assets dev server stdout and stderr\n */\n #logAssetsDevServerMessage(data: Buffer) {\n const dataString = data.toString()\n const lines = dataString.split('\\n')\n lines.forEach((line: string) => {\n if (line.trim()) {\n console.log(line)\n }\n })\n }\n\n /**\n * Set a custom CLI UI logger\n */\n setLogger(logger: Logger) {\n this.#logger = logger\n return this\n }\n\n /**\n * Starts the assets bundler server. The assets bundler server process is\n * considered as the secondary process and therefore we do not perform\n * any cleanup if it dies.\n */\n start() {\n if (!this.#options?.enabled) {\n return\n }\n\n this.#logger.info(`starting \"${this.#options.driver}\" dev server...`)\n\n /**\n * Create child process\n */\n this.#devServer = run(this.#cwd, {\n script: this.#options.cmd,\n\n /**\n * We do not inherit the stdio for vite and encore, because in\n * inherit mode they own the stdin and interrupts the\n * `Ctrl + C` command.\n */\n stdio: 'pipe',\n scriptArgs: this.#options.args,\n })\n\n /**\n * Log child process messages\n */\n this.#devServer.stdout?.on('data', (data) => {\n if (this.#options!.driver === 'vite') {\n this.#logViteDevServerMessage(data)\n } else {\n this.#logAssetsDevServerMessage(data)\n }\n })\n\n this.#devServer.stderr?.on('data', (data) => {\n if (this.#options!.driver === 'vite') {\n this.#logViteDevServerMessage(data)\n } else {\n this.#logAssetsDevServerMessage(data)\n }\n })\n\n this.#devServer\n .then((result) => {\n this.#logger.warning(\n `\"${this.#options!.driver}\" dev server closed with status code \"${result.exitCode}\"`\n )\n })\n .catch((error) => {\n this.#logger.warning(`unable to connect to \"${this.#options!.driver}\" dev server`)\n this.#logger.fatal(error)\n })\n }\n\n /**\n * Stop the dev server\n */\n stop() {\n if (this.#devServer) {\n this.#devServer.removeAllListeners()\n this.#devServer.kill('SIGKILL')\n this.#devServer = undefined\n }\n }\n}\n","/*\n * @adonisjs/assembler\n *\n * (c) AdonisJS\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport picomatch from 'picomatch'\nimport type tsStatic from 'typescript'\nimport { type ExecaChildProcess } from 'execa'\nimport { cliui, type Logger } from '@poppinss/cliui'\nimport type { Watcher } from '@poppinss/chokidar-ts'\n\nimport type { TestRunnerOptions } from './types.js'\nimport { AssetsDevServer } from './assets_dev_server.js'\nimport { getPort, isDotEnvFile, runNode, watch } from './helpers.js'\n\n/**\n * Instance of CLIUI\n */\nconst ui = cliui()\n\n/**\n * Exposes the API to run Japa tests and optionally watch for file\n * changes to re-run the tests.\n *\n * The watch mode functions as follows.\n *\n * - If the changed file is a test file, then only tests for that file\n * will be re-run.\n * - Otherwise, all tests will re-run with respect to the initial\n * filters applied when running the `node ace test` command.\n *\n */\nexport class TestRunner {\n #cwd: URL\n #logger = ui.logger\n #options: TestRunnerOptions\n\n /**\n * The script file to run as a child process\n */\n #scriptFile: string = 'bin/test.js'\n\n /**\n * Pico matcher function to check if the filepath is\n * part of the `metaFiles` glob patterns\n */\n #isMetaFile: picomatch.Matcher\n\n /**\n * Pico matcher function to check if the filepath is\n * part of a test file.\n */\n #isTestFile: picomatch.Matcher\n\n /**\n * Arguments to pass to the \"bin/test.js\" file.\n */\n #scriptArgs: string[]\n\n /**\n * Set of initial filters applied when running the test\n * command. In watch mode, we will append an additional\n * filter to run tests only for the file that has been\n * changed.\n */\n #initialFiltersArgs: string[]\n\n /**\n * In watch mode, after a file is changed, we wait for the current\n * set of tests to finish before triggering a re-run. Therefore,\n * we use this flag to know if we are already busy in running\n * tests and ignore file-changes.\n */\n #isBusy: boolean = false\n\n /**\n * External listeners that are invoked when child process\n * gets an error or closes\n */\n #onError?: (error: any) => any\n #onClose?: (exitCode: number) => any\n\n /**\n * Reference to the test script child process\n */\n #testScript?: ExecaChildProcess<string>\n\n /**\n * Reference to the watcher\n */\n #watcher?: ReturnType<Watcher['watch']>\n\n /**\n * Reference to the assets server\n */\n #assetsServer?: AssetsDevServer\n\n /**\n * Getting reference to colors library from logger\n */\n get #colors() {\n return this.#logger.getColors()\n }\n\n constructor(cwd: URL, options: TestRunnerOptions) {\n this.#cwd = cwd\n this.#options = options\n\n this.#isMetaFile = picomatch((this.#options.metaFiles || []).map(({ pattern }) => pattern))\n\n /**\n * Create a test file watch by collection all the globs\n * used by all the suites. However, if a suite filter\n * was used, then we only collect glob for the mentioned\n * suites.\n */\n this.#isTestFile = picomatch(\n this.#options.suites\n .filter((suite) => {\n if (this.#options.filters.suites) {\n return this.#options.filters.suites.includes(suite.name)\n }\n return true\n })\n .map((suite) => suite.files)\n .flat(1)\n )\n\n this.#scriptArgs = this.#convertOptionsToArgs().concat(this.#options.scriptArgs)\n this.#initialFiltersArgs = this.#convertFiltersToArgs(this.#options.filters)\n }\n\n /**\n * Convert test runner options to the CLI args\n */\n #convertOptionsToArgs() {\n const args: string[] = []\n\n if (this.#options.reporters) {\n args.push('--reporters')\n args.push(this.#options.reporters.join(','))\n }\n\n if (this.#options.timeout !== undefined) {\n args.push('--timeout')\n args.push(String(this.#options.timeout))\n }\n\n if (this.#options.failed) {\n args.push('--failed')\n }\n\n if (this.#options.retries !== undefined) {\n args.push('--retries')\n args.push(String(this.#options.retries))\n }\n\n return args\n }\n\n /**\n * Converts all known filters to CLI args.\n *\n * The following code snippet may seem like repetitive code. But, it\n * is done intentionally to have visibility around how each filter\n * is converted to an arg.\n */\n #convertFiltersToArgs(filters: TestRunnerOptions['filters']): string[] {\n const args: string[] = []\n\n if (filters.suites) {\n args.push(...filters.suites)\n }\n\n if (filters.files) {\n args.push('--files')\n args.push(filters.files.join(','))\n }\n\n if (filters.groups) {\n args.push('--groups')\n args.push(filters.groups.join(','))\n }\n\n if (filters.tags) {\n args.push('--tags')\n args.push(filters.tags.join(','))\n }\n\n if (filters.tests) {\n args.push('--tests')\n args.push(filters.tests.join(','))\n }\n\n return args\n }\n\n /**\n * Conditionally clear the terminal screen\n */\n #clearScreen() {\n if (this.#options.clearScreen) {\n process.stdout.write('\\u001Bc')\n }\n }\n\n /**\n * Runs tests\n */\n #runTests(\n port: string,\n mode: 'blocking' | 'nonblocking',\n filters?: TestRunnerOptions['filters']\n ) {\n this.#isBusy = true\n\n /**\n * If inline filters are defined, then we ignore the\n * initial filters\n */\n const scriptArgs = filters\n ? this.#convertFiltersToArgs(filters).concat(this.#scriptArgs)\n : this.#initialFiltersArgs.concat(this.#scriptArgs)\n\n this.#testScript = runNode(this.#cwd, {\n script: this.#scriptFile,\n env: { PORT: port, ...this.#options.env },\n nodeArgs: this.#options.nodeArgs,\n scriptArgs,\n })\n\n this.#testScript\n .then((result) => {\n if (mode === 'nonblocking') {\n this.#onClose?.(result.exitCode)\n this.close()\n }\n })\n .catch((error) => {\n if (mode === 'nonblocking') {\n this.#onError?.(error)\n this.close()\n }\n })\n .finally(() => {\n this.#isBusy = false\n })\n }\n\n /**\n * Re-run tests with additional inline filters. Should be\n * executed in watch mode only.\n */\n #rerunTests(port: string, filters?: TestRunnerOptions['filters']) {\n if (this.#testScript) {\n this.#testScript.removeAllListeners()\n this.#testScript.kill('SIGKILL')\n }\n\n this.#runTests(port, 'blocking', filters)\n }\n\n /**\n * Starts the assets server\n */\n #startAssetsServer() {\n this.#assetsServer = new AssetsDevServer(this.#cwd, this.#options.assets)\n this.#assetsServer.setLogger(this.#logger)\n this.#assetsServer.start()\n }\n\n /**\n * Handles a non TypeScript file change\n */\n #handleFileChange(action: string, port: string, relativePath: string) {\n if (this.#isBusy) {\n return\n }\n\n if (isDotEnvFile(relativePath) || this.#isMetaFile(relativePath)) {\n this.#clearScreen()\n this.#logger.log(`${this.#colors.green(action)} ${relativePath}`)\n this.#rerunTests(port)\n }\n }\n\n /**\n * Handles TypeScript source file change\n */\n #handleSourceFileChange(action: string, port: string, relativePath: string) {\n if (this.#isBusy) {\n return\n }\n\n this.#clearScreen()\n this.#logger.log(`${this.#colors.green(action)} ${relativePath}`)\n\n /**\n * If changed file is a test file after considering the initial filters,\n * then only run that file\n */\n if (this.#isTestFile(relativePath)) {\n this.#rerunTests(port, {\n ...this.#options.filters,\n files: [relativePath],\n })\n return\n }\n\n this.#rerunTests(port)\n }\n\n /**\n * Set a custom CLI UI logger\n */\n setLogger(logger: Logger) {\n this.#logger = logger\n this.#assetsServer?.setLogger(logger)\n return this\n }\n\n /**\n * Add listener to get notified when dev server is\n * closed\n */\n onClose(callback: (exitCode: number) => any): this {\n this.#onClose = callback\n return this\n }\n\n /**\n * Add listener to get notified when dev server exists\n * with an error\n */\n onError(callback: (error: any) => any): this {\n this.#onError = callback\n return this\n }\n\n /**\n * Close watchers and running child processes\n */\n async close() {\n await this.#watcher?.close()\n this.#assetsServer?.stop()\n if (this.#testScript) {\n this.#testScript.removeAllListeners()\n this.#testScript.kill('SIGKILL')\n }\n }\n\n /**\n * Runs tests\n */\n async run() {\n const port = String(await getPort(this.#cwd))\n\n this.#clearScreen()\n this.#startAssetsServer()\n\n this.#logger.info('booting application to run tests...')\n this.#runTests(port, 'nonblocking')\n }\n\n /**\n * Run tests in watch mode\n */\n async runAndWatch(ts: typeof tsStatic, options?: { poll: boolean }) {\n const port = String(await getPort(this.#cwd))\n\n this.#clearScreen()\n this.#startAssetsServer()\n\n this.#logger.info('booting application to run tests...')\n this.#runTests(port, 'blocking')\n\n /**\n * Create watcher using tsconfig.json file\n */\n const output = watch(this.#cwd, ts, options || {})\n if (!output) {\n this.#onClose?.(1)\n return\n }\n\n /**\n * Storing reference to watcher, so that we can close it\n * when HTTP server exists with error\n */\n this.#watcher = output.chokidar\n\n /**\n * Notify the watcher is ready\n */\n output.watcher.on('watcher:ready', () => {\n this.#logger.info('watching file system for changes...')\n })\n\n /**\n * Cleanup when watcher dies\n */\n output.chokidar.on('error', (error) => {\n this.#logger.warning('file system watcher failure')\n this.#logger.fatal(error)\n this.#onError?.(error)\n output.chokidar.close()\n })\n\n /**\n * Changes in TypeScript source file\n */\n output.watcher.on('source:add', ({ relativePath }) =>\n this.#handleSourceFileChange('add', port, relativePath)\n )\n output.watcher.on('source:change', ({ relativePath }) =>\n this.#handleSourceFileChange('update', port, relativePath)\n )\n output.watcher.on('source:unlink', ({ relativePath }) =>\n this.#handleSourceFileChange('delete', port, relativePath)\n )\n\n /**\n * Changes in non-TypeScript source files\n */\n output.watcher.on('add', ({ relativePath }) =>\n this.#handleFileChange('add', port, relativePath)\n )\n output.watcher.on('change', ({ relativePath }) =>\n this.#handleFileChange('update', port, relativePath)\n )\n output.watcher.on('unlink', ({ relativePath }) =>\n this.#handleFileChange('delete', port, relativePath)\n )\n }\n}\n"],"mappings":";AASA,OAAO,WAAW;AAClB,OAAO,YAAY;AACnB,OAAO,QAAQ;AAEf,SAAS,iBAAAA,sBAAqB;AAC9B,SAAS,QAAAC,OAAM,YAAAC,iBAAgB;AAC/B,SAAS,aAA0B;AACnC,SAAS,4BAA4B;;;ACDrC,SAAS,wBAAwB;AACjC,OAAO,WAAW;AAEX,IAAM,iBAAN,MAAqB;AAAA,EAC1B;AAAA,EAEA,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,MAAiB,CAAC,EAAE,aAAa,MACjD,KAAK,wBAAwB,UAAU,MAAM,YAAY;AAAA,IAC3D;AAKA,WAAO,QAAQ;AAAA,MAAG;AAAA,MAAO,CAAC,EAAE,aAAa,MACvC,KAAK,kBAAkB,OAAO,MAAM,YAAY;AAAA,IAClD;AACA,WAAO,QAAQ;AAAA,MAAG;AAAA,MAAU,CAAC,EAAE,aAAa,MAC1C,KAAK,kBAAkB,UAAU,MAAM,YAAY;AAAA,IACrD;AACA,WAAO,QAAQ;AAAA,MAAG;AAAA,MAAU,CAAC,EAAE,aAAa,MAC1C,KAAK,kBAAkB,UAAU,MAAM,YAAY;AAAA,IACrD;AAAA,EACF;AACF;","names":["fileURLToPath","join","relative","fileURLToPath","relative","join","relative","fileURLToPath","cliui","cliui","ui","cliui","ui","cliui","relative","fileURLToPath","picomatch","cliui","ui","cliui","picomatch"]}
|
package/build/src/bundler.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import type tsStatic from 'typescript';
|
|
3
3
|
import { type Logger } from '@poppinss/cliui';
|
|
4
4
|
import type { BundlerOptions } from './types.js';
|
|
5
|
-
type SupportedPackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun';
|
|
5
|
+
type SupportedPackageManager = 'npm' | 'yarn' | 'yarn@berry' | 'pnpm' | 'bun';
|
|
6
6
|
/**
|
|
7
7
|
* The bundler class exposes the API to build an AdonisJS project.
|
|
8
8
|
*/
|
|
@@ -248,6 +248,25 @@ var RcFileTransformer = class {
|
|
|
248
248
|
);
|
|
249
249
|
return this;
|
|
250
250
|
}
|
|
251
|
+
/**
|
|
252
|
+
* Add a new assembler hook
|
|
253
|
+
*/
|
|
254
|
+
addAssemblerHook(type, path) {
|
|
255
|
+
const hooksProperty = this.#getPropertyAssignmentInDefineConfigCall("hooks", "{}");
|
|
256
|
+
const hooks = hooksProperty.getInitializerIfKindOrThrow(SyntaxKind.ObjectLiteralExpression);
|
|
257
|
+
let hookArray = hooks.getProperty(type);
|
|
258
|
+
if (!hookArray) {
|
|
259
|
+
hooks.addPropertyAssignment({ name: type, initializer: "[]" });
|
|
260
|
+
hookArray = hooks.getProperty(type);
|
|
261
|
+
}
|
|
262
|
+
const hooksArray = hookArray.getInitializerIfKindOrThrow(SyntaxKind.ArrayLiteralExpression);
|
|
263
|
+
const existingHooks = this.#extractModulesFromArray(hooksArray);
|
|
264
|
+
if (existingHooks.includes(path)) {
|
|
265
|
+
return this;
|
|
266
|
+
}
|
|
267
|
+
hooksArray.addElement(`() => import('${path}')`);
|
|
268
|
+
return this;
|
|
269
|
+
}
|
|
251
270
|
/**
|
|
252
271
|
* Save the adonisrc.ts file
|
|
253
272
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/code_transformer/main.ts","../../../src/code_transformer/rc_file_transformer.ts"],"sourcesContent":["/*\n * @adonisjs/assembler\n *\n * (c) AdonisJS\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport { join } from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { installPackage, detectPackageManager } from '@antfu/install-pkg'\nimport {\n Node,\n Project,\n QuoteKind,\n SourceFile,\n SyntaxKind,\n CodeBlockWriter,\n FormatCodeSettings,\n} from 'ts-morph'\n\nimport { RcFileTransformer } from './rc_file_transformer.js'\nimport type { MiddlewareNode, EnvValidationNode, BouncerPolicyNode } from '../types.js'\n\n/**\n * This class is responsible for updating\n */\nexport class CodeTransformer {\n /**\n * Exporting utilities to install package and detect\n * the package manager\n */\n installPackage = installPackage\n detectPackageManager = detectPackageManager\n\n /**\n * Directory of the adonisjs project\n */\n #cwd: URL\n\n /**\n * The TsMorph project\n */\n project: Project\n\n /**\n * Settings to use when persisting files\n */\n #editorSettings: FormatCodeSettings = {\n indentSize: 2,\n convertTabsToSpaces: true,\n trimTrailingWhitespace: true,\n ensureNewLineAtEndOfFile: true,\n indentStyle: 2,\n // @ts-expect-error SemicolonPreference doesn't seem to be re-exported from ts-morph\n semicolons: 'remove',\n }\n\n constructor(cwd: URL) {\n this.#cwd = cwd\n this.project = new Project({\n tsConfigFilePath: join(fileURLToPath(this.#cwd), 'tsconfig.json'),\n manipulationSettings: { quoteKind: QuoteKind.Single },\n })\n }\n\n /**\n * Add a new middleware to the middleware array of the\n * given file\n */\n #addToMiddlewareArray(file: SourceFile, target: string, middlewareEntry: MiddlewareNode) {\n const callExpressions = file\n .getDescendantsOfKind(SyntaxKind.CallExpression)\n .filter((statement) => statement.getExpression().getText() === target)\n\n if (!callExpressions.length) {\n throw new Error(`Cannot find ${target} statement in the file.`)\n }\n\n const arrayLiteralExpression = callExpressions[0].getArguments()[0]\n if (!arrayLiteralExpression || !Node.isArrayLiteralExpression(arrayLiteralExpression)) {\n throw new Error(`Cannot find middleware array in ${target} statement.`)\n }\n\n const middleware = `() => import('${middlewareEntry.path}')`\n\n /**\n * Delete the existing middleware if it exists\n */\n const existingMiddlewareIndex = arrayLiteralExpression\n .getElements()\n .findIndex((element) => element.getText() === middleware)\n\n if (existingMiddlewareIndex === -1) {\n /**\n * Add the middleware to the top or bottom of the array\n */\n if (middlewareEntry.position === 'before') {\n arrayLiteralExpression.insertElement(0, middleware)\n } else {\n arrayLiteralExpression.addElement(middleware)\n }\n }\n }\n\n /**\n * Add a new middleware to the named middleware of the given file\n */\n #addToNamedMiddleware(file: SourceFile, middlewareEntry: MiddlewareNode) {\n if (!middlewareEntry.name) {\n throw new Error('Named middleware requires a name.')\n }\n\n const callArguments = file\n .getVariableDeclarationOrThrow('middleware')\n .getInitializerIfKindOrThrow(SyntaxKind.CallExpression)\n .getArguments()\n\n if (callArguments.length === 0) {\n throw new Error('Named middleware call has no arguments.')\n }\n\n const namedMiddlewareObject = callArguments[0]\n if (!Node.isObjectLiteralExpression(namedMiddlewareObject)) {\n throw new Error('The argument of the named middleware call is not an object literal.')\n }\n\n /**\n * Check if property is already defined. If so, remove it\n */\n const existingProperty = namedMiddlewareObject.getProperty(middlewareEntry.name)\n if (!existingProperty) {\n /**\n * Add the named middleware\n */\n const middleware = `${middlewareEntry.name}: () => import('${middlewareEntry.path}')`\n namedMiddlewareObject!.insertProperty(0, middleware)\n }\n }\n\n /**\n * Add a policy to the list of pre-registered policy\n */\n #addToPoliciesList(file: SourceFile, policyEntry: BouncerPolicyNode) {\n const policiesObject = file\n .getVariableDeclarationOrThrow('policies')\n .getInitializerIfKindOrThrow(SyntaxKind.ObjectLiteralExpression)\n\n /**\n * Only define policy when one with the existing name does not\n * exist.\n */\n const existingProperty = policiesObject.getProperty(policyEntry.name)\n if (!existingProperty) {\n const policy = `${policyEntry.name}: () => import('${policyEntry.path}')`\n policiesObject!.insertProperty(0, policy)\n }\n }\n\n /**\n * Add the given import declarations to the source file\n * and merge named imports with the existing import\n */\n #addImportDeclarations(\n file: SourceFile,\n importDeclarations: { isNamed: boolean; module: string; identifier: string }[]\n ) {\n const existingImports = file.getImportDeclarations()\n\n importDeclarations.forEach((importDeclaration) => {\n const existingImport = existingImports.find(\n (mod) => mod.getModuleSpecifierValue() === importDeclaration.module\n )\n\n /**\n * Add a new named import to existing import for the\n * same module\n */\n if (existingImport && importDeclaration.isNamed) {\n if (\n !existingImport\n .getNamedImports()\n .find((namedImport) => namedImport.getName() === importDeclaration.identifier)\n ) {\n existingImport.addNamedImport(importDeclaration.identifier)\n }\n return\n }\n\n /**\n * Ignore default import when the same module is already imported.\n * The chances are the existing default import and the importDeclaration\n * identifiers are not the same. But we should not modify existing source\n */\n if (existingImport) {\n return\n }\n\n file.addImportDeclaration({\n ...(importDeclaration.isNamed\n ? { namedImports: [importDeclaration.identifier] }\n : { defaultImport: importDeclaration.identifier }),\n moduleSpecifier: importDeclaration.module,\n })\n })\n }\n\n /**\n * Write a leading comment\n */\n #addLeadingComment(writer: CodeBlockWriter, comment?: string) {\n if (!comment) {\n return writer.blankLine()\n }\n\n return writer\n .blankLine()\n .writeLine('/*')\n .writeLine(`|----------------------------------------------------------`)\n .writeLine(`| ${comment}`)\n .writeLine(`|----------------------------------------------------------`)\n .writeLine(`*/`)\n }\n\n /**\n * Add new env variable validation in the\n * `env.ts` file\n */\n async defineEnvValidations(definition: EnvValidationNode) {\n /**\n * Get the `start/env.ts` source file\n */\n const kernelUrl = fileURLToPath(new URL('./start/env.ts', this.#cwd))\n const file = this.project.getSourceFileOrThrow(kernelUrl)\n\n /**\n * Get the `Env.create` call expression\n */\n const callExpressions = file\n .getDescendantsOfKind(SyntaxKind.CallExpression)\n .filter((statement) => statement.getExpression().getText() === 'Env.create')\n\n if (!callExpressions.length) {\n throw new Error(`Cannot find Env.create statement in the file.`)\n }\n\n const objectLiteralExpression = callExpressions[0].getArguments()[1]\n if (!Node.isObjectLiteralExpression(objectLiteralExpression)) {\n throw new Error(`The second argument of Env.create is not an object literal.`)\n }\n\n let shouldAddComment = true\n\n /**\n * Add each variable validation\n */\n for (const [variable, validation] of Object.entries(definition.variables)) {\n /**\n * Check if the variable is already defined. If so, remove it\n */\n const existingProperty = objectLiteralExpression.getProperty(variable)\n\n /**\n * Do not add leading comment if one or more properties\n * already exists\n */\n if (existingProperty) {\n shouldAddComment = false\n }\n\n /**\n * Add property only when the property does not exist\n */\n if (!existingProperty) {\n objectLiteralExpression.addPropertyAssignment({\n name: variable,\n initializer: validation,\n leadingTrivia: (writer) => {\n if (!shouldAddComment) {\n return\n }\n\n shouldAddComment = false\n return this.#addLeadingComment(writer, definition.leadingComment)\n },\n })\n }\n }\n\n file.formatText(this.#editorSettings)\n await file.save()\n }\n\n /**\n * Define new middlewares inside the `start/kernel.ts`\n * file\n *\n * This function is highly based on some assumptions\n * and will not work if you significantly tweaked\n * your `start/kernel.ts` file.\n */\n async addMiddlewareToStack(stack: 'server' | 'router' | 'named', middleware: MiddlewareNode[]) {\n /**\n * Get the `start/kernel.ts` source file\n */\n const kernelUrl = fileURLToPath(new URL('./start/kernel.ts', this.#cwd))\n const file = this.project.getSourceFileOrThrow(kernelUrl)\n\n /**\n * Process each middleware entry\n */\n for (const middlewareEntry of middleware) {\n if (stack === 'named') {\n this.#addToNamedMiddleware(file, middlewareEntry)\n } else {\n this.#addToMiddlewareArray(file!, `${stack}.use`, middlewareEntry)\n }\n }\n\n file.formatText(this.#editorSettings)\n await file.save()\n }\n\n /**\n * Update the `adonisrc.ts` file\n */\n async updateRcFile(callback: (transformer: RcFileTransformer) => void) {\n const rcFileTransformer = new RcFileTransformer(this.#cwd, this.project)\n callback(rcFileTransformer)\n await rcFileTransformer.save()\n }\n\n /**\n * Add a new Japa plugin in the `tests/bootstrap.ts` file\n */\n async addJapaPlugin(\n pluginCall: string,\n importDeclarations: { isNamed: boolean; module: string; identifier: string }[]\n ) {\n /**\n * Get the `tests/bootstrap.ts` source file\n */\n const testBootstrapUrl = fileURLToPath(new URL('./tests/bootstrap.ts', this.#cwd))\n const file = this.project.getSourceFileOrThrow(testBootstrapUrl)\n\n /**\n * Add the import declarations\n */\n this.#addImportDeclarations(file, importDeclarations)\n\n /**\n * Insert the plugin call in the `plugins` array\n */\n const pluginsArray = file\n .getVariableDeclaration('plugins')\n ?.getInitializerIfKind(SyntaxKind.ArrayLiteralExpression)\n\n /**\n * Add plugin call to the plugins array\n */\n if (pluginsArray) {\n if (!pluginsArray.getElements().find((element) => element.getText() === pluginCall)) {\n pluginsArray.addElement(pluginCall)\n }\n }\n\n file.formatText(this.#editorSettings)\n await file.save()\n }\n\n /**\n * Add a new Vite plugin\n */\n async addVitePlugin(\n pluginCall: string,\n importDeclarations: { isNamed: boolean; module: string; identifier: string }[]\n ) {\n /**\n * Get the `vite.config.ts` source file\n */\n const viteConfigTsUrl = fileURLToPath(new URL('./vite.config.ts', this.#cwd))\n\n const file = this.project.getSourceFile(viteConfigTsUrl)\n if (!file) {\n throw new Error(\n 'Cannot find vite.config.ts file. Make sure to rename vite.config.js to vite.config.ts'\n )\n }\n\n /**\n * Add the import declarations\n */\n this.#addImportDeclarations(file, importDeclarations)\n\n /**\n * Get the default export options\n */\n const defaultExport = file.getDefaultExportSymbol()\n if (!defaultExport) {\n throw new Error('Cannot find the default export in vite.config.ts')\n }\n\n /**\n * Get the options object\n * - Either the first argument of `defineConfig` call : `export default defineConfig({})`\n * - Or child literal expression of the default export : `export default {}`\n */\n const declaration = defaultExport.getDeclarations()[0]\n const options =\n declaration.getChildrenOfKind(SyntaxKind.ObjectLiteralExpression)[0] ||\n declaration.getChildrenOfKind(SyntaxKind.CallExpression)[0].getArguments()[0]\n\n const pluginsArray = options\n .getPropertyOrThrow('plugins')\n .getFirstChildByKindOrThrow(SyntaxKind.ArrayLiteralExpression)\n\n /**\n * Add plugin call to the plugins array\n */\n if (!pluginsArray.getElements().find((element) => element.getText() === pluginCall)) {\n pluginsArray.addElement(pluginCall)\n }\n\n file.formatText(this.#editorSettings)\n await file.save()\n }\n\n /**\n * Adds a policy to the list of `policies` object configured\n * inside the `app/policies/main.ts` file.\n */\n async addPolicies(policies: BouncerPolicyNode[]) {\n /**\n * Get the `app/policies/main.ts` source file\n */\n const kernelUrl = fileURLToPath(new URL('./app/policies/main.ts', this.#cwd))\n const file = this.project.getSourceFileOrThrow(kernelUrl)\n\n /**\n * Process each middleware entry\n */\n for (const policy of policies) {\n this.#addToPoliciesList(file, policy)\n }\n\n file.formatText(this.#editorSettings)\n await file.save()\n }\n}\n","/*\n * @adonisjs/assembler\n *\n * (c) AdonisJS\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport { fileURLToPath } from 'node:url'\nimport type { AppEnvironments } from '@adonisjs/application/types'\nimport {\n Node,\n Project,\n SourceFile,\n SyntaxKind,\n CallExpression,\n PropertyAssignment,\n FormatCodeSettings,\n ArrayLiteralExpression,\n} from 'ts-morph'\n\n/**\n * RcFileTransformer is used to transform the `adonisrc.ts` file\n * for adding new commands, providers, meta files etc\n */\nexport class RcFileTransformer {\n #cwd: URL\n #project: Project\n\n /**\n * Settings to use when persisting files\n */\n #editorSettings: FormatCodeSettings = {\n indentSize: 2,\n convertTabsToSpaces: true,\n trimTrailingWhitespace: true,\n ensureNewLineAtEndOfFile: true,\n indentStyle: 2,\n // @ts-expect-error SemicolonPreference doesn't seem to be re-exported from ts-morph\n semicolons: 'remove',\n }\n\n constructor(cwd: URL, project: Project) {\n this.#cwd = cwd\n this.#project = project\n }\n\n /**\n * Get the `adonisrc.ts` source file\n */\n #getRcFileOrThrow() {\n const kernelUrl = fileURLToPath(new URL('./adonisrc.ts', this.#cwd))\n return this.#project.getSourceFileOrThrow(kernelUrl)\n }\n\n /**\n * Check if environments array has a subset of available environments\n */\n #isInSpecificEnvironment(environments?: AppEnvironments[]): boolean {\n if (!environments) {\n return false\n }\n\n return !!(['web', 'console', 'test', 'repl'] as const).find(\n (env) => !environments.includes(env)\n )\n }\n\n /**\n * Locate the `defineConfig` call inside the `adonisrc.ts` file\n */\n #locateDefineConfigCallOrThrow(file: SourceFile) {\n const call = file\n .getDescendantsOfKind(SyntaxKind.CallExpression)\n .find((statement) => statement.getExpression().getText() === 'defineConfig')\n\n if (!call) {\n throw new Error('Could not locate the defineConfig call.')\n }\n\n return call\n }\n\n /**\n * Return the ObjectLiteralExpression of the defineConfig call\n */\n #getDefineConfigObjectOrThrow(defineConfigCall: CallExpression) {\n const configObject = defineConfigCall\n .getArguments()[0]\n .asKindOrThrow(SyntaxKind.ObjectLiteralExpression)\n\n return configObject\n }\n\n /**\n * Check if the defineConfig() call has the property assignment\n * inside it or not. If not, it will create one and return it.\n */\n #getPropertyAssignmentInDefineConfigCall(propertyName: string, initializer: string) {\n const file = this.#getRcFileOrThrow()\n const defineConfigCall = this.#locateDefineConfigCallOrThrow(file)\n const configObject = this.#getDefineConfigObjectOrThrow(defineConfigCall)\n\n let property = configObject.getProperty(propertyName)\n\n if (!property) {\n configObject.addPropertyAssignment({ name: propertyName, initializer })\n property = configObject.getProperty(propertyName)\n }\n\n return property as PropertyAssignment\n }\n\n /**\n * Extract list of imported modules from an ArrayLiteralExpression\n *\n * It assumes that the array can have two types of elements:\n *\n * - Simple lazy imported modules: [() => import('path/to/file')]\n * - Or an object entry: [{ file: () => import('path/to/file'), environment: ['web', 'console'] }]\n * where the `file` property is a lazy imported module.\n */\n #extractModulesFromArray(array: ArrayLiteralExpression) {\n const modules = array.getElements().map((element) => {\n /**\n * Simple lazy imported module\n */\n if (Node.isArrowFunction(element)) {\n const importExp = element.getFirstDescendantByKindOrThrow(SyntaxKind.CallExpression)\n const literal = importExp.getFirstDescendantByKindOrThrow(SyntaxKind.StringLiteral)\n return literal.getLiteralValue()\n }\n\n /**\n * Object entry\n */\n if (Node.isObjectLiteralExpression(element)) {\n const fileProp = element.getPropertyOrThrow('file') as PropertyAssignment\n const arrowFn = fileProp.getFirstDescendantByKindOrThrow(SyntaxKind.ArrowFunction)\n const importExp = arrowFn.getFirstDescendantByKindOrThrow(SyntaxKind.CallExpression)\n const literal = importExp.getFirstDescendantByKindOrThrow(SyntaxKind.StringLiteral)\n return literal.getLiteralValue()\n }\n })\n\n return modules.filter(Boolean) as string[]\n }\n\n /**\n * Extract a specific property from an ArrayLiteralExpression\n * that contains object entries.\n *\n * This function is mainly used for extractring the `pattern` property\n * when adding a new meta files entry, or the `name` property when\n * adding a new test suite.\n */\n #extractPropertyFromArray(array: ArrayLiteralExpression, propertyName: string) {\n const property = array.getElements().map((el) => {\n if (!Node.isObjectLiteralExpression(el)) return\n\n const nameProp = el.getPropertyOrThrow(propertyName)\n if (!Node.isPropertyAssignment(nameProp)) return\n\n const name = nameProp.getInitializerIfKindOrThrow(SyntaxKind.StringLiteral)\n return name.getLiteralValue()\n })\n\n return property.filter(Boolean) as string[]\n }\n\n /**\n * Build a new module entry for the preloads and providers array\n * based upon the environments specified\n */\n #buildNewModuleEntry(modulePath: string, environments?: AppEnvironments[]) {\n if (!this.#isInSpecificEnvironment(environments)) {\n return `() => import('${modulePath}')`\n }\n\n return `{\n file: () => import('${modulePath}'),\n environment: [${environments?.map((env) => `'${env}'`).join(', ')}],\n }`\n }\n\n /**\n * Add a new command to the rcFile\n */\n addCommand(commandPath: string) {\n const commandsProperty = this.#getPropertyAssignmentInDefineConfigCall('commands', '[]')\n const commandsArray = commandsProperty.getInitializerIfKindOrThrow(\n SyntaxKind.ArrayLiteralExpression\n )\n\n const commandString = `() => import('${commandPath}')`\n\n /**\n * If the command already exists, do nothing\n */\n if (commandsArray.getElements().some((el) => el.getText() === commandString)) {\n return this\n }\n\n /**\n * Add the command to the array\n */\n commandsArray.addElement(commandString)\n return this\n }\n\n /**\n * Add a new preloaded file to the rcFile\n */\n addPreloadFile(modulePath: string, environments?: AppEnvironments[]) {\n const preloadsProperty = this.#getPropertyAssignmentInDefineConfigCall('preloads', '[]')\n const preloadsArray = preloadsProperty.getInitializerIfKindOrThrow(\n SyntaxKind.ArrayLiteralExpression\n )\n\n /**\n * Check for duplicates\n */\n const existingPreloadedFiles = this.#extractModulesFromArray(preloadsArray)\n const isDuplicate = existingPreloadedFiles.includes(modulePath)\n if (isDuplicate) {\n return this\n }\n\n /**\n * Add the preloaded file to the array\n */\n preloadsArray.addElement(this.#buildNewModuleEntry(modulePath, environments))\n return this\n }\n\n /**\n * Add a new provider to the rcFile\n */\n addProvider(providerPath: string, environments?: AppEnvironments[]) {\n const property = this.#getPropertyAssignmentInDefineConfigCall('providers', '[]')\n const providersArray = property.getInitializerIfKindOrThrow(SyntaxKind.ArrayLiteralExpression)\n\n /**\n * Check for duplicates\n */\n const existingProviderPaths = this.#extractModulesFromArray(providersArray)\n const isDuplicate = existingProviderPaths.includes(providerPath)\n if (isDuplicate) {\n return this\n }\n\n /**\n * Add the provider to the array\n */\n providersArray.addElement(this.#buildNewModuleEntry(providerPath, environments))\n\n return this\n }\n\n /**\n * Add a new meta file to the rcFile\n */\n addMetaFile(globPattern: string, reloadServer = false) {\n const property = this.#getPropertyAssignmentInDefineConfigCall('metaFiles', '[]')\n const metaFilesArray = property.getInitializerIfKindOrThrow(SyntaxKind.ArrayLiteralExpression)\n\n /**\n * Check for duplicates\n */\n const alreadyDefinedPatterns = this.#extractPropertyFromArray(metaFilesArray, 'pattern')\n if (alreadyDefinedPatterns.includes(globPattern)) {\n return this\n }\n\n /**\n * Add the meta file to the array\n */\n metaFilesArray.addElement(\n `{\n pattern: '${globPattern}',\n reloadServer: ${reloadServer},\n }`\n )\n\n return this\n }\n\n /**\n * Set directory name and path\n */\n setDirectory(key: string, value: string) {\n const property = this.#getPropertyAssignmentInDefineConfigCall('directories', '{}')\n const directories = property.getInitializerIfKindOrThrow(SyntaxKind.ObjectLiteralExpression)\n directories.addPropertyAssignment({ name: key, initializer: `'${value}'` })\n\n return this\n }\n\n /**\n * Set command alias\n */\n setCommandAlias(alias: string, command: string) {\n const aliasProperty = this.#getPropertyAssignmentInDefineConfigCall('commandsAliases', '{}')\n const aliases = aliasProperty.getInitializerIfKindOrThrow(SyntaxKind.ObjectLiteralExpression)\n aliases.addPropertyAssignment({ name: alias, initializer: `'${command}'` })\n\n return this\n }\n\n /**\n * Add a new test suite to the rcFile\n */\n addSuite(suiteName: string, files: string | string[], timeout?: number) {\n const testProperty = this.#getPropertyAssignmentInDefineConfigCall(\n 'tests',\n `{ suites: [], forceExit: true, timeout: 2000 }`\n )\n\n const property = testProperty\n .getInitializerIfKindOrThrow(SyntaxKind.ObjectLiteralExpression)\n .getPropertyOrThrow('suites') as PropertyAssignment\n\n const suitesArray = property.getInitializerIfKindOrThrow(SyntaxKind.ArrayLiteralExpression)\n\n /**\n * Check for duplicates\n */\n const existingSuitesNames = this.#extractPropertyFromArray(suitesArray, 'name')\n if (existingSuitesNames.includes(suiteName)) {\n return this\n }\n\n /**\n * Add the suite to the array\n */\n const filesArray = Array.isArray(files) ? files : [files]\n suitesArray.addElement(\n `{\n name: '${suiteName}',\n files: [${filesArray.map((file) => `'${file}'`).join(', ')}],\n timeout: ${timeout ?? 2000},\n }`\n )\n\n return this\n }\n\n /**\n * Save the adonisrc.ts file\n */\n save() {\n const file = this.#getRcFileOrThrow()\n file.formatText(this.#editorSettings)\n return file.save()\n }\n}\n"],"mappings":";AASA,SAAS,YAAY;A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ClD,QAAI,CAAC,eAAe;AAClB,YAAM,IAAI,MAAM,kDAAkD;AAAA,IACpE;AAOA,UAAM,cAAc,cAAc,gBAAgB,EAAE,CAAC;AACrD,UAAM,UACJ,YAAY,kBAAkBC,YAAW,uBAAuB,EAAE,CAAC,KACnE,YAAY,kBAAkBA,YAAW,cAAc,EAAE,CAAC,EAAE,aAAa,EAAE,CAAC;AAE9E,UAAM,eAAe,QAClB,mBAAmB,SAAS,EAC5B,2BAA2BA,YAAW,sBAAsB;AAK/D,QAAI,CAAC,aAAa,YAAY,EAAE,KAAK,CAAC,YAAY,QAAQ,QAAQ,MAAM,UAAU,GAAG;AACnF,mBAAa,WAAW,UAAU;AAAA,IACpC;AAEA,SAAK,WAAW,KAAK,eAAe;AACpC,UAAM,KAAK,KAAK;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,YAAY,UAA+B;AAI/C,UAAM,YAAYD,eAAc,IAAI,IAAI,0BAA0B,KAAK,IAAI,CAAC;AAC5E,UAAM,OAAO,KAAK,QAAQ,qBAAqB,SAAS;AAKxD,eAAW,UAAU,UAAU;AAC7B,WAAK,mBAAmB,MAAM,MAAM;AAAA,IACtC;AAEA,SAAK,WAAW,KAAK,eAAe;AACpC,UAAM,KAAK,KAAK;AAAA,EAClB;AACF;","names":["fileURLToPath","Node","Project","SyntaxKind","Project","fileURLToPath","SyntaxKind","Node"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/code_transformer/main.ts","../../../src/code_transformer/rc_file_transformer.ts"],"sourcesContent":["/*\n * @adonisjs/assembler\n *\n * (c) AdonisJS\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport { join } from 'node:path'\nimport { fileURLToPath } from 'node:url'\nimport { installPackage, detectPackageManager } from '@antfu/install-pkg'\nimport {\n Node,\n Project,\n QuoteKind,\n SourceFile,\n SyntaxKind,\n CodeBlockWriter,\n FormatCodeSettings,\n} from 'ts-morph'\n\nimport { RcFileTransformer } from './rc_file_transformer.js'\nimport type { MiddlewareNode, EnvValidationNode, BouncerPolicyNode } from '../types.js'\n\n/**\n * This class is responsible for updating\n */\nexport class CodeTransformer {\n /**\n * Exporting utilities to install package and detect\n * the package manager\n */\n installPackage = installPackage\n detectPackageManager = detectPackageManager\n\n /**\n * Directory of the adonisjs project\n */\n #cwd: URL\n\n /**\n * The TsMorph project\n */\n project: Project\n\n /**\n * Settings to use when persisting files\n */\n #editorSettings: FormatCodeSettings = {\n indentSize: 2,\n convertTabsToSpaces: true,\n trimTrailingWhitespace: true,\n ensureNewLineAtEndOfFile: true,\n indentStyle: 2,\n // @ts-expect-error SemicolonPreference doesn't seem to be re-exported from ts-morph\n semicolons: 'remove',\n }\n\n constructor(cwd: URL) {\n this.#cwd = cwd\n this.project = new Project({\n tsConfigFilePath: join(fileURLToPath(this.#cwd), 'tsconfig.json'),\n manipulationSettings: { quoteKind: QuoteKind.Single },\n })\n }\n\n /**\n * Add a new middleware to the middleware array of the\n * given file\n */\n #addToMiddlewareArray(file: SourceFile, target: string, middlewareEntry: MiddlewareNode) {\n const callExpressions = file\n .getDescendantsOfKind(SyntaxKind.CallExpression)\n .filter((statement) => statement.getExpression().getText() === target)\n\n if (!callExpressions.length) {\n throw new Error(`Cannot find ${target} statement in the file.`)\n }\n\n const arrayLiteralExpression = callExpressions[0].getArguments()[0]\n if (!arrayLiteralExpression || !Node.isArrayLiteralExpression(arrayLiteralExpression)) {\n throw new Error(`Cannot find middleware array in ${target} statement.`)\n }\n\n const middleware = `() => import('${middlewareEntry.path}')`\n\n /**\n * Delete the existing middleware if it exists\n */\n const existingMiddlewareIndex = arrayLiteralExpression\n .getElements()\n .findIndex((element) => element.getText() === middleware)\n\n if (existingMiddlewareIndex === -1) {\n /**\n * Add the middleware to the top or bottom of the array\n */\n if (middlewareEntry.position === 'before') {\n arrayLiteralExpression.insertElement(0, middleware)\n } else {\n arrayLiteralExpression.addElement(middleware)\n }\n }\n }\n\n /**\n * Add a new middleware to the named middleware of the given file\n */\n #addToNamedMiddleware(file: SourceFile, middlewareEntry: MiddlewareNode) {\n if (!middlewareEntry.name) {\n throw new Error('Named middleware requires a name.')\n }\n\n const callArguments = file\n .getVariableDeclarationOrThrow('middleware')\n .getInitializerIfKindOrThrow(SyntaxKind.CallExpression)\n .getArguments()\n\n if (callArguments.length === 0) {\n throw new Error('Named middleware call has no arguments.')\n }\n\n const namedMiddlewareObject = callArguments[0]\n if (!Node.isObjectLiteralExpression(namedMiddlewareObject)) {\n throw new Error('The argument of the named middleware call is not an object literal.')\n }\n\n /**\n * Check if property is already defined. If so, remove it\n */\n const existingProperty = namedMiddlewareObject.getProperty(middlewareEntry.name)\n if (!existingProperty) {\n /**\n * Add the named middleware\n */\n const middleware = `${middlewareEntry.name}: () => import('${middlewareEntry.path}')`\n namedMiddlewareObject!.insertProperty(0, middleware)\n }\n }\n\n /**\n * Add a policy to the list of pre-registered policy\n */\n #addToPoliciesList(file: SourceFile, policyEntry: BouncerPolicyNode) {\n const policiesObject = file\n .getVariableDeclarationOrThrow('policies')\n .getInitializerIfKindOrThrow(SyntaxKind.ObjectLiteralExpression)\n\n /**\n * Only define policy when one with the existing name does not\n * exist.\n */\n const existingProperty = policiesObject.getProperty(policyEntry.name)\n if (!existingProperty) {\n const policy = `${policyEntry.name}: () => import('${policyEntry.path}')`\n policiesObject!.insertProperty(0, policy)\n }\n }\n\n /**\n * Add the given import declarations to the source file\n * and merge named imports with the existing import\n */\n #addImportDeclarations(\n file: SourceFile,\n importDeclarations: { isNamed: boolean; module: string; identifier: string }[]\n ) {\n const existingImports = file.getImportDeclarations()\n\n importDeclarations.forEach((importDeclaration) => {\n const existingImport = existingImports.find(\n (mod) => mod.getModuleSpecifierValue() === importDeclaration.module\n )\n\n /**\n * Add a new named import to existing import for the\n * same module\n */\n if (existingImport && importDeclaration.isNamed) {\n if (\n !existingImport\n .getNamedImports()\n .find((namedImport) => namedImport.getName() === importDeclaration.identifier)\n ) {\n existingImport.addNamedImport(importDeclaration.identifier)\n }\n return\n }\n\n /**\n * Ignore default import when the same module is already imported.\n * The chances are the existing default import and the importDeclaration\n * identifiers are not the same. But we should not modify existing source\n */\n if (existingImport) {\n return\n }\n\n file.addImportDeclaration({\n ...(importDeclaration.isNamed\n ? { namedImports: [importDeclaration.identifier] }\n : { defaultImport: importDeclaration.identifier }),\n moduleSpecifier: importDeclaration.module,\n })\n })\n }\n\n /**\n * Write a leading comment\n */\n #addLeadingComment(writer: CodeBlockWriter, comment?: string) {\n if (!comment) {\n return writer.blankLine()\n }\n\n return writer\n .blankLine()\n .writeLine('/*')\n .writeLine(`|----------------------------------------------------------`)\n .writeLine(`| ${comment}`)\n .writeLine(`|----------------------------------------------------------`)\n .writeLine(`*/`)\n }\n\n /**\n * Add new env variable validation in the\n * `env.ts` file\n */\n async defineEnvValidations(definition: EnvValidationNode) {\n /**\n * Get the `start/env.ts` source file\n */\n const kernelUrl = fileURLToPath(new URL('./start/env.ts', this.#cwd))\n const file = this.project.getSourceFileOrThrow(kernelUrl)\n\n /**\n * Get the `Env.create` call expression\n */\n const callExpressions = file\n .getDescendantsOfKind(SyntaxKind.CallExpression)\n .filter((statement) => statement.getExpression().getText() === 'Env.create')\n\n if (!callExpressions.length) {\n throw new Error(`Cannot find Env.create statement in the file.`)\n }\n\n const objectLiteralExpression = callExpressions[0].getArguments()[1]\n if (!Node.isObjectLiteralExpression(objectLiteralExpression)) {\n throw new Error(`The second argument of Env.create is not an object literal.`)\n }\n\n let shouldAddComment = true\n\n /**\n * Add each variable validation\n */\n for (const [variable, validation] of Object.entries(definition.variables)) {\n /**\n * Check if the variable is already defined. If so, remove it\n */\n const existingProperty = objectLiteralExpression.getProperty(variable)\n\n /**\n * Do not add leading comment if one or more properties\n * already exists\n */\n if (existingProperty) {\n shouldAddComment = false\n }\n\n /**\n * Add property only when the property does not exist\n */\n if (!existingProperty) {\n objectLiteralExpression.addPropertyAssignment({\n name: variable,\n initializer: validation,\n leadingTrivia: (writer) => {\n if (!shouldAddComment) {\n return\n }\n\n shouldAddComment = false\n return this.#addLeadingComment(writer, definition.leadingComment)\n },\n })\n }\n }\n\n file.formatText(this.#editorSettings)\n await file.save()\n }\n\n /**\n * Define new middlewares inside the `start/kernel.ts`\n * file\n *\n * This function is highly based on some assumptions\n * and will not work if you significantly tweaked\n * your `start/kernel.ts` file.\n */\n async addMiddlewareToStack(stack: 'server' | 'router' | 'named', middleware: MiddlewareNode[]) {\n /**\n * Get the `start/kernel.ts` source file\n */\n const kernelUrl = fileURLToPath(new URL('./start/kernel.ts', this.#cwd))\n const file = this.project.getSourceFileOrThrow(kernelUrl)\n\n /**\n * Process each middleware entry\n */\n for (const middlewareEntry of middleware) {\n if (stack === 'named') {\n this.#addToNamedMiddleware(file, middlewareEntry)\n } else {\n this.#addToMiddlewareArray(file!, `${stack}.use`, middlewareEntry)\n }\n }\n\n file.formatText(this.#editorSettings)\n await file.save()\n }\n\n /**\n * Update the `adonisrc.ts` file\n */\n async updateRcFile(callback: (transformer: RcFileTransformer) => void) {\n const rcFileTransformer = new RcFileTransformer(this.#cwd, this.project)\n callback(rcFileTransformer)\n await rcFileTransformer.save()\n }\n\n /**\n * Add a new Japa plugin in the `tests/bootstrap.ts` file\n */\n async addJapaPlugin(\n pluginCall: string,\n importDeclarations: { isNamed: boolean; module: string; identifier: string }[]\n ) {\n /**\n * Get the `tests/bootstrap.ts` source file\n */\n const testBootstrapUrl = fileURLToPath(new URL('./tests/bootstrap.ts', this.#cwd))\n const file = this.project.getSourceFileOrThrow(testBootstrapUrl)\n\n /**\n * Add the import declarations\n */\n this.#addImportDeclarations(file, importDeclarations)\n\n /**\n * Insert the plugin call in the `plugins` array\n */\n const pluginsArray = file\n .getVariableDeclaration('plugins')\n ?.getInitializerIfKind(SyntaxKind.ArrayLiteralExpression)\n\n /**\n * Add plugin call to the plugins array\n */\n if (pluginsArray) {\n if (!pluginsArray.getElements().find((element) => element.getText() === pluginCall)) {\n pluginsArray.addElement(pluginCall)\n }\n }\n\n file.formatText(this.#editorSettings)\n await file.save()\n }\n\n /**\n * Add a new Vite plugin\n */\n async addVitePlugin(\n pluginCall: string,\n importDeclarations: { isNamed: boolean; module: string; identifier: string }[]\n ) {\n /**\n * Get the `vite.config.ts` source file\n */\n const viteConfigTsUrl = fileURLToPath(new URL('./vite.config.ts', this.#cwd))\n\n const file = this.project.getSourceFile(viteConfigTsUrl)\n if (!file) {\n throw new Error(\n 'Cannot find vite.config.ts file. Make sure to rename vite.config.js to vite.config.ts'\n )\n }\n\n /**\n * Add the import declarations\n */\n this.#addImportDeclarations(file, importDeclarations)\n\n /**\n * Get the default export options\n */\n const defaultExport = file.getDefaultExportSymbol()\n if (!defaultExport) {\n throw new Error('Cannot find the default export in vite.config.ts')\n }\n\n /**\n * Get the options object\n * - Either the first argument of `defineConfig` call : `export default defineConfig({})`\n * - Or child literal expression of the default export : `export default {}`\n */\n const declaration = defaultExport.getDeclarations()[0]\n const options =\n declaration.getChildrenOfKind(SyntaxKind.ObjectLiteralExpression)[0] ||\n declaration.getChildrenOfKind(SyntaxKind.CallExpression)[0].getArguments()[0]\n\n const pluginsArray = options\n .getPropertyOrThrow('plugins')\n .getFirstChildByKindOrThrow(SyntaxKind.ArrayLiteralExpression)\n\n /**\n * Add plugin call to the plugins array\n */\n if (!pluginsArray.getElements().find((element) => element.getText() === pluginCall)) {\n pluginsArray.addElement(pluginCall)\n }\n\n file.formatText(this.#editorSettings)\n await file.save()\n }\n\n /**\n * Adds a policy to the list of `policies` object configured\n * inside the `app/policies/main.ts` file.\n */\n async addPolicies(policies: BouncerPolicyNode[]) {\n /**\n * Get the `app/policies/main.ts` source file\n */\n const kernelUrl = fileURLToPath(new URL('./app/policies/main.ts', this.#cwd))\n const file = this.project.getSourceFileOrThrow(kernelUrl)\n\n /**\n * Process each middleware entry\n */\n for (const policy of policies) {\n this.#addToPoliciesList(file, policy)\n }\n\n file.formatText(this.#editorSettings)\n await file.save()\n }\n}\n","/*\n * @adonisjs/assembler\n *\n * (c) AdonisJS\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport { fileURLToPath } from 'node:url'\nimport type { AppEnvironments, RcFile } from '@adonisjs/application/types'\nimport {\n Node,\n Project,\n SourceFile,\n SyntaxKind,\n CallExpression,\n PropertyAssignment,\n FormatCodeSettings,\n ArrayLiteralExpression,\n} from 'ts-morph'\n\n/**\n * RcFileTransformer is used to transform the `adonisrc.ts` file\n * for adding new commands, providers, meta files etc\n */\nexport class RcFileTransformer {\n #cwd: URL\n #project: Project\n\n /**\n * Settings to use when persisting files\n */\n #editorSettings: FormatCodeSettings = {\n indentSize: 2,\n convertTabsToSpaces: true,\n trimTrailingWhitespace: true,\n ensureNewLineAtEndOfFile: true,\n indentStyle: 2,\n // @ts-expect-error SemicolonPreference doesn't seem to be re-exported from ts-morph\n semicolons: 'remove',\n }\n\n constructor(cwd: URL, project: Project) {\n this.#cwd = cwd\n this.#project = project\n }\n\n /**\n * Get the `adonisrc.ts` source file\n */\n #getRcFileOrThrow() {\n const kernelUrl = fileURLToPath(new URL('./adonisrc.ts', this.#cwd))\n return this.#project.getSourceFileOrThrow(kernelUrl)\n }\n\n /**\n * Check if environments array has a subset of available environments\n */\n #isInSpecificEnvironment(environments?: AppEnvironments[]): boolean {\n if (!environments) {\n return false\n }\n\n return !!(['web', 'console', 'test', 'repl'] as const).find(\n (env) => !environments.includes(env)\n )\n }\n\n /**\n * Locate the `defineConfig` call inside the `adonisrc.ts` file\n */\n #locateDefineConfigCallOrThrow(file: SourceFile) {\n const call = file\n .getDescendantsOfKind(SyntaxKind.CallExpression)\n .find((statement) => statement.getExpression().getText() === 'defineConfig')\n\n if (!call) {\n throw new Error('Could not locate the defineConfig call.')\n }\n\n return call\n }\n\n /**\n * Return the ObjectLiteralExpression of the defineConfig call\n */\n #getDefineConfigObjectOrThrow(defineConfigCall: CallExpression) {\n const configObject = defineConfigCall\n .getArguments()[0]\n .asKindOrThrow(SyntaxKind.ObjectLiteralExpression)\n\n return configObject\n }\n\n /**\n * Check if the defineConfig() call has the property assignment\n * inside it or not. If not, it will create one and return it.\n */\n #getPropertyAssignmentInDefineConfigCall(propertyName: string, initializer: string) {\n const file = this.#getRcFileOrThrow()\n const defineConfigCall = this.#locateDefineConfigCallOrThrow(file)\n const configObject = this.#getDefineConfigObjectOrThrow(defineConfigCall)\n\n let property = configObject.getProperty(propertyName)\n\n if (!property) {\n configObject.addPropertyAssignment({ name: propertyName, initializer })\n property = configObject.getProperty(propertyName)\n }\n\n return property as PropertyAssignment\n }\n\n /**\n * Extract list of imported modules from an ArrayLiteralExpression\n *\n * It assumes that the array can have two types of elements:\n *\n * - Simple lazy imported modules: [() => import('path/to/file')]\n * - Or an object entry: [{ file: () => import('path/to/file'), environment: ['web', 'console'] }]\n * where the `file` property is a lazy imported module.\n */\n #extractModulesFromArray(array: ArrayLiteralExpression) {\n const modules = array.getElements().map((element) => {\n /**\n * Simple lazy imported module\n */\n if (Node.isArrowFunction(element)) {\n const importExp = element.getFirstDescendantByKindOrThrow(SyntaxKind.CallExpression)\n const literal = importExp.getFirstDescendantByKindOrThrow(SyntaxKind.StringLiteral)\n return literal.getLiteralValue()\n }\n\n /**\n * Object entry\n */\n if (Node.isObjectLiteralExpression(element)) {\n const fileProp = element.getPropertyOrThrow('file') as PropertyAssignment\n const arrowFn = fileProp.getFirstDescendantByKindOrThrow(SyntaxKind.ArrowFunction)\n const importExp = arrowFn.getFirstDescendantByKindOrThrow(SyntaxKind.CallExpression)\n const literal = importExp.getFirstDescendantByKindOrThrow(SyntaxKind.StringLiteral)\n return literal.getLiteralValue()\n }\n })\n\n return modules.filter(Boolean) as string[]\n }\n\n /**\n * Extract a specific property from an ArrayLiteralExpression\n * that contains object entries.\n *\n * This function is mainly used for extractring the `pattern` property\n * when adding a new meta files entry, or the `name` property when\n * adding a new test suite.\n */\n #extractPropertyFromArray(array: ArrayLiteralExpression, propertyName: string) {\n const property = array.getElements().map((el) => {\n if (!Node.isObjectLiteralExpression(el)) return\n\n const nameProp = el.getPropertyOrThrow(propertyName)\n if (!Node.isPropertyAssignment(nameProp)) return\n\n const name = nameProp.getInitializerIfKindOrThrow(SyntaxKind.StringLiteral)\n return name.getLiteralValue()\n })\n\n return property.filter(Boolean) as string[]\n }\n\n /**\n * Build a new module entry for the preloads and providers array\n * based upon the environments specified\n */\n #buildNewModuleEntry(modulePath: string, environments?: AppEnvironments[]) {\n if (!this.#isInSpecificEnvironment(environments)) {\n return `() => import('${modulePath}')`\n }\n\n return `{\n file: () => import('${modulePath}'),\n environment: [${environments?.map((env) => `'${env}'`).join(', ')}],\n }`\n }\n\n /**\n * Add a new command to the rcFile\n */\n addCommand(commandPath: string) {\n const commandsProperty = this.#getPropertyAssignmentInDefineConfigCall('commands', '[]')\n const commandsArray = commandsProperty.getInitializerIfKindOrThrow(\n SyntaxKind.ArrayLiteralExpression\n )\n\n const commandString = `() => import('${commandPath}')`\n\n /**\n * If the command already exists, do nothing\n */\n if (commandsArray.getElements().some((el) => el.getText() === commandString)) {\n return this\n }\n\n /**\n * Add the command to the array\n */\n commandsArray.addElement(commandString)\n return this\n }\n\n /**\n * Add a new preloaded file to the rcFile\n */\n addPreloadFile(modulePath: string, environments?: AppEnvironments[]) {\n const preloadsProperty = this.#getPropertyAssignmentInDefineConfigCall('preloads', '[]')\n const preloadsArray = preloadsProperty.getInitializerIfKindOrThrow(\n SyntaxKind.ArrayLiteralExpression\n )\n\n /**\n * Check for duplicates\n */\n const existingPreloadedFiles = this.#extractModulesFromArray(preloadsArray)\n const isDuplicate = existingPreloadedFiles.includes(modulePath)\n if (isDuplicate) {\n return this\n }\n\n /**\n * Add the preloaded file to the array\n */\n preloadsArray.addElement(this.#buildNewModuleEntry(modulePath, environments))\n return this\n }\n\n /**\n * Add a new provider to the rcFile\n */\n addProvider(providerPath: string, environments?: AppEnvironments[]) {\n const property = this.#getPropertyAssignmentInDefineConfigCall('providers', '[]')\n const providersArray = property.getInitializerIfKindOrThrow(SyntaxKind.ArrayLiteralExpression)\n\n /**\n * Check for duplicates\n */\n const existingProviderPaths = this.#extractModulesFromArray(providersArray)\n const isDuplicate = existingProviderPaths.includes(providerPath)\n if (isDuplicate) {\n return this\n }\n\n /**\n * Add the provider to the array\n */\n providersArray.addElement(this.#buildNewModuleEntry(providerPath, environments))\n\n return this\n }\n\n /**\n * Add a new meta file to the rcFile\n */\n addMetaFile(globPattern: string, reloadServer = false) {\n const property = this.#getPropertyAssignmentInDefineConfigCall('metaFiles', '[]')\n const metaFilesArray = property.getInitializerIfKindOrThrow(SyntaxKind.ArrayLiteralExpression)\n\n /**\n * Check for duplicates\n */\n const alreadyDefinedPatterns = this.#extractPropertyFromArray(metaFilesArray, 'pattern')\n if (alreadyDefinedPatterns.includes(globPattern)) {\n return this\n }\n\n /**\n * Add the meta file to the array\n */\n metaFilesArray.addElement(\n `{\n pattern: '${globPattern}',\n reloadServer: ${reloadServer},\n }`\n )\n\n return this\n }\n\n /**\n * Set directory name and path\n */\n setDirectory(key: string, value: string) {\n const property = this.#getPropertyAssignmentInDefineConfigCall('directories', '{}')\n const directories = property.getInitializerIfKindOrThrow(SyntaxKind.ObjectLiteralExpression)\n directories.addPropertyAssignment({ name: key, initializer: `'${value}'` })\n\n return this\n }\n\n /**\n * Set command alias\n */\n setCommandAlias(alias: string, command: string) {\n const aliasProperty = this.#getPropertyAssignmentInDefineConfigCall('commandsAliases', '{}')\n const aliases = aliasProperty.getInitializerIfKindOrThrow(SyntaxKind.ObjectLiteralExpression)\n aliases.addPropertyAssignment({ name: alias, initializer: `'${command}'` })\n\n return this\n }\n\n /**\n * Add a new test suite to the rcFile\n */\n addSuite(suiteName: string, files: string | string[], timeout?: number) {\n const testProperty = this.#getPropertyAssignmentInDefineConfigCall(\n 'tests',\n `{ suites: [], forceExit: true, timeout: 2000 }`\n )\n\n const property = testProperty\n .getInitializerIfKindOrThrow(SyntaxKind.ObjectLiteralExpression)\n .getPropertyOrThrow('suites') as PropertyAssignment\n\n const suitesArray = property.getInitializerIfKindOrThrow(SyntaxKind.ArrayLiteralExpression)\n\n /**\n * Check for duplicates\n */\n const existingSuitesNames = this.#extractPropertyFromArray(suitesArray, 'name')\n if (existingSuitesNames.includes(suiteName)) {\n return this\n }\n\n /**\n * Add the suite to the array\n */\n const filesArray = Array.isArray(files) ? files : [files]\n suitesArray.addElement(\n `{\n name: '${suiteName}',\n files: [${filesArray.map((file) => `'${file}'`).join(', ')}],\n timeout: ${timeout ?? 2000},\n }`\n )\n\n return this\n }\n\n /**\n * Add a new assembler hook\n */\n addAssemblerHook(type: keyof NonNullable<RcFile['hooks']>, path: string) {\n const hooksProperty = this.#getPropertyAssignmentInDefineConfigCall('hooks', '{}')\n\n const hooks = hooksProperty.getInitializerIfKindOrThrow(SyntaxKind.ObjectLiteralExpression)\n let hookArray = hooks.getProperty(type) as PropertyAssignment\n if (!hookArray) {\n hooks.addPropertyAssignment({ name: type, initializer: '[]' })\n hookArray = hooks.getProperty(type) as PropertyAssignment\n }\n\n const hooksArray = hookArray.getInitializerIfKindOrThrow(SyntaxKind.ArrayLiteralExpression)\n const existingHooks = this.#extractModulesFromArray(hooksArray)\n if (existingHooks.includes(path)) {\n return this\n }\n\n hooksArray.addElement(`() => import('${path}')`)\n\n return this\n }\n\n /**\n * Save the adonisrc.ts file\n */\n save() {\n const file = this.#getRcFileOrThrow()\n file.formatText(this.#editorSettings)\n return file.save()\n }\n}\n"],"mappings":";AASA,SAAS,YAAY;AACrB,SAAS,iBAAAA,sBAAqB;AAC9B,SAAS,gBAAgB,4BAA4B;AACrD;AAAA,EACE,QAAAC;AAAA,EACA,WAAAC;AAAA,EACA;AAAA,EAEA,cAAAC;AAAA,OAGK;;;ACXP,SAAS,qBAAqB;AAE9B;AAAA,EACE;AAAA,EAGA;AAAA,OAKK;AAMA,IAAM,oBAAN,MAAwB;AAAA,EAC7B;AAAA,EACA;AAAA;AAAA;AAAA;AAAA,EAKA,kBAAsC;AAAA,IACpC,YAAY;AAAA,IACZ,qBAAqB;AA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UAAM,OAAO,KAAK,QAAQ,cAAc,eAAe;AACvD,QAAI,CAAC,MAAM;AACT,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAKA,SAAK,uBAAuB,MAAM,kBAAkB;AAKpD,UAAM,gBAAgB,KAAK,uBAAuB;AAClD,QAAI,CAAC,eAAe;AAClB,YAAM,IAAI,MAAM,kDAAkD;AAAA,IACpE;AAOA,UAAM,cAAc,cAAc,gBAAgB,EAAE,CAAC;AACrD,UAAM,UACJ,YAAY,kBAAkBC,YAAW,uBAAuB,EAAE,CAAC,KACnE,YAAY,kBAAkBA,YAAW,cAAc,EAAE,CAAC,EAAE,aAAa,EAAE,CAAC;AAE9E,UAAM,eAAe,QAClB,mBAAmB,SAAS,EAC5B,2BAA2BA,YAAW,sBAAsB;AAK/D,QAAI,CAAC,aAAa,YAAY,EAAE,KAAK,CAAC,YAAY,QAAQ,QAAQ,MAAM,UAAU,GAAG;AACnF,mBAAa,WAAW,UAAU;AAAA,IACpC;AAEA,SAAK,WAAW,KAAK,eAAe;AACpC,UAAM,KAAK,KAAK;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,YAAY,UAA+B;AAI/C,UAAM,YAAYD,eAAc,IAAI,IAAI,0BAA0B,KAAK,IAAI,CAAC;AAC5E,UAAM,OAAO,KAAK,QAAQ,qBAAqB,SAAS;AAKxD,eAAW,UAAU,UAAU;AAC7B,WAAK,mBAAmB,MAAM,MAAM;AAAA,IACtC;AAEA,SAAK,WAAW,KAAK,eAAe;AACpC,UAAM,KAAK,KAAK;AAAA,EAClB;AACF;","names":["fileURLToPath","Node","Project","SyntaxKind","Project","fileURLToPath","SyntaxKind","Node"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
import type { AppEnvironments } from '@adonisjs/application/types';
|
|
2
|
+
import type { AppEnvironments, RcFile } from '@adonisjs/application/types';
|
|
3
3
|
import { Project } from 'ts-morph';
|
|
4
4
|
/**
|
|
5
5
|
* RcFileTransformer is used to transform the `adonisrc.ts` file
|
|
@@ -36,6 +36,10 @@ export declare class RcFileTransformer {
|
|
|
36
36
|
* Add a new test suite to the rcFile
|
|
37
37
|
*/
|
|
38
38
|
addSuite(suiteName: string, files: string | string[], timeout?: number): this;
|
|
39
|
+
/**
|
|
40
|
+
* Add a new assembler hook
|
|
41
|
+
*/
|
|
42
|
+
addAssemblerHook(type: keyof NonNullable<RcFile['hooks']>, path: string): this;
|
|
39
43
|
/**
|
|
40
44
|
* Save the adonisrc.ts file
|
|
41
45
|
*/
|
package/build/src/hooks.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { RcFile, AssemblerHookHandler,
|
|
1
|
+
import { RcFile, AssemblerHookHandler, SourceFileChangedHookHandler } from '@adonisjs/application/types';
|
|
2
2
|
export declare class AssemblerHooks {
|
|
3
3
|
#private;
|
|
4
|
-
constructor(config: RcFile['
|
|
4
|
+
constructor(config: RcFile['hooks']);
|
|
5
5
|
/**
|
|
6
6
|
* Resolve hooks needed for dev-time and register them to the Hooks instance
|
|
7
7
|
*/
|
|
@@ -26,8 +26,4 @@ export declare class AssemblerHooks {
|
|
|
26
26
|
* When the build process is completed
|
|
27
27
|
*/
|
|
28
28
|
onBuildCompleted(...args: Parameters<AssemblerHookHandler>): Promise<void>;
|
|
29
|
-
/**
|
|
30
|
-
* When a message is received from the HTTP server process
|
|
31
|
-
*/
|
|
32
|
-
onHttpServerMessage(...args: Parameters<HttpServerMessageHookHandler>): Promise<void>;
|
|
33
29
|
}
|
package/build/src/types.d.ts
CHANGED
|
@@ -98,7 +98,7 @@ export type DevServerOptions = {
|
|
|
98
98
|
/**
|
|
99
99
|
* Hooks to execute at different stages
|
|
100
100
|
*/
|
|
101
|
-
hooks?: Pick<NonNullable<RcFile['
|
|
101
|
+
hooks?: Pick<NonNullable<RcFile['hooks']>, 'onDevServerStarted' | 'onSourceFileChanged'>;
|
|
102
102
|
};
|
|
103
103
|
/**
|
|
104
104
|
* Options accepted by the test runner
|
|
@@ -180,7 +180,7 @@ export type BundlerOptions = {
|
|
|
180
180
|
/**
|
|
181
181
|
* Hooks to execute at different stages
|
|
182
182
|
*/
|
|
183
|
-
hooks?: Pick<NonNullable<RcFile['
|
|
183
|
+
hooks?: Pick<NonNullable<RcFile['hooks']>, 'onBuildCompleted' | 'onBuildStarting'>;
|
|
184
184
|
};
|
|
185
185
|
/**
|
|
186
186
|
* Entry to add a middleware to a given middleware stack
|
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": "7.
|
|
4
|
+
"version": "7.7.0",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20.6.0"
|
|
7
7
|
},
|
|
@@ -34,18 +34,18 @@
|
|
|
34
34
|
"quick:test": "cross-env NODE_DEBUG=adonisjs:assembler node --enable-source-maps --loader=ts-node/esm bin/test.ts"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@adonisjs/application": "^8.
|
|
37
|
+
"@adonisjs/application": "^8.3.1",
|
|
38
38
|
"@adonisjs/eslint-config": "^1.3.0",
|
|
39
39
|
"@adonisjs/prettier-config": "^1.3.0",
|
|
40
40
|
"@adonisjs/tsconfig": "^1.3.0",
|
|
41
|
-
"@commitlint/cli": "^19.
|
|
41
|
+
"@commitlint/cli": "^19.3.0",
|
|
42
42
|
"@commitlint/config-conventional": "^19.2.2",
|
|
43
43
|
"@japa/assert": "^3.0.0",
|
|
44
44
|
"@japa/file-system": "^2.3.0",
|
|
45
|
-
"@japa/runner": "^3.1.
|
|
45
|
+
"@japa/runner": "^3.1.4",
|
|
46
46
|
"@japa/snapshot": "^2.0.5",
|
|
47
|
-
"@swc/core": "^1.
|
|
48
|
-
"@types/node": "^20.
|
|
47
|
+
"@swc/core": "^1.5.24",
|
|
48
|
+
"@types/node": "^20.13.0",
|
|
49
49
|
"@types/picomatch": "^2.3.3",
|
|
50
50
|
"@types/pretty-hrtime": "^1.0.3",
|
|
51
51
|
"c8": "^9.1.0",
|
|
@@ -53,19 +53,18 @@
|
|
|
53
53
|
"del-cli": "^5.1.0",
|
|
54
54
|
"eslint": "^8.57.0",
|
|
55
55
|
"github-label-sync": "^2.3.1",
|
|
56
|
-
"hot-hook": "^0.2.
|
|
56
|
+
"hot-hook": "^0.2.6",
|
|
57
57
|
"husky": "^9.0.11",
|
|
58
|
-
"np": "^10.0.3",
|
|
59
58
|
"p-event": "^6.0.1",
|
|
60
|
-
"prettier": "^3.
|
|
61
|
-
"release-it": "^17.
|
|
59
|
+
"prettier": "^3.3.0",
|
|
60
|
+
"release-it": "^17.3.0",
|
|
62
61
|
"ts-node": "^10.9.2",
|
|
63
62
|
"tsup": "^8.0.2",
|
|
64
63
|
"typescript": "^5.4.5"
|
|
65
64
|
},
|
|
66
65
|
"dependencies": {
|
|
67
|
-
"@adonisjs/env": "^6.
|
|
68
|
-
"@antfu/install-pkg": "^0.3.
|
|
66
|
+
"@adonisjs/env": "^6.1.0",
|
|
67
|
+
"@antfu/install-pkg": "^0.3.3",
|
|
69
68
|
"@poppinss/chokidar-ts": "^4.1.4",
|
|
70
69
|
"@poppinss/cliui": "^6.4.1",
|
|
71
70
|
"@poppinss/hooks": "^7.2.3",
|