@sanity/plugin-kit 6.0.3 → 6.0.4
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/constants.js +12 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.js +72 -4
- package/dist/index.js.map +1 -1
- package/dist/init.js +866 -0
- package/dist/init.js.map +1 -0
- package/dist/init2.js +99 -0
- package/dist/init2.js.map +1 -0
- package/dist/{_chunks-es/inject.js → inject.js} +22 -16
- package/dist/inject.js.map +1 -0
- package/dist/link-watch.js +93 -0
- package/dist/link-watch.js.map +1 -0
- package/dist/load-package-config.js +31 -0
- package/dist/load-package-config.js.map +1 -0
- package/dist/log.js +31 -0
- package/dist/log.js.map +1 -0
- package/dist/package.js +908 -0
- package/dist/package.js.map +1 -0
- package/dist/package2.js +4 -0
- package/dist/package2.js.map +1 -0
- package/dist/verify-common.js +145 -0
- package/dist/verify-common.js.map +1 -0
- package/dist/verify-package.js +89 -0
- package/dist/verify-package.js.map +1 -0
- package/dist/verify-studio.js +65 -0
- package/dist/verify-studio.js.map +1 -0
- package/dist/version.js +54 -0
- package/dist/version.js.map +1 -0
- package/package.json +8 -7
- package/dist/_chunks-es/index.js +0 -125
- package/dist/_chunks-es/index.js.map +0 -1
- package/dist/_chunks-es/init.js +0 -85
- package/dist/_chunks-es/init.js.map +0 -1
- package/dist/_chunks-es/init2.js +0 -839
- package/dist/_chunks-es/init2.js.map +0 -1
- package/dist/_chunks-es/inject.js.map +0 -1
- package/dist/_chunks-es/link-watch.js +0 -91
- package/dist/_chunks-es/link-watch.js.map +0 -1
- package/dist/_chunks-es/load-package-config.js +0 -22
- package/dist/_chunks-es/load-package-config.js.map +0 -1
- package/dist/_chunks-es/package.js +0 -1066
- package/dist/_chunks-es/package.js.map +0 -1
- package/dist/_chunks-es/package2.js +0 -9
- package/dist/_chunks-es/package2.js.map +0 -1
- package/dist/_chunks-es/verify-common.js +0 -169
- package/dist/_chunks-es/verify-common.js.map +0 -1
- package/dist/_chunks-es/verify-package.js +0 -95
- package/dist/_chunks-es/verify-package.js.map +0 -1
- package/dist/_chunks-es/verify-studio.js +0 -61
- package/dist/_chunks-es/verify-studio.js.map +0 -1
- package/dist/_chunks-es/version.js +0 -50
- package/dist/_chunks-es/version.js.map +0 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const cliName = "@sanity/plugin-kit", urls = {
|
|
2
|
+
refDocs: "https://beta.sanity.io/docs/reference",
|
|
3
|
+
migrationGuideStudio: "https://beta.sanity.io/docs/platform/v2-to-v3",
|
|
4
|
+
migrationGuidePlugin: "https://beta.sanity.io/docs/platform/v2-to-v3/plugins",
|
|
5
|
+
pluginReadme: "https://github.com/sanity-io/plugin-kit",
|
|
6
|
+
incompatiblePlugin: "https://github.com/sanity-io/incompatible-plugin",
|
|
7
|
+
sanityExchange: "https://www.sanity.io/exchange",
|
|
8
|
+
linterPackage: "https://github.com/sanity-io/eslint-config-no-v2-imports"
|
|
9
|
+
}, incompatiblePluginPackage = "@sanity/incompatible-plugin", defaultOutDir = "dist", requiredNodeEngine = ">=20.19 <22 || >=22.12";
|
|
10
|
+
export { urls as a, requiredNodeEngine as i, defaultOutDir as n, incompatiblePluginPackage as r, cliName as t };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","names":[],"sources":["../src/constants.ts"],"sourcesContent":["export const cliName = '@sanity/plugin-kit'\n\nexport const urls = {\n refDocs: 'https://beta.sanity.io/docs/reference',\n migrationGuideStudio: 'https://beta.sanity.io/docs/platform/v2-to-v3',\n migrationGuidePlugin: 'https://beta.sanity.io/docs/platform/v2-to-v3/plugins',\n pluginReadme: 'https://github.com/sanity-io/plugin-kit',\n incompatiblePlugin: 'https://github.com/sanity-io/incompatible-plugin',\n sanityExchange: 'https://www.sanity.io/exchange',\n linterPackage: 'https://github.com/sanity-io/eslint-config-no-v2-imports',\n}\n\nexport const incompatiblePluginPackage = '@sanity/incompatible-plugin'\n\nexport const defaultOutDir = 'dist'\n\n/**\n * Minimum major version of `@sanity/pkg-utils` required in userland.\n *\n * plugin-kit loads `package.config.ts` via the plugin's own `@sanity/pkg-utils` (a peer\n * dependency) using the `loadConfig({cwd, pkgPath})` signature introduced in v10. Older majors\n * expose an incompatible `loadConfig({cwd})` and cannot reliably load ESM TypeScript configs.\n */\nexport const minPkgUtilsMajor = 10\n\n/**\n * Required `engines.node` range for plugins, matching `@sanity/pkg-utils` so plugins declare the\n * same Node.js support as the build tool they use.\n */\nexport const requiredNodeEngine = '>=20.19 <22 || >=22.12'\n"],"mappings":"AAAA,MAAa,UAAU,sBAEV,OAAO;CAClB,SAAS;CACT,sBAAsB;CACtB,sBAAsB;CACtB,cAAc;CACd,oBAAoB;CACpB,gBAAgB;CAChB,eAAe;AACjB,GAEa,4BAA4B,+BAE5B,gBAAgB,QAehB,qBAAqB"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,73 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { t as cliName } from "./constants.js";
|
|
2
|
+
import { n as sharedFlags_default, t as log_default } from "./log.js";
|
|
3
|
+
import meow from "meow";
|
|
4
|
+
var cmds_default = {
|
|
5
|
+
init: async (options) => {
|
|
6
|
+
await (await import("./init2.js")).default(options);
|
|
7
|
+
},
|
|
8
|
+
inject: async (options) => {
|
|
9
|
+
await (await import("./inject.js")).default(options);
|
|
10
|
+
},
|
|
11
|
+
"link-watch": async (options) => {
|
|
12
|
+
await (await import("./link-watch.js")).default(options);
|
|
13
|
+
},
|
|
14
|
+
"verify-package": async (options) => {
|
|
15
|
+
await (await import("./verify-package.js")).default(options);
|
|
16
|
+
},
|
|
17
|
+
"verify-studio": async (options) => {
|
|
18
|
+
await (await import("./verify-studio.js")).default(options);
|
|
19
|
+
},
|
|
20
|
+
version: async (options) => {
|
|
21
|
+
(await import("./version.js")).default(options);
|
|
22
|
+
}
|
|
4
23
|
};
|
|
5
|
-
|
|
24
|
+
/** @public */
|
|
25
|
+
async function cliEntry(argv = process.argv) {
|
|
26
|
+
let cli = meow(`
|
|
27
|
+
Usage
|
|
28
|
+
$ ${cliName} [--help] [--debug] <command> [<args>]
|
|
29
|
+
|
|
30
|
+
These are common commands used in various situations:
|
|
31
|
+
|
|
32
|
+
init Create a new Sanity plugin
|
|
33
|
+
inject Inject config into an existing Sanity v3 plugin
|
|
34
|
+
verify-package Check that a Sanity plugin package follows V3 conventions. Prints upgrade steps.
|
|
35
|
+
verify-studio Check that a Sanity Studio follows V3 conventions. Prints upgrade steps.
|
|
36
|
+
link-watch Recompiles plugin automatically on changes and runs yalc push --publish
|
|
37
|
+
version Show the version of ${cliName} currently installed
|
|
38
|
+
|
|
39
|
+
Options
|
|
40
|
+
--silent Do not print info and warning messages
|
|
41
|
+
--verbose Log everything. This option conflicts with --silent
|
|
42
|
+
--debug Print stack trace on errors
|
|
43
|
+
--version Output the version number
|
|
44
|
+
--help Output usage information
|
|
45
|
+
|
|
46
|
+
Examples
|
|
47
|
+
# Init a new plugin in current directory
|
|
48
|
+
$ ${cliName} init
|
|
49
|
+
|
|
50
|
+
# Init a new plugin in my-sanity-plugin directory
|
|
51
|
+
$ ${cliName} init my-sanity-plugin
|
|
52
|
+
|
|
53
|
+
# Check that a Sanity plugin package in current directory follows V3 conventions
|
|
54
|
+
$ ${cliName} verify-package
|
|
55
|
+
|
|
56
|
+
# Check that a Sanity Studio in current directory follows V3 conventions
|
|
57
|
+
$ ${cliName} verify-studio
|
|
58
|
+
`, {
|
|
59
|
+
autoHelp: !1,
|
|
60
|
+
flags: sharedFlags_default,
|
|
61
|
+
argv: argv.slice(2)
|
|
62
|
+
}), commandName = cli.input[0];
|
|
63
|
+
commandName || cli.showHelp(), commandName in cmds_default || (console.error(`Unknown command "${commandName}"`), cli.showHelp()), cli.flags.silent && cli.flags.verbose && (log_default.error("--silent and --verbose are mutually exclusive"), cli.showHelp());
|
|
64
|
+
let cmd = cmds_default[commandName];
|
|
65
|
+
try {
|
|
66
|
+
log_default.setVerbosity(cli.flags), await cmd({ argv: argv.slice(3) });
|
|
67
|
+
} catch (err) {
|
|
68
|
+
log_default.error(err instanceof TypeError || cli.flags.debug ? err.stack : err.message), process.exit(1);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export { cliEntry };
|
|
72
|
+
|
|
73
|
+
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"
|
|
1
|
+
{"version":3,"file":"index.js","names":["sharedFlags","commands"],"sources":["../src/cmds/index.ts","../src/cli.ts"],"sourcesContent":["export default {\n 'init': async (options: {argv: string[]}) => {\n await (await import('./init')).default(options)\n },\n 'inject': async (options: {argv: string[]}) => {\n await (await import('./inject')).default(options)\n },\n 'link-watch': async (options: {argv: string[]}) => {\n await (await import('./link-watch')).default(options)\n },\n 'verify-package': async (options: {argv: string[]}) => {\n await (await import('./verify-package')).default(options)\n },\n 'verify-studio': async (options: {argv: string[]}) => {\n await (await import('./verify-studio')).default(options)\n },\n 'version': async (options: {argv: string[]}) => {\n ;(await import('./version')).default(options)\n },\n}\n","import meow from 'meow'\n\nimport commands from './cmds'\nimport {cliName} from './constants'\nimport sharedFlags from './sharedFlags'\nimport log from './util/log'\n\n/** @public */\nexport async function cliEntry(argv = process.argv) {\n const cli = meow(\n `\n\tUsage\n\t $ ${cliName} [--help] [--debug] <command> [<args>]\n\n These are common commands used in various situations:\n\n init Create a new Sanity plugin\n inject Inject config into an existing Sanity v3 plugin\n verify-package Check that a Sanity plugin package follows V3 conventions. Prints upgrade steps.\n verify-studio Check that a Sanity Studio follows V3 conventions. Prints upgrade steps.\n link-watch Recompiles plugin automatically on changes and runs yalc push --publish\n version Show the version of ${cliName} currently installed\n\n Options\n --silent Do not print info and warning messages\n --verbose Log everything. This option conflicts with --silent\n --debug Print stack trace on errors\n --version Output the version number\n --help Output usage information\n\n Examples\n # Init a new plugin in current directory\n $ ${cliName} init\n\n # Init a new plugin in my-sanity-plugin directory\n $ ${cliName} init my-sanity-plugin\n\n # Check that a Sanity plugin package in current directory follows V3 conventions\n $ ${cliName} verify-package\n\n # Check that a Sanity Studio in current directory follows V3 conventions\n $ ${cliName} verify-studio\n`,\n {\n autoHelp: false,\n flags: sharedFlags,\n argv: argv.slice(2),\n },\n )\n\n const commandName = cli.input[0]\n if (!commandName) {\n cli.showHelp() // Exits\n }\n\n if (!(commandName in commands)) {\n console.error(`Unknown command \"${commandName}\"`)\n cli.showHelp() // Exits\n }\n\n if (cli.flags.silent && cli.flags.verbose) {\n log.error(`--silent and --verbose are mutually exclusive`)\n cli.showHelp() // Exits\n }\n\n // Lazy-load command\n const cmd = commands[commandName as keyof typeof commands]\n\n try {\n log.setVerbosity(cli.flags)\n await cmd({argv: argv.slice(3)})\n } catch (err: any) {\n log.error(err instanceof TypeError || cli.flags.debug ? err.stack : err.message)\n\n process.exit(1)\n }\n}\n"],"mappings":";;;AAAA,IAAA,eAAe;CACb,MAAQ,OAAO,YAA8B;EAC3C,OAAO,MAAM,OAAO,cAAA,CAAW,QAAQ,OAAO;CAChD;CACA,QAAU,OAAO,YAA8B;EAC7C,OAAO,MAAM,OAAO,eAAA,CAAa,QAAQ,OAAO;CAClD;CACA,cAAc,OAAO,YAA8B;EACjD,OAAO,MAAM,OAAO,mBAAA,CAAiB,QAAQ,OAAO;CACtD;CACA,kBAAkB,OAAO,YAA8B;EACrD,OAAO,MAAM,OAAO,uBAAA,CAAqB,QAAQ,OAAO;CAC1D;CACA,iBAAiB,OAAO,YAA8B;EACpD,OAAO,MAAM,OAAO,sBAAA,CAAoB,QAAQ,OAAO;CACzD;CACA,SAAW,OAAO,YAA8B;EAC7C,CAAC,MAAM,OAAO,gBAAA,CAAc,QAAQ,OAAO;CAC9C;AACF;;ACXA,eAAsB,SAAS,OAAO,QAAQ,MAAM;CAClD,IAAM,MAAM,KACV;;OAEG,QAAQ;;;;;;;;;0CAS2B,QAAQ;;;;;;;;;;;QAW1C,QAAQ;;;QAGR,QAAQ;;;QAGR,QAAQ;;;QAGR,QAAQ;GAEZ;EACE,UAAU;EACV,OAAOA;EACP,MAAM,KAAK,MAAM,CAAC;CACpB,CACF,GAEM,cAAc,IAAI,MAAM;CAU9B,AATK,eACH,IAAI,SAAS,GAGT,eAAeC,iBACnB,QAAQ,MAAM,oBAAoB,YAAY,EAAE,GAChD,IAAI,SAAS,IAGX,IAAI,MAAM,UAAU,IAAI,MAAM,YAChC,YAAI,MAAM,+CAA+C,GACzD,IAAI,SAAS;CAIf,IAAM,MAAMA,aAAS;CAErB,IAAI;EAEF,AADA,YAAI,aAAa,IAAI,KAAK,GAC1B,MAAM,IAAI,EAAC,MAAM,KAAK,MAAM,CAAC,EAAC,CAAC;CACjC,SAAS,KAAU;EAGjB,AAFA,YAAI,MAAM,eAAe,aAAa,IAAI,MAAM,QAAQ,IAAI,QAAQ,IAAI,OAAO,GAE/E,QAAQ,KAAK,CAAC;CAChB;AACF"}
|