@adonisjs/assembler 6.1.3-12 → 6.1.3-14

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.
@@ -7,12 +7,11 @@
7
7
  * file that was distributed with this source code.
8
8
  */
9
9
  import slash from 'slash';
10
- import copyfiles from 'cpy';
11
10
  import fs from 'node:fs/promises';
12
11
  import { fileURLToPath } from 'node:url';
13
12
  import { join, relative } from 'node:path';
14
13
  import { cliui } from '@poppinss/cliui';
15
- import { run, parseConfig } from './helpers.js';
14
+ import { run, parseConfig, copyFiles } from './helpers.js';
16
15
  /**
17
16
  * Instance of CLIUI
18
17
  */
@@ -89,7 +88,7 @@ export class Bundler {
89
88
  */
90
89
  async #copyFiles(files, outDir) {
91
90
  try {
92
- await copyfiles(files, outDir, { parents: true, cwd: this.#cwdPath });
91
+ await copyFiles(files, this.#cwdPath, outDir);
93
92
  }
94
93
  catch (error) {
95
94
  if (!error.message.includes("the file doesn't exist")) {
@@ -0,0 +1,3 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ declare const _default: import("util").DebugLogger;
3
+ export default _default;
@@ -0,0 +1,10 @@
1
+ /*
2
+ * @adonisjs/assembler
3
+ *
4
+ * (c) AdonisJS
5
+ *
6
+ * For the full copyright and license information, please view the LICENSE
7
+ * file that was distributed with this source code.
8
+ */
9
+ import { debuglog } from 'node:util';
10
+ export default debuglog('adonisjs:assembler');
@@ -43,3 +43,8 @@ export declare function isRcFile(filePath: string): boolean;
43
43
  * stops after first find.
44
44
  */
45
45
  export declare function getPort(cwd: URL): Promise<number>;
46
+ /**
47
+ * Helper function to copy files from relative paths or glob
48
+ * patterns
49
+ */
50
+ export declare function copyFiles(files: string[], cwd: string, outDir: string): Promise<string[]>;
@@ -6,11 +6,16 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
+ import cpy from 'cpy';
10
+ import { isNotJunk } from 'junk';
11
+ import fastGlob from 'fast-glob';
9
12
  import getRandomPort from 'get-port';
10
13
  import { fileURLToPath } from 'node:url';
11
14
  import { execaNode, execa } from 'execa';
15
+ import { isAbsolute, relative } from 'node:path';
12
16
  import { EnvLoader, EnvParser } from '@adonisjs/env';
13
17
  import { ConfigParser, Watcher } from '@poppinss/chokidar-ts';
18
+ import debug from './debug.js';
14
19
  /**
15
20
  * Default set of args to pass in order to run TypeScript
16
21
  * source. Used by "run" and "runNode" scripts
@@ -22,6 +27,8 @@ const DEFAULT_NODE_ARGS = [
22
27
  '--no-warnings',
23
28
  // Enable expiremental meta resolve for cases where someone uses magic import string
24
29
  '--experimental-import-meta-resolve',
30
+ // Enable source maps, since TSNode source maps are broken
31
+ '--enable-source-maps',
25
32
  ];
26
33
  /**
27
34
  * Parses tsconfig.json and prints errors using typescript compiler
@@ -140,3 +147,37 @@ export async function getPort(cwd) {
140
147
  */
141
148
  return getRandomPort({ port: 3333 });
142
149
  }
150
+ /**
151
+ * Helper function to copy files from relative paths or glob
152
+ * patterns
153
+ */
154
+ export async function copyFiles(files, cwd, outDir) {
155
+ /**
156
+ * Looping over files and create a new collection with paths
157
+ * and glob patterns
158
+ */
159
+ const { paths, patterns } = files.reduce((result, file) => {
160
+ if (fastGlob.isDynamicPattern(file)) {
161
+ result.patterns.push(file);
162
+ }
163
+ else {
164
+ result.paths.push(file);
165
+ }
166
+ return result;
167
+ }, { patterns: [], paths: [] });
168
+ debug('copyFiles inputs: %O, paths: %O, patterns: %O', files, paths, patterns);
169
+ /**
170
+ * Getting list of relative paths from glob patterns
171
+ */
172
+ const filePaths = paths.concat(await fastGlob(patterns, { cwd }));
173
+ /**
174
+ * Computing relative destination. This is because, cpy is buggy when
175
+ * outDir is an absolute path.
176
+ */
177
+ const destination = isAbsolute(outDir) ? relative(cwd, outDir) : outDir;
178
+ debug('copying files %O to destination "%s"', filePaths, destination);
179
+ return cpy(filePaths.filter(isNotJunk), destination, {
180
+ cwd: cwd,
181
+ flat: false,
182
+ });
183
+ }
package/package.json CHANGED
@@ -1,7 +1,10 @@
1
1
  {
2
2
  "name": "@adonisjs/assembler",
3
- "version": "6.1.3-12",
4
3
  "description": "Provides utilities to run AdonisJS development server and build project for production",
4
+ "version": "6.1.3-14",
5
+ "engines": {
6
+ "node": ">=18.16.0"
7
+ },
5
8
  "main": "build/index.js",
6
9
  "type": "module",
7
10
  "files": [
@@ -13,9 +16,6 @@
13
16
  ".": "./build/index.js",
14
17
  "./types": "./build/src/types.js"
15
18
  },
16
- "engines": {
17
- "node": ">=18.16.0"
18
- },
19
19
  "scripts": {
20
20
  "pretest": "npm run lint",
21
21
  "test": "cross-env NODE_DEBUG=chokidar:ts c8 npm run quick:test",
@@ -31,23 +31,16 @@
31
31
  "prepublishOnly": "npm run build",
32
32
  "quick:test": "node --loader=ts-node/esm bin/test.ts"
33
33
  },
34
- "keywords": [
35
- "adonisjs",
36
- "build",
37
- "ts"
38
- ],
39
- "author": "virk,adonisjs",
40
- "license": "MIT",
41
34
  "devDependencies": {
42
- "@adonisjs/eslint-config": "^1.1.7",
43
- "@adonisjs/prettier-config": "^1.1.7",
44
- "@adonisjs/tsconfig": "^1.1.7",
35
+ "@adonisjs/eslint-config": "^1.1.8",
36
+ "@adonisjs/prettier-config": "^1.1.8",
37
+ "@adonisjs/tsconfig": "^1.1.8",
45
38
  "@commitlint/cli": "^17.6.6",
46
39
  "@commitlint/config-conventional": "^17.6.6",
47
40
  "@japa/assert": "^2.0.0-1",
48
41
  "@japa/file-system": "^2.0.0-1",
49
- "@japa/runner": "^3.0.0-3",
50
- "@swc/core": "^1.3.67",
42
+ "@japa/runner": "^3.0.0-6",
43
+ "@swc/core": "^1.3.68",
51
44
  "@types/node": "^20.4.1",
52
45
  "@types/picomatch": "^2.3.0",
53
46
  "c8": "^8.0.0",
@@ -58,7 +51,7 @@
58
51
  "husky": "^8.0.3",
59
52
  "np": "^8.0.4",
60
53
  "p-event": "^6.0.0",
61
- "prettier": "^2.8.8",
54
+ "prettier": "^3.0.0",
62
55
  "ts-node": "^10.9.1",
63
56
  "typescript": "^5.1.6"
64
57
  },
@@ -66,15 +59,20 @@
66
59
  "@adonisjs/env": "^4.2.0-3",
67
60
  "@poppinss/chokidar-ts": "^4.1.0-4",
68
61
  "@poppinss/cliui": "^6.1.1-3",
69
- "cpy": "^8.1.2",
70
- "execa": "^7.0.0",
62
+ "cpy": "^10.1.0",
63
+ "execa": "^7.1.1",
64
+ "fast-glob": "^3.3.0",
71
65
  "get-port": "^7.0.0",
66
+ "junk": "^4.0.1",
72
67
  "picomatch": "^2.3.1",
73
68
  "slash": "^5.1.0"
74
69
  },
75
70
  "peerDependencies": {
76
71
  "typescript": "^4.0.0 || ^5.0.0"
77
72
  },
73
+ "author": "virk,adonisjs",
74
+ "license": "MIT",
75
+ "homepage": "https://github.com/adonisjs/assembler#readme",
78
76
  "repository": {
79
77
  "type": "git",
80
78
  "url": "git+ssh://git@github.com/adonisjs/assembler.git"
@@ -82,7 +80,15 @@
82
80
  "bugs": {
83
81
  "url": "https://github.com/adonisjs/assembler/issues"
84
82
  },
85
- "homepage": "https://github.com/adonisjs/assembler#readme",
83
+ "keywords": [
84
+ "adonisjs",
85
+ "build",
86
+ "ts"
87
+ ],
88
+ "eslintConfig": {
89
+ "extends": "@adonisjs/eslint-config/package"
90
+ },
91
+ "prettier": "@adonisjs/prettier-config",
86
92
  "commitlint": {
87
93
  "extends": [
88
94
  "@commitlint/config-conventional"
@@ -111,9 +117,5 @@
111
117
  "src/test_runner.ts",
112
118
  "src/assets_dev_server.ts"
113
119
  ]
114
- },
115
- "eslintConfig": {
116
- "extends": "@adonisjs/eslint-config/package"
117
- },
118
- "prettier": "@adonisjs/prettier-config"
120
+ }
119
121
  }