@arcgis/node-toolkit 6.0.0-next.13 → 6.0.0-next.15
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/glob.d.ts +0 -7
- package/dist/glob.js +2 -4
- package/dist/shell.d.ts +0 -18
- package/dist/shell.js +1 -22
- package/dist/vite/presetPlugin.d.ts +2 -11
- package/dist/vite/presetPlugin.js +2 -50
- package/package.json +2 -3
package/dist/glob.d.ts
CHANGED
|
@@ -19,10 +19,3 @@
|
|
|
19
19
|
* ```
|
|
20
20
|
*/
|
|
21
21
|
export declare function gitIgnoreFileToGlobs(filePath: string): string[];
|
|
22
|
-
/**
|
|
23
|
-
* @public
|
|
24
|
-
* @param pattern
|
|
25
|
-
* @deprecated Use gitIgnoreFileToGlobs from "@arcgis/node-toolkit/glob"
|
|
26
|
-
* instead
|
|
27
|
-
*/
|
|
28
|
-
export declare const gitIgnoreToGlob: (pattern: string) => string;
|
package/dist/glob.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { readFileSync } from "node:fs";
|
|
2
2
|
function gitIgnoreFileToGlobs(filePath) {
|
|
3
|
-
return readFileSync(filePath, "utf8").split("\n").filter((line) => line.trim().length > 0 && !line.trim().startsWith("#")).map(
|
|
3
|
+
return readFileSync(filePath, "utf8").split("\n").filter((line) => line.trim().length > 0 && !line.trim().startsWith("#")).map((pattern) => fixAbsoluteSyntax(fixMatchFilesSyntax(pattern.trim())));
|
|
4
4
|
}
|
|
5
|
-
const gitIgnoreToGlob = (pattern) => fixAbsoluteSyntax(fixMatchFilesSyntax(pattern.trim()));
|
|
6
5
|
function fixAbsoluteSyntax(pattern) {
|
|
7
6
|
if (pattern.startsWith("/")) {
|
|
8
7
|
return pattern.slice(1);
|
|
@@ -23,6 +22,5 @@ function fixMatchFilesSyntax(pattern) {
|
|
|
23
22
|
return pattern.endsWith("/*") ? `${pattern}*` : pattern.endsWith("/") ? `${pattern}**` : `${pattern}/**`;
|
|
24
23
|
}
|
|
25
24
|
export {
|
|
26
|
-
gitIgnoreFileToGlobs
|
|
27
|
-
gitIgnoreToGlob
|
|
25
|
+
gitIgnoreFileToGlobs
|
|
28
26
|
};
|
package/dist/shell.d.ts
CHANGED
|
@@ -46,24 +46,6 @@ export declare function sh(command: string, options?: Partial<ExecSyncOptionsWit
|
|
|
46
46
|
* @param options
|
|
47
47
|
*/
|
|
48
48
|
export declare function asyncSh(command: string, options?: Partial<ExecOptionsWithStringEncoding>): Promise<string>;
|
|
49
|
-
/**
|
|
50
|
-
* Synchronously execute a command without shell interpolation and return the output.
|
|
51
|
-
*
|
|
52
|
-
* This is usually safer than {@link shell!sh} because arguments are passed as
|
|
53
|
-
* discrete tokens, which avoids most shell escaping issues and command
|
|
54
|
-
* injection pitfalls.
|
|
55
|
-
*
|
|
56
|
-
* Example:
|
|
57
|
-
* `sp("git", ["show", `${baseRef}:pnpm-workspace.yaml`])`
|
|
58
|
-
*
|
|
59
|
-
* Avoid {@link shell!sp} only when you explicitly need shell features.
|
|
60
|
-
* @public
|
|
61
|
-
* @deprecated Use {@link shell!collectOutputSync} or {@link shell!runCommandSync} instead.
|
|
62
|
-
* @param command
|
|
63
|
-
* @param args
|
|
64
|
-
* @param options
|
|
65
|
-
*/
|
|
66
|
-
export declare function sp(command: string, args: string[], options?: Partial<SpawnSyncOptionsWithStringEncoding>): string;
|
|
67
49
|
/**
|
|
68
50
|
* Synchronously execute a command and stream output to the current process.
|
|
69
51
|
* Note 1:
|
package/dist/shell.js
CHANGED
|
@@ -43,26 +43,6 @@ ${output}`;
|
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
function sp(command, args, options = {}) {
|
|
47
|
-
if (process.platform === "win32" && command === "pnpm" && // Allow explicit shell config including shell:false for environment-specific handling.
|
|
48
|
-
!("shell" in options)) {
|
|
49
|
-
throw Error(
|
|
50
|
-
'If invoking pnpm on Windows, provide { shell: true } or { shell: process.platform === "win32" } and handle shell escaping.'
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
const normalizedOptions = { encoding: "utf8", ...options };
|
|
54
|
-
const result = spawnSync(command, args, normalizedOptions);
|
|
55
|
-
if (result.error) {
|
|
56
|
-
throw result.error;
|
|
57
|
-
}
|
|
58
|
-
const sep = result.stdout && result.stderr ? "\n" : "";
|
|
59
|
-
const output = `${result.stdout ?? ""}${sep}${result.stderr ?? ""}`.trim();
|
|
60
|
-
const exitCode = result.status ?? 0;
|
|
61
|
-
if (exitCode !== 0) {
|
|
62
|
-
throw makeSpawnError(command, args, exitCode, result.signal, output);
|
|
63
|
-
}
|
|
64
|
-
return output;
|
|
65
|
-
}
|
|
66
46
|
function runCommandSync(command, args, options = {}) {
|
|
67
47
|
const fixedOptions = fixPnpmUsage(command, options);
|
|
68
48
|
const { input } = fixedOptions;
|
|
@@ -155,6 +135,5 @@ export {
|
|
|
155
135
|
collectOutputSync,
|
|
156
136
|
runCommand,
|
|
157
137
|
runCommandSync,
|
|
158
|
-
sh
|
|
159
|
-
sp
|
|
138
|
+
sh
|
|
160
139
|
};
|
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
import type { Plugin } from "vite";
|
|
2
|
-
import type dts from "vite-plugin-dts";
|
|
3
2
|
import { type DependencyManagementOptions } from "./externalizeDependenciesPlugin.ts";
|
|
4
3
|
/** @public */
|
|
5
|
-
export type VitePresetOptions = DependencyManagementOptions
|
|
6
|
-
/**
|
|
7
|
-
* Options for `vite-plugin-dts`
|
|
8
|
-
*
|
|
9
|
-
* @public
|
|
10
|
-
* @deprecated Use https://webgis.esri.com/references/api-extractor/integrations instead
|
|
11
|
-
*/
|
|
12
|
-
dtsOptions?: Parameters<typeof dts>[0] | false;
|
|
13
|
-
};
|
|
4
|
+
export type VitePresetOptions = DependencyManagementOptions;
|
|
14
5
|
/**
|
|
15
6
|
* Vite preset for all our support packages:
|
|
16
7
|
* - externalizes all non-dev-dependencies
|
|
@@ -18,4 +9,4 @@ export type VitePresetOptions = DependencyManagementOptions & {
|
|
|
18
9
|
* @public
|
|
19
10
|
* @param options
|
|
20
11
|
*/
|
|
21
|
-
export declare function vitePresetPlugin({
|
|
12
|
+
export declare function vitePresetPlugin({ externalize, bundleIn, isApplication }?: VitePresetOptions): [Plugin, Plugin];
|
|
@@ -1,24 +1,13 @@
|
|
|
1
|
-
import { path } from "../path.js";
|
|
2
1
|
import { externalizeDependencies } from "./externalizeDependenciesPlugin.js";
|
|
3
|
-
function shouldSkip(id) {
|
|
4
|
-
return id.includes("__test") || id.includes(".e2e.") || id.includes(".spec.") || id.includes(".test.") || id.includes(".stories.");
|
|
5
|
-
}
|
|
6
2
|
const hashlessOutputNames = {
|
|
7
3
|
assetFileNames: "assets/[name][extname]",
|
|
8
4
|
chunkFileNames: "chunks/[name].js"
|
|
9
5
|
};
|
|
10
|
-
function vitePresetPlugin({
|
|
11
|
-
externalize: [],
|
|
12
|
-
dtsOptions: {}
|
|
13
|
-
}) {
|
|
14
|
-
const dist = `${path.resolve("dist")}/`;
|
|
15
|
-
const distSrc = `${dist}src/`;
|
|
16
|
-
let command = void 0;
|
|
6
|
+
function vitePresetPlugin({ externalize, bundleIn, isApplication } = { externalize: [] }) {
|
|
17
7
|
return [
|
|
18
8
|
{
|
|
19
9
|
name: "vite-preset-config",
|
|
20
10
|
config(config, env) {
|
|
21
|
-
command = env.command;
|
|
22
11
|
const { rollupOptions, ssr, target } = config.build ?? {};
|
|
23
12
|
const isBrowserApplication = isApplication && !ssr && !env.isSsrBuild;
|
|
24
13
|
const output = rollupOptions?.output;
|
|
@@ -40,44 +29,7 @@ function vitePresetPlugin({ dtsOptions = {}, externalize, bundleIn, isApplicatio
|
|
|
40
29
|
externalize,
|
|
41
30
|
bundleIn,
|
|
42
31
|
isApplication
|
|
43
|
-
})
|
|
44
|
-
// This dependency pulls in many others. Since components-build-utils has a
|
|
45
|
-
// single entry point, we load a large module tree needlessly. To avoid,
|
|
46
|
-
// load the plugin on demand.
|
|
47
|
-
dtsOptions === false ? void 0 : import("vite-plugin-dts").then(
|
|
48
|
-
({ default: dts }) => dts({
|
|
49
|
-
logLevel: "warn",
|
|
50
|
-
...dtsOptions,
|
|
51
|
-
compilerOptions: {
|
|
52
|
-
rootDir: ".",
|
|
53
|
-
...dtsOptions.compilerOptions
|
|
54
|
-
},
|
|
55
|
-
/**
|
|
56
|
-
* Do not emit any .d.ts files for files outside the dist directory
|
|
57
|
-
* (i.e vite.config.ts, storybook stories and etc)
|
|
58
|
-
* This also applies for references to node_modules/.../components.d.ts files in
|
|
59
|
-
* tsconfig.json - these must be included in TypeScript program to provide
|
|
60
|
-
* types, but should not be re-emitted during build.
|
|
61
|
-
*/
|
|
62
|
-
beforeWriteFile: async (filePath, content) => {
|
|
63
|
-
if (filePath.startsWith(distSrc) && !shouldSkip(filePath)) {
|
|
64
|
-
const filePathRelativeToDist = `${dist}${filePath.slice(distSrc.length)}`;
|
|
65
|
-
return dtsOptions?.beforeWriteFile ? await dtsOptions.beforeWriteFile(filePathRelativeToDist, content) : { filePath: filePathRelativeToDist, content };
|
|
66
|
-
} else {
|
|
67
|
-
return false;
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
afterDiagnostic(diagnostics) {
|
|
71
|
-
const hasErrors = diagnostics.length > 0;
|
|
72
|
-
const isBuilding = command === "build";
|
|
73
|
-
const stopBuild = hasErrors && isBuilding;
|
|
74
|
-
if (stopBuild) {
|
|
75
|
-
throw new Error("TypeScript errors reported. See error messages above");
|
|
76
|
-
}
|
|
77
|
-
return dtsOptions?.afterDiagnostic?.(diagnostics);
|
|
78
|
-
}
|
|
79
|
-
})
|
|
80
|
-
)
|
|
32
|
+
})
|
|
81
33
|
];
|
|
82
34
|
}
|
|
83
35
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/node-toolkit",
|
|
3
|
-
"version": "6.0.0-next.
|
|
3
|
+
"version": "6.0.0-next.15",
|
|
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",
|
|
@@ -29,7 +29,6 @@
|
|
|
29
29
|
"picomatch": "^4.0.4",
|
|
30
30
|
"tslib": "^2.8.1",
|
|
31
31
|
"typescript": "~6.0.3",
|
|
32
|
-
"vite": "^7.3.2"
|
|
33
|
-
"vite-plugin-dts": "^4.5.4"
|
|
32
|
+
"vite": "^7.3.2"
|
|
34
33
|
}
|
|
35
34
|
}
|