@arcgis/components-build-utils 4.33.0-next.98 → 4.33.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,12 @@
1
+ import { Command } from '@commander-js/extra-typings';
2
+ export declare const registerCommand: (command: Command) => undefined;
3
+ export type Builddate = {
4
+ "builddate": string;
5
+ "commit": string;
6
+ "branch": string;
7
+ "version": string;
8
+ "@arcgis/core": string;
9
+ "@esri/calcite-components": string;
10
+ "@esri/arcgis-html-sanitizer": string;
11
+ };
12
+ export declare function generateBuilddate(): Builddate;
@@ -0,0 +1,12 @@
1
+ import { Command } from '@commander-js/extra-typings';
2
+ export declare const registerCommand: (command: Command) => undefined;
3
+ export type Builddate = {
4
+ "builddate": string;
5
+ "commit": string;
6
+ "branch": string;
7
+ "version": string;
8
+ "@arcgis/core": string;
9
+ "@esri/calcite-components": string;
10
+ "@esri/arcgis-html-sanitizer": string;
11
+ };
12
+ export declare function generateBuilddate(): Builddate;
@@ -0,0 +1,2 @@
1
+ import { Command } from '@commander-js/extra-typings';
2
+ export declare const registerCommand: (command: Command) => undefined;
@@ -0,0 +1,2 @@
1
+ import { Command } from '@commander-js/extra-typings';
2
+ export declare const registerCommand: (command: Command) => undefined;
@@ -1,3 +1,2 @@
1
1
  import { Command } from '@commander-js/extra-typings';
2
2
  export declare const registerCommand: (command: Command) => undefined;
3
- export declare function runTests(files: string[]): void;
@@ -1,3 +1,2 @@
1
1
  import { Command } from '@commander-js/extra-typings';
2
2
  export declare const registerCommand: (command: Command) => undefined;
3
- export declare function runTests(files: string[]): void;
@@ -0,0 +1,5 @@
1
+ import { Command } from '@commander-js/extra-typings';
2
+ export declare const registerCommand: (command: Command) => undefined;
3
+ export declare function scanDist(packages: string[], { blocklistedNames }: {
4
+ blocklistedNames?: string[];
5
+ }): Promise<void>;
@@ -0,0 +1,5 @@
1
+ import { Command } from '@commander-js/extra-typings';
2
+ export declare const registerCommand: (command: Command) => undefined;
3
+ export declare function scanDist(packages: string[], { blocklistedNames }: {
4
+ blocklistedNames?: string[];
5
+ }): Promise<void>;
@@ -0,0 +1,2 @@
1
+ export declare function error(...messages: unknown[]): void;
2
+ export declare function sh(command: string, cwd?: string): string;
@@ -0,0 +1,2 @@
1
+ export declare function error(...messages: unknown[]): void;
2
+ export declare function sh(command: string, cwd?: string): string;
package/dist/index.cjs CHANGED
@@ -30,7 +30,11 @@ const node_url = require("node:url");
30
30
  const posix = require("node:path/posix");
31
31
  const win32 = require("node:path/win32");
32
32
  const dts = require("vite-plugin-dts");
33
- const existsAsync = async (file) => await promises.access(file, promises.constants.F_OK).then(() => true).catch(() => false);
33
+ const existsAsync = async (file) => (
34
+ // Using un-promisified version because promises version creates exceptions
35
+ // which interferes with debugging when "Pause on caught exceptions" is enabled
36
+ await new Promise((resolve2) => node_fs.access(file, promises.constants.F_OK, (error) => resolve2(!error)))
37
+ );
34
38
  const sh = (command, cwd) => node_child_process.execSync(command.trim(), { encoding: "utf8", cwd }).trim();
35
39
  async function createFileIfNotExists(filePath, content) {
36
40
  await promises.mkdir(node_path.dirname(filePath), { recursive: true });
@@ -155,7 +159,7 @@ async function fetchPackageLocation(packageName, cwd) {
155
159
  cwd
156
160
  ).then((packageJsonLocation) => {
157
161
  if (packageJsonLocation === void 0) {
158
- throw new Error(
162
+ throw Error(
159
163
  `@arcgis/components-build-utils: Unable to resolve package.json location for "${packageName}" package. Current working directory: ${process.cwd()}`
160
164
  );
161
165
  }
@@ -194,8 +198,8 @@ function vitePresetPlugin({
194
198
  externalize: [],
195
199
  dtsOptions: {}
196
200
  }) {
197
- const rootDir = path.resolve("src");
198
- const outputDir = path.resolve("dist");
201
+ const dist = `${path.resolve("dist")}/`;
202
+ const distSrc = `${dist}src/`;
199
203
  let userConfig = void 0;
200
204
  let command = void 0;
201
205
  return [
@@ -236,14 +240,6 @@ function vitePresetPlugin({
236
240
  ),
237
241
  dts({
238
242
  logLevel: "warn",
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: (filePath, content) => filePath.startsWith(outputDir) && !shouldSkip(filePath) ? { filePath, content } : false,
247
243
  // Copies .d.ts files to d.cjs file for CommonJS.
248
244
  // Adds a performance hit as it occurs after the build
249
245
  async afterBuild(emitted) {
@@ -259,9 +255,26 @@ function vitePresetPlugin({
259
255
  },
260
256
  ...dtsOptions,
261
257
  compilerOptions: {
262
- 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: ".",
263
261
  ...dtsOptions.compilerOptions
264
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
+ },
265
278
  afterDiagnostic(diagnostics) {
266
279
  const hasErrors = diagnostics.length > 0;
267
280
  const isBuilding = command === "build";
package/dist/index.js CHANGED
@@ -1,12 +1,16 @@
1
- import { existsSync, readFileSync } from "node:fs";
2
- import { access, constants, mkdir, writeFile, readFile } from "node:fs/promises";
1
+ import { access, existsSync, readFileSync } from "node:fs";
2
+ import { constants, mkdir, writeFile, readFile } from "node:fs/promises";
3
3
  import { execSync } from "node:child_process";
4
4
  import { dirname, resolve, sep, join } from "node:path";
5
5
  import { fileURLToPath } from "node:url";
6
6
  import posix from "node:path/posix";
7
7
  import win32 from "node:path/win32";
8
8
  import dts from "vite-plugin-dts";
9
- const existsAsync = async (file) => await access(file, constants.F_OK).then(() => true).catch(() => false);
9
+ const existsAsync = async (file) => (
10
+ // Using un-promisified version because promises version creates exceptions
11
+ // which interferes with debugging when "Pause on caught exceptions" is enabled
12
+ await new Promise((resolve2) => access(file, constants.F_OK, (error) => resolve2(!error)))
13
+ );
10
14
  const sh = (command, cwd) => execSync(command.trim(), { encoding: "utf8", cwd }).trim();
11
15
  async function createFileIfNotExists(filePath, content) {
12
16
  await mkdir(dirname(filePath), { recursive: true });
@@ -131,7 +135,7 @@ async function fetchPackageLocation(packageName, cwd) {
131
135
  cwd
132
136
  ).then((packageJsonLocation) => {
133
137
  if (packageJsonLocation === void 0) {
134
- throw new Error(
138
+ throw Error(
135
139
  `@arcgis/components-build-utils: Unable to resolve package.json location for "${packageName}" package. Current working directory: ${process.cwd()}`
136
140
  );
137
141
  }
@@ -170,8 +174,8 @@ function vitePresetPlugin({
170
174
  externalize: [],
171
175
  dtsOptions: {}
172
176
  }) {
173
- const rootDir = path.resolve("src");
174
- const outputDir = path.resolve("dist");
177
+ const dist = `${path.resolve("dist")}/`;
178
+ const distSrc = `${dist}src/`;
175
179
  let userConfig = void 0;
176
180
  let command = void 0;
177
181
  return [
@@ -212,14 +216,6 @@ function vitePresetPlugin({
212
216
  ),
213
217
  dts({
214
218
  logLevel: "warn",
215
- /**
216
- * Do not emit any .d.ts files for files outside the dist directory
217
- * (i.e vite.config.ts, storybook stories and etc)
218
- * This also applies for references to node_modules/.../components.d.ts files in
219
- * tsconfig.json - these must be included in TypeScript program to provide
220
- * types, but should not be re-emitted during build.
221
- */
222
- beforeWriteFile: (filePath, content) => filePath.startsWith(outputDir) && !shouldSkip(filePath) ? { filePath, content } : false,
223
219
  // Copies .d.ts files to d.cjs file for CommonJS.
224
220
  // Adds a performance hit as it occurs after the build
225
221
  async afterBuild(emitted) {
@@ -235,9 +231,26 @@ function vitePresetPlugin({
235
231
  },
236
232
  ...dtsOptions,
237
233
  compilerOptions: {
238
- 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: ".",
239
237
  ...dtsOptions.compilerOptions
240
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
+ },
241
254
  afterDiagnostic(diagnostics) {
242
255
  const hasErrors = diagnostics.length > 0;
243
256
  const isBuilding = command === "build";
@@ -7,13 +7,24 @@
7
7
  export type MiniPackageJson = {
8
8
  "name": string;
9
9
  "version": string;
10
+ "private"?: boolean;
11
+ "type"?: "commonjs" | "module";
12
+ "publishConfig"?: {
13
+ access?: string;
14
+ registry?: string;
15
+ };
16
+ "files"?: string[];
10
17
  "dependencies"?: Record<string, string | undefined>;
11
18
  "devDependencies"?: Record<string, string | undefined>;
12
19
  "peerDependencies"?: Record<string, string | undefined>;
20
+ "peerDependenciesMeta"?: Record<string, {
21
+ optional?: boolean;
22
+ }>;
13
23
  "css.customData"?: string[];
14
24
  "customElements"?: string;
15
25
  "html.customData"?: string[];
16
26
  "web-types"?: string;
27
+ "exports"?: Record<string, Record<string, string> | string>;
17
28
  };
18
29
  export declare function retrievePackageJson(location?: string): MiniPackageJson;
19
30
  export declare function asyncRetrievePackageJson(location?: string): Promise<MiniPackageJson>;
@@ -7,13 +7,24 @@
7
7
  export type MiniPackageJson = {
8
8
  "name": string;
9
9
  "version": string;
10
+ "private"?: boolean;
11
+ "type"?: "commonjs" | "module";
12
+ "publishConfig"?: {
13
+ access?: string;
14
+ registry?: string;
15
+ };
16
+ "files"?: string[];
10
17
  "dependencies"?: Record<string, string | undefined>;
11
18
  "devDependencies"?: Record<string, string | undefined>;
12
19
  "peerDependencies"?: Record<string, string | undefined>;
20
+ "peerDependenciesMeta"?: Record<string, {
21
+ optional?: boolean;
22
+ }>;
13
23
  "css.customData"?: string[];
14
24
  "customElements"?: string;
15
25
  "html.customData"?: string[];
16
26
  "web-types"?: string;
27
+ "exports"?: Record<string, Record<string, string> | string>;
17
28
  };
18
29
  export declare function retrievePackageJson(location?: string): MiniPackageJson;
19
30
  export declare function asyncRetrievePackageJson(location?: string): Promise<MiniPackageJson>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/components-build-utils",
3
- "version": "4.33.0-next.98",
3
+ "version": "4.33.0",
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",
@@ -26,10 +26,10 @@
26
26
  "chalk": "^5.3.0",
27
27
  "commander": "^11.1.0",
28
28
  "glob": "^11.0.0",
29
- "rollup-plugin-node-externals": "^7.1.3",
29
+ "rollup-plugin-node-externals": "^8.0.0",
30
30
  "split2": "^4.2.0",
31
- "tslib": "^2.7.0",
32
- "vite": "^5.4.8",
33
- "vite-plugin-dts": "^4.3.0"
31
+ "tslib": "^2.8.1",
32
+ "vite": "^6.3.4",
33
+ "vite-plugin-dts": "^4.5.3"
34
34
  }
35
35
  }