@adonisjs/assembler 7.2.3 → 7.3.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 +1 -1
- package/build/index.js.map +1 -1
- package/package.json +41 -34
package/build/index.js
CHANGED
|
@@ -172,7 +172,7 @@ async function getPort(cwd) {
|
|
|
172
172
|
}
|
|
173
173
|
const files = await new EnvLoader(cwd).load();
|
|
174
174
|
for (let file of files) {
|
|
175
|
-
const envVariables = new EnvParser(file.contents).parse();
|
|
175
|
+
const envVariables = await new EnvParser(file.contents).parse();
|
|
176
176
|
if (envVariables.PORT) {
|
|
177
177
|
return getRandomPort({ port: Number(envVariables.PORT) });
|
|
178
178
|
}
|
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 AssemblerHookNode,\n SourceFileChangedHookHandler,\n AssemblerHookHandler,\n RcFile,\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 onDevServerStarted: [Parameters<AssemblerHookHandler>, []]\n onSourceFileChanged: [Parameters<SourceFileChangedHookHandler>, []]\n onBuildStarting: [Parameters<AssemblerHookHandler>, []]\n onBuildCompleted: [Parameters<AssemblerHookHandler>, []]\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 ])\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 = 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 type tsStatic from 'typescript'\nimport prettyHrtime from 'pretty-hrtime'\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\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 * 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 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 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 .add(\n `File system watcher: ${this.#colors.cyan(\n `${this.#isWatching ? 'enabled' : 'disabled'}`\n )}`\n )\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 #handleSourceFileChange(action: string, port: string, relativePath: string) {\n void 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,SAAS,IAAI,MAKV;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,EACjB;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,yBAAyB;AAC7B,UAAM,QAAQ,IAAI;AAAA,MAChB,IAAI,KAAK,SAAS,sBAAsB,CAAC,GAAG;AAAA,QAAI,OAAO,SACrD,KAAK,OAAO,IAAI,sBAAsB,MAAM,KAAK,iBAAiB,IAAI,CAAC;AAAA,MACzE;AAAA,MACA,IAAI,KAAK,SAAS,uBAAuB,CAAC,GAAG;AAAA,QAAI,OAAO,SACtD,KAAK,OAAO,IAAI,uBAAuB,MAAM,KAAK,iBAAiB,IAAI,CAAC;AAAA,MAC1E;AAAA,IACF,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,qBAAqB;AACzB,UAAM,QAAQ,IAAI;AAAA,MAChB,IAAI,KAAK,SAAS,mBAAmB,CAAC,GAAG;AAAA,QAAI,OAAO,SAClD,KAAK,OAAO,IAAI,mBAAmB,MAAM,KAAK,iBAAiB,IAAI,CAAC;AAAA,MAC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AAiB,MAAM;AACvC,WAAK,QAAQ,KAAK,qCAAqC;AAAA,IACzD,CAAC;AAKD,WAAO,SAAS,GAAG,SAAS,CAAC,UAAU;AACrC,WAAK,QAAQ,QAAQ,6BAA6B;AAClD,WAAK,QAAQ,MAAM,KAAK;AACxB,WAAK,WAAW,KAAK;AACrB,aAAO,SAAS,MAAM;AAAA,IACxB,CAAC;AAKD,WAAO,QAAQ;AAAA,MAAG;AAAA,MAAc,CAAC,EAAE,aAAa,MAC9C,KAAK,wBAAwB,OAAO,MAAM,YAAY;AAAA,IACxD;AACA,WAAO,QAAQ;AAAA,MAAG;AAAA,MAAiB,CAAC,EAAE,aAAa,MACjD,KAAK,wBAAwB,UAAU,MAAM,YAAY;AAAA,IAC3D;AACA,WAAO,QAAQ;AAAA,MAAG;AAAA,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","cliui","cliui","ui","cliui","ui","cliui","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' | '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 AssemblerHookNode,\n SourceFileChangedHookHandler,\n AssemblerHookHandler,\n RcFile,\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 onDevServerStarted: [Parameters<AssemblerHookHandler>, []]\n onSourceFileChanged: [Parameters<SourceFileChangedHookHandler>, []]\n onBuildStarting: [Parameters<AssemblerHookHandler>, []]\n onBuildCompleted: [Parameters<AssemblerHookHandler>, []]\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 ])\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 type tsStatic from 'typescript'\nimport prettyHrtime from 'pretty-hrtime'\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\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 * 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 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 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 .add(\n `File system watcher: ${this.#colors.cyan(\n `${this.#isWatching ? 'enabled' : 'disabled'}`\n )}`\n )\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 #handleSourceFileChange(action: string, port: string, relativePath: string) {\n void 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,SAAS,IAAI,MAKV;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,EACjB;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,yBAAyB;AAC7B,UAAM,QAAQ,IAAI;AAA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O,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","cliui","cliui","ui","cliui","ui","cliui","picomatch","cliui","ui","cliui","picomatch"]}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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.3.0",
|
|
5
5
|
"engines": {
|
|
6
|
-
"node": ">=
|
|
6
|
+
"node": ">=20.6.0"
|
|
7
7
|
},
|
|
8
8
|
"main": "build/index.js",
|
|
9
9
|
"type": "module",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"precompile": "npm run lint && npm run clean",
|
|
27
27
|
"compile": "tsup-node && tsc --emitDeclarationOnly --declaration",
|
|
28
28
|
"build": "npm run compile",
|
|
29
|
-
"release": "
|
|
29
|
+
"release": "npx release-it",
|
|
30
30
|
"version": "npm run build",
|
|
31
31
|
"sync-labels": "github-label-sync --labels .github/labels.json adonisjs/assembler",
|
|
32
32
|
"format": "prettier --write .",
|
|
@@ -35,49 +35,50 @@
|
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@adonisjs/application": "8.1.0",
|
|
38
|
-
"@adonisjs/eslint-config": "^1.
|
|
39
|
-
"@adonisjs/prettier-config": "^1.
|
|
40
|
-
"@adonisjs/tsconfig": "^1.
|
|
41
|
-
"@commitlint/cli": "^
|
|
42
|
-
"@commitlint/config-conventional": "^
|
|
38
|
+
"@adonisjs/eslint-config": "^1.3.0",
|
|
39
|
+
"@adonisjs/prettier-config": "^1.3.0",
|
|
40
|
+
"@adonisjs/tsconfig": "^1.3.0",
|
|
41
|
+
"@commitlint/cli": "^19.2.1",
|
|
42
|
+
"@commitlint/config-conventional": "^19.1.0",
|
|
43
43
|
"@japa/assert": "^2.1.0",
|
|
44
44
|
"@japa/file-system": "^2.2.0",
|
|
45
|
-
"@japa/runner": "^3.1.
|
|
45
|
+
"@japa/runner": "^3.1.2",
|
|
46
46
|
"@japa/snapshot": "^2.0.4",
|
|
47
|
-
"@swc/core": "^1.
|
|
48
|
-
"@types/node": "^20.
|
|
47
|
+
"@swc/core": "^1.4.11",
|
|
48
|
+
"@types/node": "^20.12.2",
|
|
49
49
|
"@types/picomatch": "^2.3.3",
|
|
50
50
|
"@types/pretty-hrtime": "^1.0.3",
|
|
51
51
|
"c8": "^9.1.0",
|
|
52
52
|
"cross-env": "^7.0.3",
|
|
53
|
-
"del-cli": "^5.
|
|
54
|
-
"eslint": "^8.
|
|
53
|
+
"del-cli": "^5.1.0",
|
|
54
|
+
"eslint": "^8.57.0",
|
|
55
55
|
"github-label-sync": "^2.3.1",
|
|
56
|
-
"husky": "^
|
|
57
|
-
"np": "^
|
|
58
|
-
"p-event": "^6.0.
|
|
59
|
-
"prettier": "^3.2.
|
|
56
|
+
"husky": "^9.0.11",
|
|
57
|
+
"np": "^10.0.2",
|
|
58
|
+
"p-event": "^6.0.1",
|
|
59
|
+
"prettier": "^3.2.5",
|
|
60
|
+
"release-it": "^17.1.1",
|
|
60
61
|
"ts-node": "^10.9.2",
|
|
61
|
-
"tsup": "^8.0.
|
|
62
|
-
"typescript": "^5.
|
|
62
|
+
"tsup": "^8.0.2",
|
|
63
|
+
"typescript": "^5.4.3"
|
|
63
64
|
},
|
|
64
65
|
"dependencies": {
|
|
65
|
-
"@adonisjs/env": "^
|
|
66
|
-
"@antfu/install-pkg": "^0.3.
|
|
67
|
-
"@poppinss/chokidar-ts": "^4.1.
|
|
68
|
-
"@poppinss/cliui": "^6.
|
|
69
|
-
"@poppinss/hooks": "^7.2.
|
|
70
|
-
"@poppinss/utils": "^6.7.
|
|
71
|
-
"cpy": "^11.0.
|
|
66
|
+
"@adonisjs/env": "^6.0.0",
|
|
67
|
+
"@antfu/install-pkg": "^0.3.2",
|
|
68
|
+
"@poppinss/chokidar-ts": "^4.1.4",
|
|
69
|
+
"@poppinss/cliui": "^6.4.1",
|
|
70
|
+
"@poppinss/hooks": "^7.2.3",
|
|
71
|
+
"@poppinss/utils": "^6.7.3",
|
|
72
|
+
"cpy": "^11.0.1",
|
|
72
73
|
"dedent": "^1.5.1",
|
|
73
74
|
"execa": "^8.0.1",
|
|
74
75
|
"fast-glob": "^3.3.2",
|
|
75
|
-
"get-port": "^7.
|
|
76
|
+
"get-port": "^7.1.0",
|
|
76
77
|
"junk": "^4.0.1",
|
|
77
|
-
"picomatch": "^
|
|
78
|
+
"picomatch": "^4.0.2",
|
|
78
79
|
"pretty-hrtime": "^1.0.3",
|
|
79
80
|
"slash": "^5.1.0",
|
|
80
|
-
"ts-morph": "^
|
|
81
|
+
"ts-morph": "^22.0.0"
|
|
81
82
|
},
|
|
82
83
|
"peerDependencies": {
|
|
83
84
|
"typescript": "^4.0.0 || ^5.0.0"
|
|
@@ -110,11 +111,17 @@
|
|
|
110
111
|
"access": "public",
|
|
111
112
|
"tag": "latest"
|
|
112
113
|
},
|
|
113
|
-
"
|
|
114
|
-
"
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
114
|
+
"release-it": {
|
|
115
|
+
"git": {
|
|
116
|
+
"commitMessage": "chore(release): ${version}",
|
|
117
|
+
"tagAnnotation": "v${version}",
|
|
118
|
+
"tagName": "v${version}"
|
|
119
|
+
},
|
|
120
|
+
"github": {
|
|
121
|
+
"release": true,
|
|
122
|
+
"releaseName": "v${version}",
|
|
123
|
+
"web": true
|
|
124
|
+
}
|
|
118
125
|
},
|
|
119
126
|
"c8": {
|
|
120
127
|
"reporter": [
|