@adonisjs/assembler 7.8.1 → 8.0.0-next.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.
@@ -0,0 +1,149 @@
1
+ import { type BundlerHooks, type DevServerHooks, type TestRunnerHooks, type WatcherHooks } from './hooks.ts';
2
+ /**
3
+ * File inspected by the filesystem based upon the provided globs
4
+ * and the current file path
5
+ */
6
+ export type InspectedFile = {
7
+ fileType: 'script' | 'meta' | 'test';
8
+ reloadServer: boolean;
9
+ unixRelativePath: string;
10
+ unixAbsolutePath: string;
11
+ };
12
+ /**
13
+ * Subset of properties assembler needs from the "adonisrc.ts" file.
14
+ */
15
+ export type AssemblerRcFile = {
16
+ /**
17
+ * An array of metaFiles glob patterns to watch
18
+ */
19
+ metaFiles?: {
20
+ pattern: string;
21
+ reloadServer: boolean;
22
+ }[];
23
+ /**
24
+ * Hooks to execute at different stages.
25
+ */
26
+ hooks?: Partial<WatcherHooks & DevServerHooks & BundlerHooks & TestRunnerHooks>;
27
+ /**
28
+ * An array of suites for which to run tests
29
+ */
30
+ suites?: {
31
+ name: string;
32
+ files: string | string[];
33
+ }[];
34
+ };
35
+ /**
36
+ * Options needed to run a script file
37
+ */
38
+ export type RunScriptOptions = {
39
+ /**
40
+ * Script to run
41
+ */
42
+ script: string;
43
+ /**
44
+ * Arguments to pass to the script
45
+ */
46
+ scriptArgs: string[];
47
+ /**
48
+ * Arguments to pass to NodeJS CLI
49
+ */
50
+ nodeArgs: string[];
51
+ /**
52
+ * Standard input ouput stream options
53
+ */
54
+ stdio?: 'pipe' | 'inherit';
55
+ /**
56
+ * Environment variables to pass to the child process
57
+ */
58
+ env?: NodeJS.ProcessEnv;
59
+ /**
60
+ * Whether or not to reject the promise. Defaults
61
+ * false
62
+ */
63
+ reject?: boolean;
64
+ };
65
+ /**
66
+ * Options accepted when starting the dev server
67
+ */
68
+ export type DevServerOptions = {
69
+ /**
70
+ * If the dev server should use HMR.
71
+ *
72
+ * Default:true
73
+ */
74
+ hmr?: boolean;
75
+ /**
76
+ * Arguments to pass to the "bin/server.js" file
77
+ * executed a child process
78
+ */
79
+ scriptArgs: string[];
80
+ /**
81
+ * Arguments to pass to Node.js CLI when executing
82
+ * the "bin/server.js" file
83
+ */
84
+ nodeArgs: string[];
85
+ /**
86
+ * Clear screen after every file change
87
+ */
88
+ clearScreen?: boolean;
89
+ /**
90
+ * Environment variables to share with the "bin/server.js"
91
+ * file.
92
+ */
93
+ env?: NodeJS.ProcessEnv;
94
+ } & AssemblerRcFile;
95
+ /**
96
+ * Options accepted by the test runner
97
+ */
98
+ export type TestRunnerOptions = {
99
+ /**
100
+ * Arguments to pass to the "bin/server.js" file
101
+ * executed a child process
102
+ */
103
+ scriptArgs: string[];
104
+ /**
105
+ * Arguments to pass to Node.js CLI when executing
106
+ * the "bin/server.js" file
107
+ */
108
+ nodeArgs: string[];
109
+ /**
110
+ * Clear screen after every file change
111
+ */
112
+ clearScreen?: boolean;
113
+ /**
114
+ * Environment variables to share with the "bin/server.js"
115
+ * file.
116
+ */
117
+ env?: NodeJS.ProcessEnv;
118
+ /**
119
+ * Set the tests runner reporter via the CLI flag
120
+ */
121
+ reporters?: string[];
122
+ /**
123
+ * Set the tests global timeout via the CLI flag
124
+ */
125
+ timeout?: number;
126
+ /**
127
+ * Define retries via the CLI flag
128
+ */
129
+ retries?: number;
130
+ /**
131
+ * Run only failed tests
132
+ */
133
+ failed?: boolean;
134
+ /**
135
+ * Filter arguments are provided as a key-value
136
+ * pair, so that we can mutate them (if needed)
137
+ */
138
+ filters: Partial<{
139
+ tests: string[];
140
+ suites: string[];
141
+ groups: string[];
142
+ files: string[];
143
+ tags: string[];
144
+ }>;
145
+ } & AssemblerRcFile;
146
+ /**
147
+ * Options accepted by the project bundler
148
+ */
149
+ export type BundlerOptions = AssemblerRcFile;
@@ -0,0 +1,65 @@
1
+ import { type Instructions } from '@poppinss/cliui';
2
+ import { type AsyncOrSync, type LazyImport } from '@poppinss/utils/types';
3
+ import { type Bundler } from '../bundler.ts';
4
+ import { type DevServer } from '../dev_server.ts';
5
+ import { type TestRunner } from '../test_runner.ts';
6
+ /**
7
+ * Hooks executed by the file watcher.
8
+ *
9
+ * - In HMR mode, assembler will rely on hot-hook to notify about the filesystem changes.
10
+ * - Otherwise, the inbuilt watcher of the DevServer or the TestsRunner will notify.
11
+ */
12
+ export type WatcherHooks = {
13
+ /**
14
+ * The hook is executed after a file has been changed in the watch mode.
15
+ */
16
+ fileChanged: LazyImport<(filePath: string, hotReplaced: boolean, server: DevServer | TestRunner) => AsyncOrSync<void>>[];
17
+ /**
18
+ * The hook is executed after a file has been added.
19
+ */
20
+ fileAdded: LazyImport<(filePath: string, server: DevServer | TestRunner) => AsyncOrSync<void>>[];
21
+ /**
22
+ * The hook is executed after a file has been removed.
23
+ */
24
+ fileRemoved: LazyImport<(filePath: string, server: DevServer | TestRunner) => AsyncOrSync<void>>[];
25
+ };
26
+ /**
27
+ * Hooks executed when running the dev server.
28
+ */
29
+ export type DevServerHooks = {
30
+ /**
31
+ * The hook is executed before the child process for the dev server
32
+ * is started.
33
+ */
34
+ devServerStarting: LazyImport<(server: DevServer) => AsyncOrSync<void>>[];
35
+ /**
36
+ * The hook is executed after the child process has been started.
37
+ */
38
+ devServerStarted: LazyImport<(server: DevServer, uiInstructions: Instructions) => AsyncOrSync<void>>[];
39
+ };
40
+ /**
41
+ * Hooks executed when the production build is created.
42
+ */
43
+ export type BundlerHooks = {
44
+ /**
45
+ * The hook is executed before we begin creating the production build
46
+ */
47
+ buildStarting: LazyImport<(server: Bundler) => AsyncOrSync<void>>[];
48
+ /**
49
+ * The hook is executed after the production build has been created
50
+ */
51
+ buildFinished: LazyImport<(server: Bundler, uiInstructions: Instructions) => AsyncOrSync<void>>[];
52
+ };
53
+ /**
54
+ * Hooks executed when running the tests
55
+ */
56
+ export type TestRunnerHooks = {
57
+ /**
58
+ * The hook is executed before we begin executing the tests
59
+ */
60
+ testsStarting: LazyImport<(server: TestRunner) => AsyncOrSync<void>>[];
61
+ /**
62
+ * The hook is executed after the tests have been executed
63
+ */
64
+ testsFinished: LazyImport<(server: TestRunner) => AsyncOrSync<void>>[];
65
+ };
@@ -0,0 +1,3 @@
1
+ export * from './common.ts';
2
+ export * from './hooks.ts';
3
+ export * from './code_transformer.ts';
File without changes
@@ -1,15 +1,18 @@
1
+ import Hooks from '@poppinss/hooks';
1
2
  import type tsStatic from 'typescript';
2
- import { Watcher } from '@poppinss/chokidar-ts';
3
- import type { RunOptions, WatchOptions } from './types.js';
3
+ import { type ChokidarOptions } from 'chokidar';
4
+ import { type UnWrapLazyImport } from '@poppinss/utils/types';
5
+ import type { RunScriptOptions } from './types/common.ts';
6
+ import { type WatcherHooks, type BundlerHooks, type DevServerHooks, type TestRunnerHooks } from './types/hooks.ts';
4
7
  /**
5
8
  * Parses tsconfig.json and prints errors using typescript compiler
6
9
  * host
7
10
  */
8
- export declare function parseConfig(cwd: string | URL, ts: typeof tsStatic): tsStatic.ParsedCommandLine | undefined;
11
+ export declare function parseConfig(cwd: URL | string, ts: typeof tsStatic): tsStatic.ParsedCommandLine | undefined;
9
12
  /**
10
13
  * Runs a Node.js script as a child process and inherits the stdio streams
11
14
  */
12
- export declare function runNode(cwd: string | URL, options: RunOptions): import("execa").ResultPromise<{
15
+ export declare function runNode(cwd: string | URL, options: RunScriptOptions): import("execa").ResultPromise<{
13
16
  nodeOptions: string[];
14
17
  preferLocal: true;
15
18
  windowsHide: false;
@@ -26,7 +29,7 @@ export declare function runNode(cwd: string | URL, options: RunOptions): import(
26
29
  /**
27
30
  * Runs a script as a child process and inherits the stdio streams
28
31
  */
29
- export declare function run(cwd: string | URL, options: Omit<RunOptions, 'nodeArgs'>): import("execa").ResultPromise<{
32
+ export declare function run(cwd: string | URL, options: Omit<RunScriptOptions, 'nodeArgs'>): import("execa").ResultPromise<{
30
33
  preferLocal: true;
31
34
  windowsHide: false;
32
35
  localDir: string | URL;
@@ -41,12 +44,9 @@ export declare function run(cwd: string | URL, options: Omit<RunOptions, 'nodeAr
41
44
  /**
42
45
  * Watches the file system using tsconfig file
43
46
  */
44
- export declare function watch(cwd: string | URL, ts: typeof tsStatic, options: WatchOptions): {
45
- watcher: Watcher;
46
- chokidar: import("chokidar").FSWatcher;
47
- } | undefined;
47
+ export declare function watch(options: ChokidarOptions): import("chokidar").FSWatcher;
48
48
  /**
49
- * Check if file is an .env file
49
+ * Check if file is a .env file
50
50
  */
51
51
  export declare function isDotEnvFile(filePath: string): boolean;
52
52
  /**
@@ -67,3 +67,21 @@ export declare function getPort(cwd: URL): Promise<number>;
67
67
  * patterns
68
68
  */
69
69
  export declare function copyFiles(files: string[], cwd: string, outDir: string): Promise<void[]>;
70
+ /**
71
+ * Memoize a function using an LRU cache. The function must accept
72
+ * only one argument as a string value.
73
+ */
74
+ export declare function memoize<Result>(fn: (input: string) => any, maxKeys?: number): (input: string) => Result;
75
+ /**
76
+ * Imports a selected set of lazy hooks and creates an instance of the
77
+ * Hooks class
78
+ */
79
+ type AllHooks = WatcherHooks & DevServerHooks & BundlerHooks & TestRunnerHooks;
80
+ export declare function loadHooks<K extends keyof AllHooks>(rcFileHooks: Partial<AllHooks> | undefined, names: K[]): Promise<Hooks<{ [P in K]: [Parameters<UnWrapLazyImport<AllHooks[K][number]>>, Parameters<UnWrapLazyImport<AllHooks[K][number]>>]; }>>;
81
+ /**
82
+ * Wraps a function inside another function that throttles the concurrent
83
+ * executions of a function. If the function is called too quickly, then
84
+ * it may result in two invocations at max.
85
+ */
86
+ export declare function throttle<Args extends any[]>(fn: (...args: Args) => PromiseLike<any>, name?: string): (...args: Args) => Promise<void>;
87
+ export {};
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.8.1",
4
+ "version": "8.0.0-next.0",
5
5
  "engines": {
6
- "node": ">=20.6.0"
6
+ "node": ">=24.0.0"
7
7
  },
8
8
  "main": "build/index.js",
9
9
  "type": "module",
@@ -15,7 +15,7 @@
15
15
  "exports": {
16
16
  ".": "./build/index.js",
17
17
  "./code_transformer": "./build/src/code_transformer/main.js",
18
- "./types": "./build/src/types.js"
18
+ "./types": "./build/src/types/main.js"
19
19
  },
20
20
  "scripts": {
21
21
  "pretest": "npm run lint",
@@ -30,54 +30,47 @@
30
30
  "release": "release-it",
31
31
  "version": "npm run build",
32
32
  "prepublishOnly": "npm run build",
33
- "quick:test": "cross-env NODE_DEBUG=adonisjs:assembler node --enable-source-maps --import=ts-node-maintained/register/esm bin/test.ts",
34
- "sync-labels": "github-label-sync --labels .github/labels.json adonisjs/assembler"
33
+ "quick:test": "node --enable-source-maps --import=@poppinss/ts-exec bin/test.ts"
35
34
  },
36
35
  "devDependencies": {
37
- "@adonisjs/application": "^8.3.1",
38
- "@adonisjs/eslint-config": "^2.0.0-beta.6",
39
- "@adonisjs/prettier-config": "^1.4.0",
40
- "@adonisjs/tsconfig": "^1.4.0",
41
- "@japa/assert": "^3.0.0",
42
- "@japa/file-system": "^2.3.0",
43
- "@japa/runner": "^3.1.4",
44
- "@japa/snapshot": "^2.0.5",
45
- "@release-it/conventional-changelog": "^8.0.1",
46
- "@swc/core": "^1.7.22",
47
- "@types/node": "^22.5.1",
48
- "@types/picomatch": "^3.0.1",
36
+ "@adonisjs/eslint-config": "^3.0.0-next.0",
37
+ "@adonisjs/prettier-config": "^1.4.5",
38
+ "@adonisjs/tsconfig": "^2.0.0-next.0",
39
+ "@japa/assert": "^4.0.1",
40
+ "@japa/file-system": "^2.3.2",
41
+ "@japa/runner": "^4.2.0",
42
+ "@japa/snapshot": "^2.0.8",
43
+ "@poppinss/ts-exec": "^1.2.1",
44
+ "@release-it/conventional-changelog": "^10.0.1",
45
+ "@types/node": "^22.15.29",
46
+ "@types/picomatch": "^4.0.0",
49
47
  "@types/pretty-hrtime": "^1.0.3",
50
- "c8": "^10.1.2",
51
- "cross-env": "^7.0.3",
52
- "del-cli": "^5.1.0",
53
- "eslint": "^9.9.1",
54
- "github-label-sync": "^2.3.1",
55
- "hot-hook": "^0.2.6",
56
- "husky": "^9.1.5",
48
+ "c8": "^10.1.3",
49
+ "del-cli": "^6.0.0",
50
+ "eslint": "^9.28.0",
51
+ "hot-hook": "^0.4.1-next.0",
57
52
  "p-event": "^6.0.1",
58
- "prettier": "^3.3.3",
59
- "release-it": "^17.6.0",
60
- "ts-node-maintained": "^10.9.4",
61
- "tsup": "^8.2.4",
62
- "typescript": "^5.5.4"
53
+ "prettier": "^3.5.3",
54
+ "release-it": "^19.0.3",
55
+ "tsup": "^8.5.0",
56
+ "typescript": "^5.8.3"
63
57
  },
64
58
  "dependencies": {
65
- "@adonisjs/env": "^6.1.0",
66
- "@antfu/install-pkg": "^0.4.1",
67
- "@poppinss/chokidar-ts": "^4.1.4",
68
- "@poppinss/cliui": "^6.4.1",
69
- "@poppinss/hooks": "^7.2.3",
70
- "@poppinss/utils": "^6.7.3",
71
- "cpy": "^11.1.0",
72
- "dedent": "^1.5.3",
73
- "execa": "^9.3.1",
74
- "fast-glob": "^3.3.2",
59
+ "@adonisjs/env": "^6.2.0",
60
+ "@antfu/install-pkg": "^1.1.0",
61
+ "@poppinss/cliui": "^6.4.3",
62
+ "@poppinss/hooks": "^7.2.5",
63
+ "@poppinss/utils": "^7.0.0-next.1",
64
+ "chokidar": "^4.0.3",
65
+ "dedent": "^1.6.0",
66
+ "execa": "^9.6.0",
67
+ "fast-glob": "^3.3.3",
75
68
  "get-port": "^7.1.0",
76
69
  "junk": "^4.0.1",
77
70
  "picomatch": "^4.0.2",
78
71
  "pretty-hrtime": "^1.0.3",
79
- "slash": "^5.1.0",
80
- "ts-morph": "^23.0.0"
72
+ "tmp-cache": "^1.1.0",
73
+ "ts-morph": "^26.0.0"
81
74
  },
82
75
  "peerDependencies": {
83
76
  "typescript": "^4.0.0 || ^5.0.0"
@@ -103,14 +96,14 @@
103
96
  "tsup": {
104
97
  "entry": [
105
98
  "./index.ts",
106
- "./src/types.ts",
99
+ "./src/types/main.ts",
107
100
  "./src/code_transformer/main.ts"
108
101
  ],
109
102
  "outDir": "./build",
110
103
  "clean": true,
111
104
  "format": "esm",
112
105
  "dts": false,
113
- "sourcemap": true,
106
+ "sourcemap": false,
114
107
  "target": "esnext"
115
108
  },
116
109
  "release-it": {
@@ -148,9 +141,7 @@
148
141
  "bin/**",
149
142
  "tmp/**",
150
143
  "examples/**",
151
- "src/dev_server.ts",
152
- "src/test_runner.ts",
153
- "src/assets_dev_server.ts"
144
+ "src/test_runner.ts"
154
145
  ]
155
146
  },
156
147
  "prettier": "@adonisjs/prettier-config"
@@ -1 +0,0 @@
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 process.versions.tsNodeMaintained\n ? '--import=ts-node-maintained/register/esm'\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 reject: options.reject ?? false,\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 ResultPromise } 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?: ResultPromise\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 { ResultPromise } 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?: ResultPromise\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 ResultPromise } 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?: ResultPromise\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,QAAyB;AACnC,SAA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AA,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"]}
@@ -1,31 +0,0 @@
1
- import { type Logger } from '@poppinss/cliui';
2
- import type { AssetsBundlerOptions } from './types.js';
3
- /**
4
- * Exposes the API to start the development server for processing assets during
5
- * development.
6
- *
7
- * - Here we are running the assets dev server in a child process.
8
- * - Piping the output from the child process and reformatting it before writing it to
9
- * process streams.
10
- *
11
- * AssetsDevServer is agnostic and can run any assets dev server. Be it Vite or Encore or
12
- * even Webpack directly.
13
- */
14
- export declare class AssetsDevServer {
15
- #private;
16
- constructor(cwd: URL, options?: AssetsBundlerOptions);
17
- /**
18
- * Set a custom CLI UI logger
19
- */
20
- setLogger(logger: Logger): this;
21
- /**
22
- * Starts the assets bundler server. The assets bundler server process is
23
- * considered as the secondary process and therefore we do not perform
24
- * any cleanup if it dies.
25
- */
26
- start(): void;
27
- /**
28
- * Stop the dev server
29
- */
30
- stop(): void;
31
- }