@napi-rs/cli 3.8.3 → 3.8.5
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/README.md +7 -4
- package/dist/cli.js +611 -71
- package/dist/index.cjs +612 -72
- package/dist/index.d.cts +34 -3
- package/dist/index.d.ts +34 -3
- package/dist/index.js +611 -71
- package/docs/pre-publish.md +14 -13
- package/package.json +1 -1
- package/src/api/__tests__/__snapshots__/templates.spec.ts.md +768 -9
- package/src/api/__tests__/__snapshots__/templates.spec.ts.snap +0 -0
- package/src/api/__tests__/pre-publish.spec.ts +419 -0
- package/src/api/__tests__/templates.spec.ts +85 -1
- package/src/api/pre-publish.ts +135 -11
- package/src/api/templates/load-wasi-template.ts +499 -13
- package/src/def/pre-publish.ts +13 -0
- package/src/utils/config.ts +34 -1
package/src/utils/config.ts
CHANGED
|
@@ -16,6 +16,17 @@ export type SupportedTestFramework = ValueOfConstArray<
|
|
|
16
16
|
typeof SupportedTestFrameworks
|
|
17
17
|
>
|
|
18
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Package managers that may publish the **root** package, distinguished by
|
|
21
|
+
* whether they rewrite the manifest while packing it.
|
|
22
|
+
*
|
|
23
|
+
* `yarn` means yarn berry (>= 2); Yarn Classic (1.x) packs the raw manifest
|
|
24
|
+
* like npm does and is spelled `yarn-classic`.
|
|
25
|
+
*/
|
|
26
|
+
export const RootPublishers = ['npm', 'pnpm', 'yarn', 'yarn-classic'] as const
|
|
27
|
+
|
|
28
|
+
export type RootPublisher = ValueOfConstArray<typeof RootPublishers>
|
|
29
|
+
|
|
19
30
|
export interface UserNapiConfig {
|
|
20
31
|
/**
|
|
21
32
|
* Name of the binary to be generated, default to `index`
|
|
@@ -37,6 +48,23 @@ export interface UserNapiConfig {
|
|
|
37
48
|
*/
|
|
38
49
|
npmClient?: string
|
|
39
50
|
|
|
51
|
+
/**
|
|
52
|
+
* The package manager that publishes the **root** package.
|
|
53
|
+
*
|
|
54
|
+
* `napi pre-publish` publishes only the generated per-platform packages; the
|
|
55
|
+
* root package is packed and published by the caller, so this cannot be
|
|
56
|
+
* inferred reliably. pnpm and yarn berry replace `exports` with
|
|
57
|
+
* `publishConfig.exports` while packing, so under those publishers
|
|
58
|
+
* `napi pre-publish` validates only the publish-effective export map and the
|
|
59
|
+
* local `exports` may point at development-only sources. npm and Yarn
|
|
60
|
+
* Classic ship `exports` untouched.
|
|
61
|
+
*
|
|
62
|
+
* Unset — the default — validates both maps, which is correct for every
|
|
63
|
+
* publisher but rejects development-only conditions such as
|
|
64
|
+
* `"dev": "./src/index.ts"`.
|
|
65
|
+
*/
|
|
66
|
+
rootPublisher?: RootPublisher
|
|
67
|
+
|
|
40
68
|
/**
|
|
41
69
|
* Whether generate const enum for typescript bindings
|
|
42
70
|
*/
|
|
@@ -182,7 +210,12 @@ export type NapiConfig = Required<
|
|
|
182
210
|
> &
|
|
183
211
|
Pick<
|
|
184
212
|
UserNapiConfig,
|
|
185
|
-
|
|
213
|
+
| 'wasm'
|
|
214
|
+
| 'dtsHeader'
|
|
215
|
+
| 'dtsHeaderFile'
|
|
216
|
+
| 'constEnum'
|
|
217
|
+
| 'runtimeStringEnum'
|
|
218
|
+
| 'rootPublisher'
|
|
186
219
|
> & {
|
|
187
220
|
targets: Target[]
|
|
188
221
|
packageJson: CommonPackageJsonFields
|