@nx/js 21.4.0 → 21.4.1

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.
Files changed (30) hide show
  1. package/package.json +4 -4
  2. package/spec/src/plugins/typescript/util.spec.d.ts +2 -0
  3. package/spec/src/plugins/typescript/util.spec.d.ts.map +1 -0
  4. package/src/executors/node/node-with-esm-loader.js +1 -1
  5. package/src/executors/node/node.impl.js +1 -1
  6. package/src/executors/swc/schema.json +10 -0
  7. package/src/executors/tsc/lib/batch/build-task-info-per-tsconfig-map.js +1 -0
  8. package/src/executors/tsc/schema.json +10 -0
  9. package/src/executors/tsc/tsc.impl.d.ts.map +1 -1
  10. package/src/executors/tsc/tsc.impl.js +1 -0
  11. package/src/generators/typescript-sync/typescript-sync.d.ts.map +1 -1
  12. package/src/generators/typescript-sync/typescript-sync.js +36 -4
  13. package/src/plugins/typescript/plugin.d.ts.map +1 -1
  14. package/src/plugins/typescript/plugin.js +0 -1
  15. package/src/plugins/typescript/util.d.ts.map +1 -1
  16. package/src/plugins/typescript/util.js +121 -115
  17. package/src/utils/assets/assets.d.ts +1 -0
  18. package/src/utils/assets/assets.d.ts.map +1 -1
  19. package/src/utils/assets/copy-assets-handler.d.ts +2 -0
  20. package/src/utils/assets/copy-assets-handler.d.ts.map +1 -1
  21. package/src/utils/assets/copy-assets-handler.js +8 -2
  22. package/src/utils/assets/index.d.ts +1 -0
  23. package/src/utils/assets/index.d.ts.map +1 -1
  24. package/src/utils/assets/index.js +1 -0
  25. package/src/utils/package-manager-workspaces.d.ts.map +1 -1
  26. package/src/utils/package-manager-workspaces.js +12 -1
  27. package/src/utils/schema.d.ts +1 -0
  28. package/src/utils/versions.d.ts +1 -1
  29. package/src/utils/versions.js +1 -1
  30. package/spec/tsconfig.spec.tsbuildinfo +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/js",
3
- "version": "21.4.0",
3
+ "version": "21.4.1",
4
4
  "private": false,
5
5
  "description": "The JS plugin for Nx contains executors and generators that provide the best experience for developing JavaScript and TypeScript projects. ",
6
6
  "repository": {
@@ -39,8 +39,8 @@
39
39
  "@babel/preset-env": "^7.23.2",
40
40
  "@babel/preset-typescript": "^7.22.5",
41
41
  "@babel/runtime": "^7.22.6",
42
- "@nx/devkit": "21.4.0",
43
- "@nx/workspace": "21.4.0",
42
+ "@nx/devkit": "21.4.1",
43
+ "@nx/workspace": "21.4.1",
44
44
  "@zkochan/js-yaml": "0.0.7",
45
45
  "babel-plugin-const-enum": "^1.0.1",
46
46
  "babel-plugin-macros": "^3.1.0",
@@ -63,7 +63,7 @@
63
63
  "tslib": "^2.3.0"
64
64
  },
65
65
  "devDependencies": {
66
- "nx": "21.4.0"
66
+ "nx": "21.4.1"
67
67
  },
68
68
  "peerDependencies": {
69
69
  "verdaccio": "^6.0.5"
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=util.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.spec.d.ts","sourceRoot":"","sources":["../../../../../../../packages/js/src/plugins/typescript/util.spec.ts"],"names":[],"mappings":""}
@@ -6,7 +6,7 @@ const dynamicImportEsm = new Function('specifier', 'return import(specifier)');
6
6
  async function main() {
7
7
  try {
8
8
  // Register ESM loader for workspace path mappings
9
- register(path.join(__dirname, 'lib', 'esm-loader.js'), pathToFileURL(__filename));
9
+ register(pathToFileURL(path.join(__dirname, 'lib', 'esm-loader.js')).href, pathToFileURL(__filename));
10
10
  // Import and run the file
11
11
  const fileToRun = process.env.NX_FILE_TO_RUN;
12
12
  if (!fileToRun) {
@@ -114,7 +114,7 @@ async function* nodeExecutor(options, context) {
114
114
  const loaderFile = moduleFormat === 'esm'
115
115
  ? 'node-with-esm-loader'
116
116
  : 'node-with-require-overrides';
117
- task.childProcess = (0, child_process_1.fork)((0, devkit_1.joinPathFragments)(__dirname, loaderFile), options.args ?? [], {
117
+ task.childProcess = (0, child_process_1.fork)((0, path_1.join)(__dirname, loaderFile), options.args ?? [], {
118
118
  execArgv: getExecArgv(options),
119
119
  stdio: [0, 'pipe', 'pipe', 'ipc'],
120
120
  env: {
@@ -118,6 +118,11 @@
118
118
  "type": "boolean",
119
119
  "description": "Remove leading directory from output (e.g. src). See: https://swc.rs/docs/usage/cli#--strip-leading-paths",
120
120
  "default": false
121
+ },
122
+ "includeIgnoredAssetFiles": {
123
+ "type": "boolean",
124
+ "description": "Include files that are ignored by .gitignore and .nxignore when copying assets. WARNING: Ignored files are not automatically considered when calculating the task hash. To ensure Nx tracks these files for caching, add them to your target's inputs using 'dependentTasksOutputs' or 'runtime' configuration.",
125
+ "default": false
121
126
  }
122
127
  },
123
128
  "required": ["main", "outputPath", "tsConfig"],
@@ -145,6 +150,11 @@
145
150
  "output": {
146
151
  "type": "string",
147
152
  "description": "Absolute path within the output."
153
+ },
154
+ "includeIgnoredFiles": {
155
+ "type": "boolean",
156
+ "description": "Include files that are ignored by .gitignore and .nxignore for this specific asset pattern. WARNING: Ignored files are not automatically considered when calculating the task hash. To ensure Nx tracks these files for caching, add them to your target's inputs using 'dependentTasksOutputs' or 'runtime' configuration.",
157
+ "default": false
148
158
  }
149
159
  },
150
160
  "additionalProperties": false,
@@ -46,6 +46,7 @@ function createTaskInfo(taskName, taskOptions, context, tsConfig) {
46
46
  rootDir: context.root,
47
47
  outputDir: taskOptions.outputPath,
48
48
  assets: taskOptions.assets,
49
+ includeIgnoredFiles: taskOptions.includeIgnoredAssetFiles,
49
50
  });
50
51
  const { target: projectGraphNode, dependencies: buildableProjectNodeDependencies, } = (0, buildable_libs_utils_1.calculateProjectBuildableDependencies)(context.taskGraph, context.projectGraph, context.root, context.taskGraph.tasks[taskName].target.project, context.taskGraph.tasks[taskName].target.target, context.taskGraph.tasks[taskName].target.configuration);
51
52
  return {
@@ -111,6 +111,11 @@
111
111
  "type": "boolean",
112
112
  "description": "Generate package.json file in the output folder.",
113
113
  "default": true
114
+ },
115
+ "includeIgnoredAssetFiles": {
116
+ "type": "boolean",
117
+ "description": "Include files that are ignored by .gitignore and .nxignore when copying assets. WARNING: Ignored files are not automatically considered when calculating the task hash. To ensure Nx tracks these files for caching, add them to your target's inputs using 'dependentTasksOutputs' or 'runtime' configuration.",
118
+ "default": false
114
119
  }
115
120
  },
116
121
  "required": ["main", "outputPath", "tsConfig"],
@@ -138,6 +143,11 @@
138
143
  "output": {
139
144
  "type": "string",
140
145
  "description": "Absolute path within the output."
146
+ },
147
+ "includeIgnoredFiles": {
148
+ "type": "boolean",
149
+ "description": "Include files that are ignored by .gitignore and .nxignore for this specific asset pattern. WARNING: Ignored files are not automatically considered when calculating the task hash. To ensure Nx tracks these files for caching, add them to your target's inputs using 'dependentTasksOutputs' or 'runtime' configuration.",
150
+ "default": false
141
151
  }
142
152
  },
143
153
  "additionalProperties": false,
@@ -1 +1 @@
1
- {"version":3,"file":"tsc.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/executors/tsc/tsc.impl.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EAIhB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,oDAAoD,CAAC;AAavG,OAAO,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAOhF,wBAAgB,iCAAiC,CAC/C,sBAAsB,EAAE,MAAM,GAC7B,KAAK,GAAG,KAAK,CAYf;AAED,wBAAgB,kCAAkC,CAChD,iBAAiB,EAAE,yBAAyB,EAC5C,OAAO,EAAE,eAAe,GACvB,4BAA4B,CAa9B;AAED,wBAAuB,WAAW,CAChC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,eAAe,mHAuHzB;AAED,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"tsc.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/executors/tsc/tsc.impl.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EAIhB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,oDAAoD,CAAC;AAavG,OAAO,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAOhF,wBAAgB,iCAAiC,CAC/C,sBAAsB,EAAE,MAAM,GAC7B,KAAK,GAAG,KAAK,CAYf;AAED,wBAAgB,kCAAkC,CAChD,iBAAiB,EAAE,yBAAyB,EAC5C,OAAO,EAAE,eAAe,GACvB,4BAA4B,CAa9B;AAED,wBAAuB,WAAW,CAChC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,eAAe,mHAwHzB;AAED,eAAe,WAAW,CAAC"}
@@ -55,6 +55,7 @@ async function* tscExecutor(_options, context) {
55
55
  rootDir: context.root,
56
56
  outputDir: _options.outputPath,
57
57
  assets: _options.assets,
58
+ includeIgnoredFiles: _options.includeIgnoredAssetFiles,
58
59
  });
59
60
  const tsCompilationOptions = createTypeScriptCompilationOptions(options, context);
60
61
  const inlineProjectGraph = (0, inline_1.handleInliningBuild)(context, options, tsCompilationOptions.tsConfig);
@@ -1 +1 @@
1
- {"version":3,"file":"typescript-sync.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/generators/typescript-sync/typescript-sync.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAIpB,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,8BAA8B,CAAC;AAuCtC,wBAAsB,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAgO5E;AAED,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"typescript-sync.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/generators/typescript-sync/typescript-sync.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAIpB,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,8BAA8B,CAAC;AA2CtC,wBAAsB,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,mBAAmB,CAAC,CA2P5E;AAED,eAAe,aAAa,CAAC"}
@@ -65,12 +65,24 @@ async function syncGenerator(tree) {
65
65
  const changedFiles = new Map();
66
66
  if (tsconfigProjectNodeValues.length > 0) {
67
67
  const referencesSet = new Set();
68
+ const rootPathCounts = new Map();
68
69
  for (const ref of rootTsconfig.references ?? []) {
69
70
  // reference path is relative to the tsconfig file
70
71
  const resolvedRefPath = getTsConfigPathFromReferencePath(rootTsconfigPath, ref.path);
72
+ const normalizedPath = normalizeReferencePath(ref.path);
73
+ // Track duplicates
74
+ const currentCount = (rootPathCounts.get(normalizedPath) || 0) + 1;
75
+ rootPathCounts.set(normalizedPath, currentCount);
76
+ if (currentCount === 2) {
77
+ addChangedFile(changedFiles, rootTsconfigPath, resolvedRefPath, 'duplicates');
78
+ }
79
+ if (currentCount > 1) {
80
+ // Skip duplicate processing - only process first occurrence
81
+ continue;
82
+ }
71
83
  if (tsconfigExists(tree, tsconfigInfoCaches, resolvedRefPath)) {
72
84
  // we only keep the references that still exist
73
- referencesSet.add(normalizeReferencePath(ref.path));
85
+ referencesSet.add(normalizedPath);
74
86
  }
75
87
  else {
76
88
  addChangedFile(changedFiles, rootTsconfigPath, resolvedRefPath, 'stale');
@@ -139,9 +151,12 @@ async function syncGenerator(tree) {
139
151
  if (details.stale.size > 0) {
140
152
  outOfSyncDetails.push(` - Stale references: ${Array.from(details.stale).join(', ')}`);
141
153
  }
154
+ if (details.duplicates.size > 0) {
155
+ outOfSyncDetails.push(` - Duplicate references: ${Array.from(details.duplicates).join(', ')}`);
156
+ }
142
157
  }
143
158
  return {
144
- outOfSyncMessage: 'Some TypeScript configuration files are missing project references to the projects they depend on or contain stale project references.',
159
+ outOfSyncMessage: 'Some TypeScript configuration files are missing project references to the projects they depend on, contain stale project references, or have duplicate project references.',
145
160
  outOfSyncDetails,
146
161
  };
147
162
  }
@@ -175,9 +190,23 @@ function updateTsConfigReferences(tree, tsSysFromTree, tsconfigInfoCaches, tsCon
175
190
  const references = [];
176
191
  const originalReferencesSet = new Set();
177
192
  const newReferencesSet = new Set();
193
+ const pathCounts = new Map();
194
+ let hasChanges = false;
178
195
  for (const ref of tsConfig.references ?? []) {
179
196
  const normalizedPath = normalizeReferencePath(ref.path);
180
197
  originalReferencesSet.add(normalizedPath);
198
+ // Track duplicates
199
+ const currentCount = (pathCounts.get(normalizedPath) || 0) + 1;
200
+ pathCounts.set(normalizedPath, currentCount);
201
+ if (currentCount === 2) {
202
+ const resolvedRefPath = getTsConfigPathFromReferencePath(tsConfigPath, normalizedPath);
203
+ addChangedFile(changedFiles, tsConfigPath, resolvedRefPath, 'duplicates');
204
+ hasChanges = true;
205
+ }
206
+ if (currentCount > 1) {
207
+ // Skip duplicate processing - only process first occurrence
208
+ continue;
209
+ }
181
210
  if (ignoredReferences.has(ref.path)) {
182
211
  // we keep the user-defined ignored references
183
212
  references.push(ref);
@@ -196,7 +225,6 @@ function updateTsConfigReferences(tree, tsSysFromTree, tsconfigInfoCaches, tsCon
196
225
  addChangedFile(changedFiles, tsConfigPath, resolvedRefPath, 'stale');
197
226
  }
198
227
  }
199
- let hasChanges = false;
200
228
  for (const dep of dependencies) {
201
229
  // Ensure the project reference for the target is set if we can find the
202
230
  // relevant tsconfig file
@@ -363,7 +391,11 @@ function hasCompositeEnabled(tsSysFromTree, tsconfigInfoCaches, tsconfigPath) {
363
391
  }
364
392
  function addChangedFile(changedFiles, filePath, referencePath, type) {
365
393
  if (!changedFiles.has(filePath)) {
366
- changedFiles.set(filePath, { missing: new Set(), stale: new Set() });
394
+ changedFiles.set(filePath, {
395
+ duplicates: new Set(),
396
+ missing: new Set(),
397
+ stale: new Set(),
398
+ });
367
399
  }
368
400
  changedFiles.get(filePath)[type].add(referencePath);
369
401
  }
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/plugins/typescript/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAGhB,KAAK,aAAa,EAInB,MAAM,YAAY,CAAC;AAiCpB,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EACN,OAAO,GACP;QACE,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;IACN,KAAK,CAAC,EACF,OAAO,GACP;QACE,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,cAAc,CAAC,EAAE,OAAO,CAAC;KAC1B,CAAC;IACN,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAyFD;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,kBAEhC,CAAC;AAEF,eAAO,MAAM,WAAW,sBAAsB,CAAC;AAI/C,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC,gBAAgB,CA6DzD,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,WAAW,CAAC,gBAAgB,CAsCrD,CAAC"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/plugins/typescript/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAGhB,KAAK,aAAa,EAInB,MAAM,YAAY,CAAC;AAiCpB,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EACN,OAAO,GACP;QACE,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;IACN,KAAK,CAAC,EACF,OAAO,GACP;QACE,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,cAAc,CAAC,EAAE,OAAO,CAAC;KAC1B,CAAC;IACN,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB;AAyFD;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,kBAEhC,CAAC;AAEF,eAAO,MAAM,WAAW,sBAAsB,CAAC;AAI/C,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC,gBAAgB,CA4DzD,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,WAAW,CAAC,gBAAgB,CAsCrD,CAAC"}
@@ -88,7 +88,6 @@ exports.createNodesV2 = [
88
88
  return {
89
89
  projects: {
90
90
  [projectRoot]: {
91
- projectType: 'library',
92
91
  targets,
93
92
  },
94
93
  },
@@ -1 +1 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/plugins/typescript/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAGpE,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAE3E,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAGpD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AACF,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,iBAAiB,EACjB,SAAS,GAAG,mBAAmB,GAAG,KAAK,CACxC,GAAG;IACF,mBAAmB,EAAE,kBAAkB,EAAE,CAAC;CAC3C,CAAC;AAEF;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,EAC5C,OAAO,EAAE;IAAE,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAAC,mBAAmB,CAAC,EAAE,MAAM,CAAA;CAAE,EACvE,GAAG,EAAE,sBAAsB,GAC1B,IAAI,CA2BN;AAED,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,kBAAkB,EAC5B,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,GAClB,OAAO,CAqLT"}
1
+ {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/plugins/typescript/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAGpE,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAG3E,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAGpD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AACF,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,iBAAiB,EACjB,SAAS,GAAG,mBAAmB,GAAG,KAAK,CACxC,GAAG;IACF,mBAAmB,EAAE,kBAAkB,EAAE,CAAC;CAC3C,CAAC;AAEF;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,EAC5C,OAAO,EAAE;IAAE,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAAC,mBAAmB,CAAC,EAAE,MAAM,CAAA;CAAE,EACvE,GAAG,EAAE,sBAAsB,GAC1B,IAAI,CA2BN;AAED,wBAAgB,6BAA6B,CAC3C,QAAQ,EAAE,kBAAkB,EAC5B,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,GAClB,OAAO,CA2CT"}
@@ -40,148 +40,154 @@ function isValidPackageJsonBuildConfig(tsConfig, workspaceRoot, projectRoot) {
40
40
  const resolvedProjectPath = (0, node_path_1.isAbsolute)(projectRoot)
41
41
  ? (0, node_path_1.relative)(workspaceRoot, projectRoot)
42
42
  : projectRoot;
43
- const packageJsonPath = (0, path_1.join)(workspaceRoot, resolvedProjectPath, 'package.json');
43
+ const projectAbsolutePath = (0, node_path_1.resolve)(workspaceRoot, resolvedProjectPath);
44
+ const packageJsonPath = (0, path_1.join)(projectAbsolutePath, 'package.json');
44
45
  if (!(0, node_fs_1.existsSync)(packageJsonPath)) {
45
46
  // If the package.json file does not exist.
46
47
  // Assume it's valid because it would be using `project.json` instead.
47
48
  return true;
48
49
  }
49
50
  const packageJson = (0, devkit_1.readJsonFile)(packageJsonPath);
50
- const projectAbsolutePath = (0, node_path_1.resolve)(workspaceRoot, resolvedProjectPath);
51
- // Handle outFile first (has precedence over outDir)
51
+ // Check entry points against outFile (has precedence over outDir)
52
52
  if (tsConfig.options.outFile) {
53
- const outFile = (0, node_path_1.resolve)(workspaceRoot, resolvedProjectPath, tsConfig.options.outFile);
54
- const relativeToProject = (0, node_path_1.relative)(projectAbsolutePath, outFile);
55
- // If outFile is outside project root: buildable
56
- if (relativeToProject.startsWith('..')) {
57
- return true;
58
- }
59
- // If outFile is inside project root: check if entry points point to outFile
60
- const isPathSourceFile = (path) => {
61
- const normalizedPath = (0, node_path_1.isAbsolute)(path)
62
- ? (0, node_path_1.resolve)(workspaceRoot, path.startsWith('/') ? path.slice(1) : path)
63
- : (0, node_path_1.resolve)(workspaceRoot, resolvedProjectPath, path);
64
- // For outFile case, check if path points to the specific outFile
65
- return normalizedPath === outFile;
66
- };
67
- // Check if any entry points match the outFile
68
- const exports = packageJson?.exports;
69
- if (exports) {
70
- if (typeof exports === 'string') {
71
- return !isPathSourceFile(exports);
72
- }
73
- if (typeof exports === 'object' && '.' in exports) {
74
- const dotExport = exports['.'];
75
- if (typeof dotExport === 'string') {
76
- return !isPathSourceFile(dotExport);
77
- }
78
- else if (typeof dotExport === 'object') {
79
- const hasMatch = Object.entries(dotExport).some(([key, value]) => {
80
- if (key === 'types' || key === 'development' || key.startsWith('@'))
81
- return false;
82
- return typeof value === 'string' && isPathSourceFile(value);
83
- });
84
- return !hasMatch;
85
- }
86
- }
53
+ return isAnyEntryPointPointingToOutFile(packageJson, tsConfig, projectAbsolutePath, workspaceRoot);
54
+ }
55
+ // Check entry points against outDir
56
+ const outDir = tsConfig.options.outDir;
57
+ if (outDir) {
58
+ return isAnyEntryPointPointingToOutDir(packageJson, outDir, workspaceRoot, projectAbsolutePath);
59
+ }
60
+ // Check entry points against include patterns
61
+ return isAnyEntryPointPointingToNonIncludedFiles(packageJson, tsConfig, workspaceRoot, projectAbsolutePath);
62
+ }
63
+ const packageJsonLegacyEntryPoints = ['main', 'module'];
64
+ function isAnyEntryPointPointingToOutFile(packageJson, tsConfig, projectAbsolutePath, workspaceRoot) {
65
+ const outFile = (0, node_path_1.resolve)(projectAbsolutePath, tsConfig.options.outFile);
66
+ const relativeToProject = (0, node_path_1.relative)(projectAbsolutePath, outFile);
67
+ // If outFile is outside project root: buildable
68
+ if (relativeToProject.startsWith('..')) {
69
+ return true;
70
+ }
71
+ // If outFile is inside project root: check if entry points point to outFile
72
+ const isPathPointingToOutputFile = (path) => {
73
+ return normalizePath(path, workspaceRoot, projectAbsolutePath) === outFile;
74
+ };
75
+ const exports = packageJson.exports;
76
+ if (!exports) {
77
+ // If any entry point points to the outFile, or if no entry points are
78
+ // defined (Node.js falls back to `./index.js`), then it's buildable
79
+ return (packageJsonLegacyEntryPoints.some((field) => packageJson[field] && isPathPointingToOutputFile(packageJson[field])) || packageJsonLegacyEntryPoints.every((field) => !packageJson[field]));
80
+ }
81
+ if (typeof exports === 'string') {
82
+ return isPathPointingToOutputFile(exports);
83
+ }
84
+ const isExportsEntryPointingToOutFile = (value) => {
85
+ if (typeof value === 'string') {
86
+ return isPathPointingToOutputFile(value);
87
87
  }
88
- const buildPaths = ['main', 'module'];
89
- for (const field of buildPaths) {
90
- if (packageJson[field] && isPathSourceFile(packageJson[field])) {
91
- return false;
92
- }
88
+ if (typeof value === 'object') {
89
+ return Object.values(value).some((subValue) => typeof subValue === 'string' && isPathPointingToOutputFile(subValue));
93
90
  }
91
+ return false;
92
+ };
93
+ if ('.' in exports && exports['.'] !== null) {
94
+ return isExportsEntryPointingToOutFile(exports['.']);
95
+ }
96
+ // If any export is pointing to a path inside the outDir, then it's buildable
97
+ return Object.keys(exports).some((key) => key !== '.' && isExportsEntryPointingToOutFile(exports[key]));
98
+ }
99
+ function isAnyEntryPointPointingToOutDir(packageJson, outDir, workspaceRoot, projectAbsolutePath) {
100
+ const resolvedOutDir = (0, node_path_1.resolve)(projectAbsolutePath, outDir);
101
+ const relativePath = (0, node_path_1.relative)(projectAbsolutePath, resolvedOutDir);
102
+ // If outDir is outside project root: buildable
103
+ if (relativePath.startsWith('..')) {
94
104
  return true;
95
105
  }
96
- // Handle outDir
97
- const outDir = tsConfig.options.outDir;
98
- let resolvedOutDir;
99
- if (outDir) {
100
- const potentialOutDir = (0, node_path_1.resolve)(workspaceRoot, resolvedProjectPath, outDir);
101
- const relativePath = (0, node_path_1.relative)(projectAbsolutePath, potentialOutDir);
102
- // If outDir is outside project root: buildable
103
- if (relativePath.startsWith('..')) {
104
- return true;
106
+ const isPathInsideOutDir = (path) => {
107
+ const normalizedPath = normalizePath(path, workspaceRoot, projectAbsolutePath);
108
+ return !(0, node_path_1.relative)(resolvedOutDir, normalizedPath).startsWith('..');
109
+ };
110
+ const exports = packageJson.exports;
111
+ if (!exports) {
112
+ // If any entry point points to a path inside the outDir, or if no entry points
113
+ // are defined (Node.js falls back to `./index.js`), then it's buildable
114
+ return (packageJsonLegacyEntryPoints.some((field) => packageJson[field] &&
115
+ packageJson[field] !== './package.json' &&
116
+ isPathInsideOutDir(packageJson[field])) || packageJsonLegacyEntryPoints.every((field) => !packageJson[field]));
117
+ }
118
+ if (typeof exports === 'string') {
119
+ return isPathInsideOutDir(exports);
120
+ }
121
+ const isExportsEntryPointingToPathInsideOutDir = (value) => {
122
+ if (typeof value === 'string') {
123
+ return isPathInsideOutDir(value);
105
124
  }
106
- // If outDir is inside project root, then we should check entry points
107
- if (!relativePath.startsWith('..')) {
108
- resolvedOutDir = potentialOutDir;
125
+ if (typeof value === 'object') {
126
+ return Object.values(value).some((subValue) => typeof subValue === 'string' && isPathInsideOutDir(subValue));
109
127
  }
128
+ return false;
129
+ };
130
+ if ('.' in exports && exports['.'] !== null) {
131
+ return isExportsEntryPointingToPathInsideOutDir(exports['.']);
110
132
  }
133
+ // If any export is pointing to a path inside the outDir, then it's buildable
134
+ return Object.keys(exports).some((key) => key !== '.' &&
135
+ key !== './package.json' &&
136
+ isExportsEntryPointingToPathInsideOutDir(exports[key]));
137
+ }
138
+ function isAnyEntryPointPointingToNonIncludedFiles(packageJson, tsConfig, workspaceRoot, projectAbsolutePath) {
111
139
  const isPathSourceFile = (path) => {
112
- const normalizedPath = (0, node_path_1.isAbsolute)(path)
113
- ? (0, node_path_1.resolve)(workspaceRoot, path.startsWith('/') ? path.slice(1) : path)
114
- : (0, node_path_1.resolve)(workspaceRoot, resolvedProjectPath, path);
115
- if (resolvedOutDir) {
116
- // If the path is within the outDir, we assume it's not a source file.
117
- const relativePath = (0, node_path_1.relative)(resolvedOutDir, normalizedPath);
118
- if (!relativePath.startsWith('..')) {
119
- return false;
140
+ const normalizedPath = normalizePath(path, workspaceRoot, projectAbsolutePath);
141
+ const files = tsConfig.raw?.files;
142
+ const include = tsConfig.raw?.include;
143
+ if (Array.isArray(files)) {
144
+ const match = files.find((file) => normalizePath(file, workspaceRoot, projectAbsolutePath) ===
145
+ normalizedPath);
146
+ if (match) {
147
+ return true;
120
148
  }
121
149
  }
122
- // If no include patterns, TypeScript includes all TS files by default
123
- const include = tsConfig.raw?.include;
124
- if (!include || !Array.isArray(include)) {
150
+ // If not matched by `files`, check `include` patterns
151
+ if (!Array.isArray(include)) {
152
+ // If no include patterns, TypeScript includes all TS files by default
125
153
  const ext = (0, node_path_1.extname)(path);
126
154
  const tsExtensions = ['.ts', '.tsx', '.cts', '.mts'];
127
- if (tsExtensions.includes(ext)) {
128
- return true;
129
- }
130
- // If include is not defined and it's not a TS file, assume it's not a source file
131
- return false;
155
+ return tsExtensions.includes(ext);
132
156
  }
133
- const projectAbsolutePath = (0, node_path_1.resolve)(workspaceRoot, resolvedProjectPath);
134
157
  const relativeToProject = (0, node_path_1.relative)(projectAbsolutePath, normalizedPath);
135
- for (const pattern of include) {
136
- if (picomatch(pattern)(relativeToProject)) {
137
- return true;
138
- }
139
- }
140
- return false;
158
+ return include.some((pattern) => picomatch(pattern)(relativeToProject));
141
159
  };
142
- const containsInvalidPath = (value) => {
160
+ // Check the `.` export if `exports` is defined.
161
+ const exports = packageJson.exports;
162
+ if (!exports) {
163
+ // If any entry point doesn't point to a source file, or if no entry points
164
+ // are defined (Node.js falls back to `./index.js`), then it's buildable
165
+ return (packageJsonLegacyEntryPoints.some((field) => packageJson[field] && !isPathSourceFile(packageJson[field])) || packageJsonLegacyEntryPoints.every((field) => !packageJson[field]));
166
+ }
167
+ if (typeof exports === 'string') {
168
+ return !isPathSourceFile(exports);
169
+ }
170
+ const isExportsEntryPointingToSource = (value) => {
143
171
  if (typeof value === 'string') {
144
172
  return isPathSourceFile(value);
145
173
  }
146
- else if (typeof value === 'object') {
147
- return Object.entries(value).some(([currentKey, subValue]) => {
148
- // Skip types and development conditions
149
- if (currentKey === 'types' ||
150
- currentKey === 'development' ||
151
- currentKey.startsWith('@')) {
152
- return false;
153
- }
154
- if (typeof subValue === 'string') {
155
- return isPathSourceFile(subValue);
156
- }
157
- return false;
158
- });
174
+ if (typeof value === 'object') {
175
+ // entry point point to a source file if all conditions that are not set
176
+ // to `null` point to a source file
177
+ return Object.values(value).every((subValue) => typeof subValue !== 'string' || isPathSourceFile(subValue));
159
178
  }
160
179
  return false;
161
180
  };
162
- const exports = packageJson?.exports;
163
- // Check the `.` export if `exports` is defined.
164
- if (exports) {
165
- if (typeof exports === 'string') {
166
- return !isPathSourceFile(exports);
167
- }
168
- if (typeof exports === 'object' && '.' in exports) {
169
- return !containsInvalidPath(exports['.']);
170
- }
171
- // Check other exports if `.` is not defined or valid.
172
- for (const key in exports) {
173
- if (key !== '.' && containsInvalidPath(exports[key])) {
174
- return false;
175
- }
176
- }
177
- return true;
181
+ if ('.' in exports && exports['.'] !== null) {
182
+ return !isExportsEntryPointingToSource(exports['.']);
178
183
  }
179
- // If `exports` is not defined, fallback to `main` and `module` fields.
180
- const buildPaths = ['main', 'module'];
181
- for (const field of buildPaths) {
182
- if (packageJson[field] && isPathSourceFile(packageJson[field])) {
183
- return false;
184
- }
185
- }
186
- return true;
184
+ // If any export is not pointing to a source file, then it's buildable
185
+ return Object.keys(exports).some((key) => key !== '.' &&
186
+ key !== './package.json' &&
187
+ !isExportsEntryPointingToSource(exports[key]));
188
+ }
189
+ function normalizePath(path, workspaceRoot, projectAbsolutePath) {
190
+ return (0, node_path_1.isAbsolute)(path)
191
+ ? (0, node_path_1.resolve)(workspaceRoot, path.startsWith('/') ? path.slice(1) : path)
192
+ : (0, node_path_1.resolve)(projectAbsolutePath, path);
187
193
  }
@@ -6,6 +6,7 @@ export type AssetGlob = FileInputOutput & {
6
6
  glob: string;
7
7
  ignore?: string[];
8
8
  dot?: boolean;
9
+ includeIgnoredFiles?: boolean;
9
10
  };
10
11
  export declare function assetGlobsToFiles(assets: Array<AssetGlob | string>, rootDir: string, outDir: string): FileInputOutput[];
11
12
  //# sourceMappingURL=assets.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/utils/assets/assets.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AACF,MAAM,MAAM,SAAS,GAAG,eAAe,GAAG;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC,EACjC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACb,eAAe,EAAE,CA0CnB"}
1
+ {"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/utils/assets/assets.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AACF,MAAM,MAAM,SAAS,GAAG,eAAe,GAAG;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAC;AAEF,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC,EACjC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACb,eAAe,EAAE,CA0CnB"}
@@ -12,6 +12,7 @@ interface CopyAssetHandlerOptions {
12
12
  outputDir: string;
13
13
  assets: (string | AssetGlob)[];
14
14
  callback?: (events: FileEvent[]) => void;
15
+ includeIgnoredFiles?: boolean;
15
16
  }
16
17
  export declare const defaultFileEventHandler: (events: FileEvent[]) => void;
17
18
  export declare class CopyAssetsHandler {
@@ -21,6 +22,7 @@ export declare class CopyAssetsHandler {
21
22
  private readonly assetGlobs;
22
23
  private readonly ignore;
23
24
  private readonly callback;
25
+ private readonly includeIgnoredFiles;
24
26
  constructor(opts: CopyAssetHandlerOptions);
25
27
  processAllAssetsOnce(): Promise<void>;
26
28
  processAllAssetsOnceSync(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"copy-assets-handler.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/utils/assets/copy-assets-handler.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,OAAO,EAAE,WAAW,EAAgB,MAAM,6BAA6B,CAAC;AAGxE,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE3D,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,aAAa,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,uBAAuB;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;IAC/B,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,IAAI,CAAC;CAC1C;AAUD,eAAO,MAAM,uBAAuB,GAAI,QAAQ,SAAS,EAAE,SAiB1D,CAAC;AAEF,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAe;IAC1C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA4B;IACnD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgC;gBAE7C,IAAI,EAAE,uBAAuB;IAuDnC,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAmB3C,wBAAwB,IAAI,IAAI;IAgB1B,4BAA4B,IAAI,OAAO,CAAC,MAAM,IAAI,CAAC;IAqBnD,kBAAkB,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAgC9D,OAAO,CAAC,YAAY;IAkBpB,OAAO,CAAC,qBAAqB;CAG9B"}
1
+ {"version":3,"file":"copy-assets-handler.d.ts","sourceRoot":"","sources":["../../../../../../packages/js/src/utils/assets/copy-assets-handler.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,OAAO,EAAE,WAAW,EAAgB,MAAM,6BAA6B,CAAC;AAGxE,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE3D,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,aAAa,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,uBAAuB;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,CAAC;IAC/B,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,IAAI,CAAC;IACzC,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAWD,eAAO,MAAM,uBAAuB,GAAI,QAAQ,SAAS,EAAE,SAiB1D,CAAC;AAEF,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAe;IAC1C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA4B;IACnD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgC;IACzD,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAU;gBAElC,IAAI,EAAE,uBAAuB;IA2DnC,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAmB3C,wBAAwB,IAAI,IAAI;IAgB1B,4BAA4B,IAAI,OAAO,CAAC,MAAM,IAAI,CAAC;IAqBnD,kBAAkB,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAiC9D,OAAO,CAAC,YAAY;IAmBpB,OAAO,CAAC,qBAAqB;CAG9B"}
@@ -37,6 +37,7 @@ class CopyAssetsHandler {
37
37
  this.projectDir = opts.projectDir;
38
38
  this.outputDir = opts.outputDir;
39
39
  this.callback = opts.callback ?? exports.defaultFileEventHandler;
40
+ this.includeIgnoredFiles = opts.includeIgnoredFiles ?? false;
40
41
  // TODO(jack): Should handle nested .gitignore files
41
42
  this.ignore = (0, ignore_1.default)();
42
43
  const gitignore = pathPosix.join(opts.rootDir, '.gitignore');
@@ -54,6 +55,7 @@ class CopyAssetsHandler {
54
55
  let input;
55
56
  let output;
56
57
  let ignore = null;
58
+ let includeIgnoredFiles = undefined;
57
59
  const resolvedOutputDir = path.isAbsolute(opts.outputDir)
58
60
  ? opts.outputDir
59
61
  : path.resolve(opts.rootDir, opts.outputDir);
@@ -69,6 +71,7 @@ class CopyAssetsHandler {
69
71
  output = pathPosix.join(path.relative(opts.rootDir, resolvedOutputDir), f.output);
70
72
  if (f.ignore)
71
73
  ignore = f.ignore.map((ig) => pathPosix.join(f.input, ig));
74
+ includeIgnoredFiles = f.includeIgnoredFiles;
72
75
  }
73
76
  return {
74
77
  isGlob,
@@ -76,6 +79,7 @@ class CopyAssetsHandler {
76
79
  pattern,
77
80
  ignore,
78
81
  output,
82
+ includeIgnoredFiles,
79
83
  };
80
84
  });
81
85
  }
@@ -135,7 +139,8 @@ class CopyAssetsHandler {
135
139
  for (const ag of this.assetGlobs) {
136
140
  if (picomatch(ag.pattern)(pathFromRoot) &&
137
141
  !ag.ignore?.some((ig) => picomatch(ig)(pathFromRoot)) &&
138
- !this.ignore.ignores(pathFromRoot)) {
142
+ ((ag.includeIgnoredFiles ?? this.includeIgnoredFiles) ||
143
+ !this.ignore.ignores(pathFromRoot))) {
139
144
  const relPath = path.relative(ag.input, pathFromRoot);
140
145
  const destPath = relPath.startsWith('..') ? pathFromRoot : relPath;
141
146
  fileEvents.push({
@@ -154,7 +159,8 @@ class CopyAssetsHandler {
154
159
  filesToEvent(files, assetGlob) {
155
160
  return files.reduce((acc, src) => {
156
161
  if (!assetGlob.ignore?.some((ig) => picomatch(ig)(src)) &&
157
- !this.ignore.ignores(src)) {
162
+ ((assetGlob.includeIgnoredFiles ?? this.includeIgnoredFiles) ||
163
+ !this.ignore.ignores(src))) {
158
164
  const relPath = path.relative(assetGlob.input, src);
159
165
  const dest = relPath.startsWith('..') ? src : relPath;
160
166
  acc.push({
@@ -5,6 +5,7 @@ export interface CopyAssetsOptions {
5
5
  outputPath: string;
6
6
  assets: (string | AssetGlob)[];
7
7
  watch?: boolean | WatchMode;
8
+ includeIgnoredAssetFiles?: boolean;
8
9
  }
9
10
  export interface CopyAssetsResult {
10
11
  success?: boolean;