@sanity/plugin-kit 5.0.2 → 6.0.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.
package/README.md CHANGED
@@ -124,13 +124,13 @@ Verify that the plugin package is configured correctly by running:
124
124
 
125
125
  - Check package.json for:
126
126
  - recommended script commands
127
- - recommended cjs and esm configuration
127
+ - ESM-only configuration (bans CJS `main`/`module` fields and `require` export conditions)
128
128
  - sanity dependency compatibility
129
129
  - @sanity/pkg-utils devDependency
130
130
  - recommended usage of devDependencies/peerDependencies/dependencies for certain packages
131
131
  - Check for redundant v2 config:
132
132
  - babel
133
- - sanity.json
133
+ - the deprecated `@sanity/incompatible-plugin` v2 compatibility shim (`sanity.json` + `v2-incompatible.js`)
134
134
  - Check for sanity imports that has changed in v3, using eslint
135
135
  - Check tsconfig.json settings
136
136
  - Check for [SPDX](https://spdx.org/licenses/) compatible license definition
@@ -206,7 +206,6 @@ The inject command can do more work by adding presets. Consult the individual pr
206
206
  - [semver-workflow](./docs/semver-workflow.md) - Add an opinionated Github workflow to automate NPM releases
207
207
  - [renovatebot](./docs/renovatebot.md) - Add opinionated Renovatebot config to make dependency management a breeze
208
208
  - [ui](./docs/ui.md) - Add [@sanity/ui](https://github.com/sanity-io/ui) to build plugin UIs.
209
- - [ui-workshop](./docs/ui-workshop.md) - Add [@sanity/ui-workshop](https://github.com/sanity-io/ui-workshop) to make component testing a breeze
210
209
 
211
210
  ## Testing a plugin in Sanity Studio
212
211
 
@@ -422,25 +421,35 @@ Provide a sanityPlugin config in package.json (defaults shown):
422
421
  "linkWatch": {
423
422
  "command": "npm run watch",
424
423
  "extensions": "js,png,svg,gif,jpeg,css"
424
+ },
425
+ "verifyPackage": {
426
+ "packageName": true,
427
+ "esmOnly": true,
428
+ "tsconfig": true,
429
+ "tsc": true,
430
+ "dependencies": true,
431
+ "deprecatedDependencies": true,
432
+ "babelConfig": true,
433
+ "incompatiblePlugin": true,
434
+ "eslintImports": true,
435
+ "scripts": true,
436
+ "pkg-utils": true,
437
+ "nodeEngine": true,
438
+ "studioConfig": true,
439
+ "srcIndex": true,
440
+ "bannedFiles": true,
441
+ "duplicateConfig": true
425
442
  }
426
- },
427
- "verifyPackage": {
428
- "packageName": true,
429
- "module": true,
430
- "tsconfig": true,
431
- "tsc": true,
432
- "dependencies": true,
433
- "rollupConfig": true,
434
- "babelConfig": true,
435
- "sanityV2Json": true,
436
- "eslintImports": true,
437
- "scripts": true,
438
- "pkg-utils": true,
439
- "nodeEngine": true
440
443
  }
441
444
  }
442
445
  ```
443
446
 
447
+ Set `esmOnly` to `false` to allow CommonJS interop (a `require` export condition, or top-level
448
+ `main`/`module` fields). This is discouraged: plugins target Sanity Studio v5+, which is pure ESM, and
449
+ shipping a parallel CJS build can have unintended side-effects. The supported Node.js versions handle
450
+ `require(esm)`, so a single published format keeps two copies of the plugin's code out of the module
451
+ tree, avoiding bundle bloat and slower builds.
452
+
444
453
  ## License
445
454
 
446
455
  MIT © [Espen Hovlandsdal](https://espen.codes/) and [Sanity.io](https://www.sanity.io/)
@@ -1,9 +1,9 @@
1
1
  import path from "path";
2
2
  import meow from "meow";
3
- import { initFlags, init } from "./init2.js";
3
+ import { initFlags, init, presetHelpList } from "./init2.js";
4
4
  import { cliName, log } from "./index.js";
5
5
  import execa from "execa";
6
- import { prompt, hasSanityJson, findStudioV3Config, isEmptyish, ensureDir, presetHelpList } from "./package.js";
6
+ import { prompt, hasSanityJson, findStudioV3Config, isEmptyish, ensureDir } from "./package.js";
7
7
  function npmIsAvailable() {
8
8
  return execa("npm", ["-v"]).then(() => !0).catch(() => !1);
9
9
  }