@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 +26 -17
- package/dist/_chunks-es/init.js +2 -2
- package/dist/_chunks-es/init2.js +711 -12
- package/dist/_chunks-es/init2.js.map +1 -1
- package/dist/_chunks-es/inject.js +2 -2
- package/dist/_chunks-es/package.js +391 -1084
- package/dist/_chunks-es/package.js.map +1 -1
- package/dist/_chunks-es/package2.js +1 -1
- package/dist/_chunks-es/{ts.js → verify-common.js} +75 -75
- package/dist/_chunks-es/verify-common.js.map +1 -0
- package/dist/_chunks-es/verify-package.js +7 -4
- package/dist/_chunks-es/verify-package.js.map +1 -1
- package/dist/_chunks-es/verify-studio.js +1 -1
- package/dist/_chunks-es/verify-studio.js.map +1 -1
- package/package.json +5 -3
- package/assets/inject/sanity.json +0 -8
- package/assets/inject/ui-workshop/src/CustomField.tsx +0 -15
- package/assets/inject/ui-workshop/src/__workshop__/index.tsx +0 -14
- package/assets/inject/ui-workshop/src/__workshop__/props.tsx +0 -21
- package/assets/inject/ui-workshop/workshop.config.ts +0 -5
- package/assets/inject/v2-incompatible.js.template +0 -11
- package/dist/_chunks-es/ts.js.map +0 -1
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
|
-
-
|
|
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/)
|
package/dist/_chunks-es/init.js
CHANGED
|
@@ -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
|
|
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
|
}
|