@arcgis/components-build-utils 4.33.0-next.126 → 4.33.0-next.128

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -198,8 +198,8 @@ function vitePresetPlugin({
198
198
  externalize: [],
199
199
  dtsOptions: {}
200
200
  }) {
201
- const rootDir = path.resolve("src");
202
- const outputDir = path.resolve("dist");
201
+ const dist = `${path.resolve("dist")}/`;
202
+ const distSrc = `${dist}src/`;
203
203
  let userConfig = void 0;
204
204
  let command = void 0;
205
205
  return [
@@ -240,14 +240,6 @@ function vitePresetPlugin({
240
240
  ),
241
241
  dts({
242
242
  logLevel: "warn",
243
- /**
244
- * Do not emit any .d.ts files for files outside the dist directory
245
- * (i.e vite.config.ts, storybook stories and etc)
246
- * This also applies for references to node_modules/.../components.d.ts files in
247
- * tsconfig.json - these must be included in TypeScript program to provide
248
- * types, but should not be re-emitted during build.
249
- */
250
- beforeWriteFile: (filePath, content) => filePath.startsWith(outputDir) && !shouldSkip(filePath) ? { filePath, content } : false,
251
243
  // Copies .d.ts files to d.cjs file for CommonJS.
252
244
  // Adds a performance hit as it occurs after the build
253
245
  async afterBuild(emitted) {
@@ -263,9 +255,26 @@ function vitePresetPlugin({
263
255
  },
264
256
  ...dtsOptions,
265
257
  compilerOptions: {
266
- rootDir,
258
+ // For details, see comment above excludeOutsideFiles in
259
+ // https://devtopia.esri.com/WebGIS/arcgis-web-components/blob/main/packages/support-packages/lit-compiler/src/types/textTransformers.ts
260
+ rootDir: ".",
267
261
  ...dtsOptions.compilerOptions
268
262
  },
263
+ /**
264
+ * Do not emit any .d.ts files for files outside the dist directory
265
+ * (i.e vite.config.ts, storybook stories and etc)
266
+ * This also applies for references to node_modules/.../components.d.ts files in
267
+ * tsconfig.json - these must be included in TypeScript program to provide
268
+ * types, but should not be re-emitted during build.
269
+ */
270
+ beforeWriteFile: async (filePath, content) => {
271
+ if (filePath.startsWith(distSrc) && !shouldSkip(filePath)) {
272
+ const baseBeforeWriteFile = dtsOptions?.beforeWriteFile ?? ((filePath2, content2) => ({ filePath: filePath2, content: content2 }));
273
+ return await baseBeforeWriteFile(`${dist}${filePath.slice(distSrc.length)}`, content);
274
+ } else {
275
+ return false;
276
+ }
277
+ },
269
278
  afterDiagnostic(diagnostics) {
270
279
  const hasErrors = diagnostics.length > 0;
271
280
  const isBuilding = command === "build";
package/dist/index.js CHANGED
@@ -174,8 +174,8 @@ function vitePresetPlugin({
174
174
  externalize: [],
175
175
  dtsOptions: {}
176
176
  }) {
177
- const rootDir = path.resolve("src");
178
- const outputDir = path.resolve("dist");
177
+ const dist = `${path.resolve("dist")}/`;
178
+ const distSrc = `${dist}src/`;
179
179
  let userConfig = void 0;
180
180
  let command = void 0;
181
181
  return [
@@ -216,14 +216,6 @@ function vitePresetPlugin({
216
216
  ),
217
217
  dts({
218
218
  logLevel: "warn",
219
- /**
220
- * Do not emit any .d.ts files for files outside the dist directory
221
- * (i.e vite.config.ts, storybook stories and etc)
222
- * This also applies for references to node_modules/.../components.d.ts files in
223
- * tsconfig.json - these must be included in TypeScript program to provide
224
- * types, but should not be re-emitted during build.
225
- */
226
- beforeWriteFile: (filePath, content) => filePath.startsWith(outputDir) && !shouldSkip(filePath) ? { filePath, content } : false,
227
219
  // Copies .d.ts files to d.cjs file for CommonJS.
228
220
  // Adds a performance hit as it occurs after the build
229
221
  async afterBuild(emitted) {
@@ -239,9 +231,26 @@ function vitePresetPlugin({
239
231
  },
240
232
  ...dtsOptions,
241
233
  compilerOptions: {
242
- rootDir,
234
+ // For details, see comment above excludeOutsideFiles in
235
+ // https://devtopia.esri.com/WebGIS/arcgis-web-components/blob/main/packages/support-packages/lit-compiler/src/types/textTransformers.ts
236
+ rootDir: ".",
243
237
  ...dtsOptions.compilerOptions
244
238
  },
239
+ /**
240
+ * Do not emit any .d.ts files for files outside the dist directory
241
+ * (i.e vite.config.ts, storybook stories and etc)
242
+ * This also applies for references to node_modules/.../components.d.ts files in
243
+ * tsconfig.json - these must be included in TypeScript program to provide
244
+ * types, but should not be re-emitted during build.
245
+ */
246
+ beforeWriteFile: async (filePath, content) => {
247
+ if (filePath.startsWith(distSrc) && !shouldSkip(filePath)) {
248
+ const baseBeforeWriteFile = dtsOptions?.beforeWriteFile ?? ((filePath2, content2) => ({ filePath: filePath2, content: content2 }));
249
+ return await baseBeforeWriteFile(`${dist}${filePath.slice(distSrc.length)}`, content);
250
+ } else {
251
+ return false;
252
+ }
253
+ },
245
254
  afterDiagnostic(diagnostics) {
246
255
  const hasErrors = diagnostics.length > 0;
247
256
  const isBuilding = command === "build";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/components-build-utils",
3
- "version": "4.33.0-next.126",
3
+ "version": "4.33.0-next.128",
4
4
  "description": "Collection of common internal build-time patterns and utilities for ArcGIS Maps SDK for JavaScript components.",
5
5
  "homepage": "https://developers.arcgis.com/javascript/latest/",
6
6
  "type": "module",