@sanity/plugin-kit 2.2.0 → 3.1.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.
Files changed (228) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +53 -38
  3. package/assets/inject/semver-workflow/lint-staged.template.js +1 -1
  4. package/bin/plugin-kit.js +2 -0
  5. package/dist/_chunks/cli-dbe00b65.js +162 -0
  6. package/dist/_chunks/cli-dbe00b65.js.map +1 -0
  7. package/dist/_chunks/init-2a3b4528.js +104 -0
  8. package/dist/_chunks/init-2a3b4528.js.map +1 -0
  9. package/dist/_chunks/init-7cd30f64.js +952 -0
  10. package/dist/_chunks/init-7cd30f64.js.map +1 -0
  11. package/dist/_chunks/inject-f8928379.js +49 -0
  12. package/dist/_chunks/inject-f8928379.js.map +1 -0
  13. package/dist/_chunks/link-watch-9e3f1174.js +94 -0
  14. package/dist/_chunks/link-watch-9e3f1174.js.map +1 -0
  15. package/dist/_chunks/package-bdb22a22.js +2314 -0
  16. package/dist/_chunks/package-bdb22a22.js.map +1 -0
  17. package/dist/_chunks/package-f79f12a7.js +152 -0
  18. package/dist/_chunks/package-f79f12a7.js.map +1 -0
  19. package/dist/_chunks/ts-5747e004.js +167 -0
  20. package/dist/_chunks/ts-5747e004.js.map +1 -0
  21. package/dist/_chunks/verify-package-73b843df.js +98 -0
  22. package/dist/_chunks/verify-package-73b843df.js.map +1 -0
  23. package/dist/_chunks/verify-studio-5e333969.js +75 -0
  24. package/dist/_chunks/verify-studio-5e333969.js.map +1 -0
  25. package/dist/_chunks/version-f89917d7.js +58 -0
  26. package/dist/_chunks/version-f89917d7.js.map +1 -0
  27. package/dist/cli.js +9 -0
  28. package/dist/cli.js.map +1 -0
  29. package/dist/index.d.ts +1 -0
  30. package/dist/index.js +2 -0
  31. package/dist/index.js.map +1 -0
  32. package/package.json +29 -17
  33. package/src/actions/init.ts +2 -0
  34. package/src/actions/inject.ts +66 -87
  35. package/src/actions/link-watch.ts +8 -5
  36. package/src/actions/verify/types.ts +0 -23
  37. package/src/actions/verify/validations.ts +142 -39
  38. package/src/actions/verify/verify-common.ts +5 -4
  39. package/src/actions/verify-package.ts +21 -7
  40. package/src/actions/verify-studio.ts +7 -4
  41. package/src/cli.ts +1 -3
  42. package/src/cmds/index.ts +18 -6
  43. package/src/cmds/inject.ts +5 -2
  44. package/src/cmds/link-watch.ts +0 -1
  45. package/src/configs/default-source.ts +10 -14
  46. package/src/configs/eslint.ts +51 -0
  47. package/src/configs/forced-package-versions.ts +8 -7
  48. package/src/configs/git.ts +68 -0
  49. package/src/configs/pkg-config.ts +31 -0
  50. package/src/configs/prettier.ts +11 -0
  51. package/src/configs/tsconfig.ts +79 -0
  52. package/src/configs/uselessFiles.ts +1 -1
  53. package/src/constants.ts +2 -0
  54. package/src/index.ts +1 -4
  55. package/src/npm/package.ts +62 -26
  56. package/src/presets/presets.ts +2 -1
  57. package/src/presets/renovatebot.ts +10 -1
  58. package/src/presets/semver-workflow.ts +26 -14
  59. package/src/presets/ui-workshop.ts +28 -12
  60. package/src/presets/ui.ts +68 -0
  61. package/src/sanity/manifest.ts +2 -2
  62. package/src/util/files.ts +8 -8
  63. package/src/util/readme.ts +17 -15
  64. package/src/util/ts.ts +13 -0
  65. package/assets/inject/gitignore +0 -57
  66. package/assets/inject/package.config.template +0 -16
  67. package/assets/inject/template-tsconfig.json +0 -24
  68. package/lib/package.json +0 -129
  69. package/lib/src/actions/init.d.ts +0 -73
  70. package/lib/src/actions/init.js +0 -79
  71. package/lib/src/actions/init.js.map +0 -1
  72. package/lib/src/actions/inject.d.ts +0 -31
  73. package/lib/src/actions/inject.js +0 -350
  74. package/lib/src/actions/inject.js.map +0 -1
  75. package/lib/src/actions/link-watch.d.ts +0 -3
  76. package/lib/src/actions/link-watch.js +0 -87
  77. package/lib/src/actions/link-watch.js.map +0 -1
  78. package/lib/src/actions/verify/types.d.ts +0 -75
  79. package/lib/src/actions/verify/types.js +0 -3
  80. package/lib/src/actions/verify/types.js.map +0 -1
  81. package/lib/src/actions/verify/validations.d.ts +0 -27
  82. package/lib/src/actions/verify/validations.js +0 -410
  83. package/lib/src/actions/verify/validations.js.map +0 -1
  84. package/lib/src/actions/verify/verify-common.d.ts +0 -44
  85. package/lib/src/actions/verify/verify-common.js +0 -89
  86. package/lib/src/actions/verify/verify-common.js.map +0 -1
  87. package/lib/src/actions/verify-package.d.ts +0 -5
  88. package/lib/src/actions/verify-package.js +0 -73
  89. package/lib/src/actions/verify-package.js.map +0 -1
  90. package/lib/src/actions/verify-studio.d.ts +0 -5
  91. package/lib/src/actions/verify-studio.js +0 -55
  92. package/lib/src/actions/verify-studio.js.map +0 -1
  93. package/lib/src/cli.d.ts +0 -2
  94. package/lib/src/cli.js +0 -87
  95. package/lib/src/cli.js.map +0 -1
  96. package/lib/src/cmds/index.d.ts +0 -9
  97. package/lib/src/cmds/index.js +0 -11
  98. package/lib/src/cmds/index.js.map +0 -1
  99. package/lib/src/cmds/init.d.ts +0 -4
  100. package/lib/src/cmds/init.js +0 -95
  101. package/lib/src/cmds/init.js.map +0 -1
  102. package/lib/src/cmds/inject.d.ts +0 -4
  103. package/lib/src/cmds/inject.js +0 -76
  104. package/lib/src/cmds/inject.js.map +0 -1
  105. package/lib/src/cmds/link-watch.d.ts +0 -4
  106. package/lib/src/cmds/link-watch.js +0 -49
  107. package/lib/src/cmds/link-watch.js.map +0 -1
  108. package/lib/src/cmds/verify-package.d.ts +0 -4
  109. package/lib/src/cmds/verify-package.js +0 -38
  110. package/lib/src/cmds/verify-package.js.map +0 -1
  111. package/lib/src/cmds/verify-studio.d.ts +0 -4
  112. package/lib/src/cmds/verify-studio.js +0 -38
  113. package/lib/src/cmds/verify-studio.js.map +0 -1
  114. package/lib/src/cmds/verify.d.ts +0 -0
  115. package/lib/src/cmds/verify.js +0 -42
  116. package/lib/src/cmds/verify.js.map +0 -1
  117. package/lib/src/cmds/version.d.ts +0 -4
  118. package/lib/src/cmds/version.js +0 -55
  119. package/lib/src/cmds/version.js.map +0 -1
  120. package/lib/src/configs/banned-packages.d.ts +0 -2
  121. package/lib/src/configs/banned-packages.js +0 -30
  122. package/lib/src/configs/banned-packages.js.map +0 -1
  123. package/lib/src/configs/buildExtensions.d.ts +0 -1
  124. package/lib/src/configs/buildExtensions.js +0 -5
  125. package/lib/src/configs/buildExtensions.js.map +0 -1
  126. package/lib/src/configs/default-source.d.ts +0 -3
  127. package/lib/src/configs/default-source.js +0 -70
  128. package/lib/src/configs/default-source.js.map +0 -1
  129. package/lib/src/configs/forced-package-versions.d.ts +0 -16
  130. package/lib/src/configs/forced-package-versions.js +0 -14
  131. package/lib/src/configs/forced-package-versions.js.map +0 -1
  132. package/lib/src/configs/uselessFiles.d.ts +0 -1
  133. package/lib/src/configs/uselessFiles.js +0 -33
  134. package/lib/src/configs/uselessFiles.js.map +0 -1
  135. package/lib/src/constants.d.ts +0 -11
  136. package/lib/src/constants.js +0 -15
  137. package/lib/src/constants.js.map +0 -1
  138. package/lib/src/dependencies/find.d.ts +0 -0
  139. package/lib/src/dependencies/find.js +0 -195
  140. package/lib/src/dependencies/find.js.map +0 -1
  141. package/lib/src/dependencies/import-linter.d.ts +0 -3
  142. package/lib/src/dependencies/import-linter.js +0 -112
  143. package/lib/src/dependencies/import-linter.js.map +0 -1
  144. package/lib/src/index.d.ts +0 -2
  145. package/lib/src/index.js +0 -6
  146. package/lib/src/index.js.map +0 -1
  147. package/lib/src/npm/manager.d.ts +0 -7
  148. package/lib/src/npm/manager.js +0 -62
  149. package/lib/src/npm/manager.js.map +0 -1
  150. package/lib/src/npm/package.d.ts +0 -11
  151. package/lib/src/npm/package.js +0 -302
  152. package/lib/src/npm/package.js.map +0 -1
  153. package/lib/src/npm/publish.d.ts +0 -1
  154. package/lib/src/npm/publish.js +0 -14
  155. package/lib/src/npm/publish.js.map +0 -1
  156. package/lib/src/npm/resolveLatestVersions.d.ts +0 -3
  157. package/lib/src/npm/resolveLatestVersions.js +0 -37
  158. package/lib/src/npm/resolveLatestVersions.js.map +0 -1
  159. package/lib/src/presets/presets.d.ts +0 -8
  160. package/lib/src/presets/presets.js +0 -53
  161. package/lib/src/presets/presets.js.map +0 -1
  162. package/lib/src/presets/renovatebot.d.ts +0 -2
  163. package/lib/src/presets/renovatebot.js +0 -24
  164. package/lib/src/presets/renovatebot.js.map +0 -1
  165. package/lib/src/presets/semver-workflow.d.ts +0 -8
  166. package/lib/src/presets/semver-workflow.js +0 -166
  167. package/lib/src/presets/semver-workflow.js.map +0 -1
  168. package/lib/src/presets/ui-workshop.d.ts +0 -2
  169. package/lib/src/presets/ui-workshop.js +0 -88
  170. package/lib/src/presets/ui-workshop.js.map +0 -1
  171. package/lib/src/sanity/manifest.d.ts +0 -48
  172. package/lib/src/sanity/manifest.js +0 -263
  173. package/lib/src/sanity/manifest.js.map +0 -1
  174. package/lib/src/sharedFlags.d.ts +0 -15
  175. package/lib/src/sharedFlags.js +0 -17
  176. package/lib/src/sharedFlags.js.map +0 -1
  177. package/lib/src/util/command-parser.d.ts +0 -9
  178. package/lib/src/util/command-parser.js +0 -46
  179. package/lib/src/util/command-parser.js.map +0 -1
  180. package/lib/src/util/errorToUndefined.d.ts +0 -1
  181. package/lib/src/util/errorToUndefined.js +0 -11
  182. package/lib/src/util/errorToUndefined.js.map +0 -1
  183. package/lib/src/util/files.d.ts +0 -36
  184. package/lib/src/util/files.js +0 -264
  185. package/lib/src/util/files.js.map +0 -1
  186. package/lib/src/util/log.d.ts +0 -14
  187. package/lib/src/util/log.js +0 -36
  188. package/lib/src/util/log.js.map +0 -1
  189. package/lib/src/util/prompt.d.ts +0 -14
  190. package/lib/src/util/prompt.js +0 -75
  191. package/lib/src/util/prompt.js.map +0 -1
  192. package/lib/src/util/readme.d.ts +0 -8
  193. package/lib/src/util/readme.js +0 -92
  194. package/lib/src/util/readme.js.map +0 -1
  195. package/lib/src/util/request.d.ts +0 -1
  196. package/lib/src/util/request.js +0 -19
  197. package/lib/src/util/request.js.map +0 -1
  198. package/lib/src/util/user.d.ts +0 -13
  199. package/lib/src/util/user.js +0 -111
  200. package/lib/src/util/user.js.map +0 -1
  201. package/lib/test/cli.test.d.ts +0 -1
  202. package/lib/test/cli.test.js +0 -64
  203. package/lib/test/cli.test.js.map +0 -1
  204. package/lib/test/fixture-utils.d.ts +0 -25
  205. package/lib/test/fixture-utils.js +0 -67
  206. package/lib/test/fixture-utils.js.map +0 -1
  207. package/lib/test/init-verify-build.test.d.ts +0 -1
  208. package/lib/test/init-verify-build.test.js +0 -68
  209. package/lib/test/init-verify-build.test.js.map +0 -1
  210. package/lib/test/init.test.d.ts +0 -1
  211. package/lib/test/init.test.js +0 -169
  212. package/lib/test/init.test.js.map +0 -1
  213. package/lib/test/inject.test.d.ts +0 -1
  214. package/lib/test/inject.test.js +0 -75
  215. package/lib/test/inject.test.js.map +0 -1
  216. package/lib/test/run-test-command.d.ts +0 -1
  217. package/lib/test/run-test-command.js +0 -6
  218. package/lib/test/run-test-command.js.map +0 -1
  219. package/lib/test/semver-workflow.test.d.ts +0 -1
  220. package/lib/test/semver-workflow.test.js +0 -93
  221. package/lib/test/semver-workflow.test.js.map +0 -1
  222. package/lib/test/verify-package.test.d.ts +0 -1
  223. package/lib/test/verify-package.test.js +0 -87
  224. package/lib/test/verify-package.test.js.map +0 -1
  225. package/lib/test/version.test.d.ts +0 -1
  226. package/lib/test/version.test.js +0 -48
  227. package/lib/test/version.test.js.map +0 -1
  228. package/src/cmds/verify.ts +0 -40
@@ -1,42 +0,0 @@
1
- "use strict";
2
- /*
3
- import path from 'path'
4
- import meow from 'meow'
5
- import pkg from '../../package.json'
6
- import {verify} from '../actions/verify'
7
- import sharedFlags from '../sharedFlags'
8
-
9
- const description = `Verify that a Sanity plugin is ready for publishing`
10
-
11
- const help = `
12
- Usage
13
- $ ${pkg.binname} verify [<dir>]
14
-
15
- Examples
16
- # Verify the plugin in the current directory
17
- $ ${pkg.binname} verify
18
-
19
- # Verify the plugin in ~/my-plugin
20
- $ ${pkg.binname} verify ~/my-plugin
21
-
22
- # Allow package.json to reference files inside the uncompiled source folder
23
- $ ${pkg.binname} verify --allow-source-target
24
- `
25
-
26
- const flags = {
27
- ...sharedFlags,
28
- allowSourceTarget: {
29
- type: 'boolean',
30
- default: false,
31
- },
32
- } as const
33
-
34
- function run({argv}: {argv: string[]}) {
35
- const cli = meow(help, {flags, argv, description})
36
- const basePath = path.resolve(cli.input[0] || process.cwd())
37
- return verify({basePath, flags: cli.flags})
38
- }
39
-
40
- export default run
41
- */
42
- //# sourceMappingURL=verify.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"verify.js","sourceRoot":"","sources":["../../../src/cmds/verify.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuCE"}
@@ -1,4 +0,0 @@
1
- declare function run({ argv }: {
2
- argv: string[];
3
- }): void;
4
- export default run;
@@ -1,55 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const meow_1 = __importDefault(require("meow"));
7
- const package_json_1 = __importDefault(require("../../package.json"));
8
- const log_1 = __importDefault(require("../util/log"));
9
- const sharedFlags_1 = __importDefault(require("../sharedFlags"));
10
- const description = `Show the installed version of ${package_json_1.default.name}`;
11
- const help = `
12
- Usage
13
- $ ${package_json_1.default.binname} version
14
-
15
- Options
16
- --major Show only the major version
17
- --minor Show only the minor version
18
- --patch Show only the patch version
19
-
20
- Examples
21
- $ ${package_json_1.default.binname} version
22
- ${package_json_1.default.name} version ${package_json_1.default.version}
23
-
24
- $ ${package_json_1.default.binname} version --major
25
- ${package_json_1.default.version.split('.')[0]}
26
- `;
27
- const flags = Object.assign(Object.assign({}, sharedFlags_1.default), { major: {
28
- type: 'boolean',
29
- default: false,
30
- }, minor: {
31
- type: 'boolean',
32
- default: false,
33
- }, patch: {
34
- type: 'boolean',
35
- default: false,
36
- } });
37
- function run({ argv }) {
38
- const cli = (0, meow_1.default)(help, { flags, argv, description });
39
- const versionParts = package_json_1.default.version.split('.');
40
- const versionNames = ['major', 'minor', 'patch'];
41
- const versionFlags = versionNames.filter((flagName) => cli.flags[flagName]);
42
- const versionFlag = versionFlags[0];
43
- const numVersionFlags = versionFlags.length;
44
- if (numVersionFlags === 0) {
45
- log_1.default.msg(`${package_json_1.default.name} version ${package_json_1.default.version}`);
46
- return;
47
- }
48
- if (numVersionFlags > 1) {
49
- throw new Error(`--major, --minor and --patch are mutually exclusive - only one can be used at a time`);
50
- }
51
- const partIndex = versionNames.indexOf(versionFlag);
52
- log_1.default.msg(versionParts[partIndex]);
53
- }
54
- exports.default = run;
55
- //# sourceMappingURL=version.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["../../../src/cmds/version.ts"],"names":[],"mappings":";;;;;AAAA,gDAAuB;AACvB,sEAAoC;AACpC,sDAA6B;AAC7B,iEAAwC;AAExC,MAAM,WAAW,GAAG,iCAAiC,sBAAG,CAAC,IAAI,EAAE,CAAA;AAE/D,MAAM,IAAI,GAAG;;MAEP,sBAAG,CAAC,OAAO;;;;;;;;MAQX,sBAAG,CAAC,OAAO;IACb,sBAAG,CAAC,IAAI,YAAY,sBAAG,CAAC,OAAO;;MAE7B,sBAAG,CAAC,OAAO;IACb,sBAAG,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAC5B,CAAA;AAED,MAAM,KAAK,GAAG,gCACT,qBAAW,KAEd,KAAK,EAAE;QACL,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;KACf,EAED,KAAK,EAAE;QACL,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;KACf,EAED,KAAK,EAAE;QACL,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;KACf,GACO,CAAA;AAEV,SAAS,GAAG,CAAC,EAAC,IAAI,EAAmB;IACnC,MAAM,GAAG,GAAG,IAAA,cAAI,EAAC,IAAI,EAAE,EAAC,KAAK,EAAE,IAAI,EAAE,WAAW,EAAC,CAAC,CAAA;IAClD,MAAM,YAAY,GAAG,sBAAG,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC3C,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;IAChD,MAAM,YAAY,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;IAC3E,MAAM,WAAW,GAAG,YAAY,CAAC,CAAC,CAAC,CAAA;IACnC,MAAM,eAAe,GAAG,YAAY,CAAC,MAAM,CAAA;IAE3C,IAAI,eAAe,KAAK,CAAC,EAAE;QACzB,aAAG,CAAC,GAAG,CAAC,GAAG,sBAAG,CAAC,IAAI,YAAY,sBAAG,CAAC,OAAO,EAAE,CAAC,CAAA;QAC7C,OAAM;KACP;IAED,IAAI,eAAe,GAAG,CAAC,EAAE;QACvB,MAAM,IAAI,KAAK,CACb,sFAAsF,CACvF,CAAA;KACF;IAED,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;IACnD,aAAG,CAAC,GAAG,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,CAAA;AAClC,CAAC;AAED,kBAAe,GAAG,CAAA"}
@@ -1,2 +0,0 @@
1
- export declare const mergedPackages: string[];
2
- export declare const deprecatedDevDeps: string[];
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deprecatedDevDeps = exports.mergedPackages = void 0;
4
- exports.mergedPackages = [
5
- '@sanity/base',
6
- '@sanity/core',
7
- '@sanity/types',
8
- '@sanity/data-aspects',
9
- '@sanity/default-layout',
10
- '@sanity/default-login',
11
- '@sanity/desk-tool',
12
- '@sanity/field',
13
- '@sanity/form-builder',
14
- '@sanity/initial-value-templates',
15
- '@sanity/language-filter',
16
- '@sanity/production-preview',
17
- '@sanity/react-hooks',
18
- '@sanity/resolver',
19
- '@sanity/state-router',
20
- '@sanity/structure',
21
- '@sanity/studio-hints',
22
- ].sort();
23
- exports.deprecatedDevDeps = [
24
- 'tsdx',
25
- 'sanipack',
26
- 'parcel',
27
- '@parcel/packager-ts',
28
- '@parcel/transformer-typescript-types',
29
- ];
30
- //# sourceMappingURL=banned-packages.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"banned-packages.js","sourceRoot":"","sources":["../../../src/configs/banned-packages.ts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GAAG;IAC5B,cAAc;IACd,cAAc;IACd,eAAe;IACf,sBAAsB;IACtB,wBAAwB;IACxB,uBAAuB;IACvB,mBAAmB;IACnB,eAAe;IACf,sBAAsB;IACtB,iCAAiC;IACjC,yBAAyB;IACzB,4BAA4B;IAC5B,qBAAqB;IACrB,kBAAkB;IAClB,sBAAsB;IACtB,mBAAmB;IACnB,sBAAsB;CACvB,CAAC,IAAI,EAAE,CAAA;AAEK,QAAA,iBAAiB,GAAG;IAC/B,MAAM;IACN,UAAU;IACV,QAAQ;IACR,qBAAqB;IACrB,sCAAsC;CACvC,CAAA"}
@@ -1 +0,0 @@
1
- export declare const buildExtensions: string[];
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildExtensions = void 0;
4
- exports.buildExtensions = ['.js', '.jsx', '.es6', '.es', '.mjs', '.ts', '.tsx'];
5
- //# sourceMappingURL=buildExtensions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"buildExtensions.js","sourceRoot":"","sources":["../../../src/configs/buildExtensions.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA"}
@@ -1,3 +0,0 @@
1
- import { PackageJson } from '../actions/verify/types';
2
- export declare function defaultSourceJs(pkg: PackageJson): string;
3
- export declare function defaultSourceTs(pkg: PackageJson): string;
@@ -1,70 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.defaultSourceTs = exports.defaultSourceJs = void 0;
7
- const outdent_1 = __importDefault(require("outdent"));
8
- function defaultSourceJs(pkg) {
9
- return ((0, outdent_1.default) `
10
- import {definePlugin} from 'sanity'
11
-
12
- /**
13
- * ## Usage in sanity.config.js (or .js)
14
- *
15
- * \`\`\`
16
- * import {defineConfig} from 'sanity'
17
- * import {myPlugin} from '${pkg.name}'
18
- *
19
- * export const defineConfig({
20
- * //...
21
- * plugins: [
22
- * myPlugin({})
23
- * ]
24
- * })
25
- * \`\`\`
26
- */
27
- export const myPlugin = definePlugin((config = {}) => {
28
- // eslint-disable-next-line no-console
29
- console.log(\`hello from ${pkg.name}\`)
30
- return {
31
- name: '${pkg.name}',
32
- }
33
- })
34
- `.trimStart() + '\n');
35
- }
36
- exports.defaultSourceJs = defaultSourceJs;
37
- function defaultSourceTs(pkg) {
38
- return ((0, outdent_1.default) `
39
- import {definePlugin} from 'sanity'
40
-
41
- interface MyPluginConfig {
42
- /* nothing here yet */
43
- }
44
-
45
- /**
46
- * ## Usage in sanity.config.ts (or .js)
47
- *
48
- * \`\`\`
49
- * import {defineConfig} from 'sanity'
50
- * import {myPlugin} from '${pkg.name}'
51
- *
52
- * export const defineConfig({
53
- * //...
54
- * plugins: [
55
- * myPlugin()
56
- * ]
57
- * })
58
- * \`\`\`
59
- */
60
- export const myPlugin = definePlugin<MyPluginConfig | void>((config = {}) => {
61
- // eslint-disable-next-line no-console
62
- console.log('hello from ${pkg.name}')
63
- return {
64
- name: '${pkg.name}',
65
- }
66
- })
67
- `.trimStart() + '\n');
68
- }
69
- exports.defaultSourceTs = defaultSourceTs;
70
- //# sourceMappingURL=default-source.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"default-source.js","sourceRoot":"","sources":["../../../src/configs/default-source.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA6B;AAG7B,SAAgB,eAAe,CAAC,GAAgB;IAC9C,OAAO,CACL,IAAA,iBAAO,EAAA;;;;;;;;+BAQoB,GAAG,CAAC,IAAI;;;;;;;;;;;;+BAYR,GAAG,CAAC,IAAI;;eAExB,GAAG,CAAC,IAAI;;;CAGtB,CAAC,SAAS,EAAE,GAAG,IAAI,CACjB,CAAA;AACH,CAAC;AA7BD,0CA6BC;AAED,SAAgB,eAAe,CAAC,GAAgB;IAC9C,OAAO,CACL,IAAA,iBAAO,EAAA;;;;;;;;;;;;+BAYoB,GAAG,CAAC,IAAI;;;;;;;;;;;;8BAYT,GAAG,CAAC,IAAI;;eAEvB,GAAG,CAAC,IAAI;;;CAGtB,CAAC,SAAS,EAAE,GAAG,IAAI,CACjB,CAAA;AACH,CAAC;AAjCD,0CAiCC"}
@@ -1,16 +0,0 @@
1
- export declare const forcedPackageVersions: {
2
- react: string;
3
- '@types/react': string;
4
- 'react-dom': string;
5
- '@types/react-dom': string;
6
- sanity: string;
7
- '@sanity/ui': string;
8
- };
9
- export declare const forcedDevPackageVersions: {
10
- react: string;
11
- '@types/react': string;
12
- 'react-dom': string;
13
- '@types/react-dom': string;
14
- sanity: string;
15
- '@sanity/ui': string;
16
- };
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.forcedDevPackageVersions = exports.forcedPackageVersions = void 0;
4
- const sanityVersion = '^3.0.0';
5
- exports.forcedPackageVersions = {
6
- react: '^18',
7
- '@types/react': '^18',
8
- 'react-dom': '^18',
9
- '@types/react-dom': '^18',
10
- sanity: sanityVersion,
11
- '@sanity/ui': '^1.0.0',
12
- };
13
- exports.forcedDevPackageVersions = exports.forcedPackageVersions;
14
- //# sourceMappingURL=forced-package-versions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"forced-package-versions.js","sourceRoot":"","sources":["../../../src/configs/forced-package-versions.ts"],"names":[],"mappings":";;;AAAA,MAAM,aAAa,GAAG,QAAQ,CAAA;AAEjB,QAAA,qBAAqB,GAAG;IACnC,KAAK,EAAE,KAAK;IACZ,cAAc,EAAE,KAAK;IACrB,WAAW,EAAE,KAAK;IAClB,kBAAkB,EAAE,KAAK;IACzB,MAAM,EAAE,aAAa;IACrB,YAAY,EAAE,QAAQ;CACvB,CAAA;AAEY,QAAA,wBAAwB,GAAG,6BAAqB,CAAA"}
@@ -1 +0,0 @@
1
- export declare const uselessFiles: string[];
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.uselessFiles = void 0;
4
- exports.uselessFiles = [
5
- '.babel.config.js',
6
- '.babelrc',
7
- '.drone.yml',
8
- '.editorconfig',
9
- '.eslintignore',
10
- '.eslintrc-ts.js',
11
- '.eslintrc-ts',
12
- '.eslintrc',
13
- '.gitignore',
14
- '.github',
15
- '.nyc_output',
16
- '.prettierrc.json',
17
- '.stylelintignore',
18
- '.stylelintrc.json',
19
- '.stylelintrc',
20
- '.travis.yaml',
21
- '.travis.yml',
22
- 'babel.config.js',
23
- 'coverage',
24
- 'gulpfile.js',
25
- 'lcov-report',
26
- 'lerna.json',
27
- 'now.json',
28
- 'vercel.json',
29
- 'netlify.toml',
30
- 'postcss.config.js',
31
- 'tsconfig.json',
32
- ];
33
- //# sourceMappingURL=uselessFiles.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"uselessFiles.js","sourceRoot":"","sources":["../../../src/configs/uselessFiles.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG;IAC1B,kBAAkB;IAClB,UAAU;IACV,YAAY;IACZ,eAAe;IACf,eAAe;IACf,iBAAiB;IACjB,cAAc;IACd,WAAW;IACX,YAAY;IACZ,SAAS;IACT,aAAa;IACb,kBAAkB;IAClB,kBAAkB;IAClB,mBAAmB;IACnB,cAAc;IACd,cAAc;IACd,aAAa;IACb,iBAAiB;IACjB,UAAU;IACV,aAAa;IACb,aAAa;IACb,YAAY;IACZ,UAAU;IACV,aAAa;IACb,cAAc;IACd,mBAAmB;IACnB,eAAe;CAChB,CAAA"}
@@ -1,11 +0,0 @@
1
- export declare const cliName = "@sanity/plugin-kit";
2
- export declare const urls: {
3
- refDocs: string;
4
- migrationGuideStudio: string;
5
- migrationGuidePlugin: string;
6
- pluginReadme: string;
7
- incompatiblePlugin: string;
8
- sanityExchange: string;
9
- linterPackage: string;
10
- };
11
- export declare const incompatiblePluginPackage = "@sanity/incompatible-plugin";
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.incompatiblePluginPackage = exports.urls = exports.cliName = void 0;
4
- exports.cliName = '@sanity/plugin-kit';
5
- exports.urls = {
6
- refDocs: 'https://beta.sanity.io/docs/reference',
7
- migrationGuideStudio: 'https://beta.sanity.io/docs/platform/v2-to-v3',
8
- migrationGuidePlugin: 'https://beta.sanity.io/docs/platform/v2-to-v3/plugins',
9
- pluginReadme: 'https://github.com/sanity-io/plugin-kit',
10
- incompatiblePlugin: 'https://github.com/sanity-io/incompatible-plugin',
11
- sanityExchange: 'https://www.sanity.io/exchange',
12
- linterPackage: 'https://github.com/sanity-io/eslint-config-no-v2-imports',
13
- };
14
- exports.incompatiblePluginPackage = '@sanity/incompatible-plugin';
15
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,oBAAoB,CAAA;AAE9B,QAAA,IAAI,GAAG;IAClB,OAAO,EAAE,uCAAuC;IAChD,oBAAoB,EAAE,+CAA+C;IACrE,oBAAoB,EAAE,uDAAuD;IAC7E,YAAY,EAAE,yCAAyC;IACvD,kBAAkB,EAAE,kDAAkD;IACtE,cAAc,EAAE,gCAAgC;IAChD,aAAa,EAAE,0DAA0D;CAC1E,CAAA;AAEY,QAAA,yBAAyB,GAAG,6BAA6B,CAAA"}
File without changes
@@ -1,195 +0,0 @@
1
- "use strict";
2
- /*
3
- import fs from 'fs'
4
- import path from 'path'
5
- import postcss from 'postcss'
6
- import {discoverPathSync} from 'discover-path'
7
- import traverse from '@babel/traverse'
8
- import {parseSync} from '@babel/core'
9
-
10
- export default {findDependencies}
11
-
12
- const partReg = /^(all:part|part|config|sanity):/
13
- const importReg = /^(?:"([^"]+)"|'([^']+)')$/
14
- const composesReg = /^(.+?)\s+from\s+(?:"([^"]+)"|'([^']+)'|(global))$/
15
-
16
- function findDependenciesFromFiles(files, seen = new Set<string>()): string[] {
17
- const dependencies = new Set<string>()
18
- files.forEach((file) => findDependencies(file, seen).forEach((dep) => dependencies.add(dep)))
19
- return Array.from(dependencies)
20
- }
21
-
22
- function findDependenciesInCss(css, entryPath, processDependency) {
23
- let ast
24
- try {
25
- ast = postcss.parse(css)
26
- } catch (err: any) {
27
- throw new Error(`Error parsing file (${entryPath}): ${err.message}`)
28
- }
29
-
30
- ast.walkDecls(/^composes/, (decl) => {
31
- const matches = decl.value.match(composesReg)
32
- if (!matches) {
33
- return
34
- }
35
-
36
- const [, , doubleQuotePath, singleQuotePath] = matches
37
- const importPath = doubleQuotePath || singleQuotePath
38
- if (importPath) {
39
- processDependency(importPath)
40
- }
41
- })
42
-
43
- ast.walkAtRules('import', (rule) => {
44
- const matches = rule.params.match(importReg)
45
- if (!matches) {
46
- return
47
- }
48
-
49
- const [, doubleQuotePath, singleQuotePath] = matches
50
- const importPath = doubleQuotePath || singleQuotePath
51
- if (importPath) {
52
- processDependency(importPath)
53
- }
54
- })
55
- }
56
-
57
- interface Traverse {
58
- node: {callee: {name: string}; source: {value: string}; arguments: {value: string}[]}
59
- }
60
-
61
- function findDependenciesInJs(
62
- js: string,
63
- entryPath: string,
64
- processDependency: (val: string) => void
65
- ) {
66
- let ast
67
- try {
68
- ast = parseSync(js, {babelrc: false})
69
- } catch (err: any) {
70
- throw new Error(`Error parsing file (${entryPath}): ${err.message}`)
71
- }
72
-
73
- traverse(ast, {
74
- ImportDeclaration({node}: Traverse) {
75
- processDependency(node.source.value)
76
- },
77
-
78
- CallExpression({node}: Traverse) {
79
- if (node.callee.name === 'require') {
80
- processDependency(node.arguments[0].value)
81
- }
82
- },
83
- })
84
- }
85
-
86
- export function findDependencies(entryPath: string, seen = new Set<string>()): string[] {
87
- if (Array.isArray(entryPath)) {
88
- return findDependenciesFromFiles(entryPath, seen)
89
- }
90
-
91
- seen.add(entryPath)
92
-
93
- let content
94
- try {
95
- content = fs.readFileSync(entryPath, 'utf8')
96
- } catch (err: any) {
97
- throw new Error(`Error reading file (${entryPath}): ${err.message}`)
98
- }
99
-
100
- const dir = path.dirname(entryPath)
101
- const dependencies = new Set<string>()
102
-
103
- if (entryPath.endsWith('.css')) {
104
- findDependenciesInCss(content, entryPath, processDependency)
105
- } else {
106
- findDependenciesInJs(content, entryPath, processDependency)
107
- }
108
-
109
- function processDependency(requirePath: string) {
110
- if (typeof requirePath !== 'string') {
111
- return
112
- }
113
-
114
- // Don't allow absolute requires
115
- if (path.isAbsolute(requirePath)) {
116
- throw new Error(
117
- `Absolute paths cannot be used in require/import statements: ${entryPath} references path "${requirePath}"`
118
- )
119
- }
120
-
121
- const isRelative = requirePath.startsWith('.')
122
- const depPath = isRelative && resolveDependency(dir, requirePath, entryPath)
123
-
124
- if (
125
- depPath &&
126
- ['.js', '.css', '.esm', '.mjs', '.jsx'].includes(path.extname(depPath)) &&
127
- !seen.has(depPath)
128
- ) {
129
- // For relative javascript/css requires, recurse to find all depdendencies
130
- findDependencies(depPath, seen).forEach((dep) => dependencies.add(dep))
131
- return
132
- }
133
-
134
- if (isRelative) {
135
- // Not JS? Skip it
136
- return
137
- }
138
-
139
- // For parts, we want the entire path, as we might want to validate them
140
- if (partReg.test(requirePath)) {
141
- dependencies.add(requirePath)
142
- return
143
- }
144
-
145
- // For modules, resolve the base module name, then add them
146
- // eg: `codemirror/mode/javascript` => `codemirror`
147
- // eg: `@sanity/base/foo/bar.js` => `@sanity/base`
148
- const dep = requirePath.startsWith('@')
149
- ? requirePath.replace(/^(@[^/]+\/[^/]+)(\/.*|$)/, '$1')
150
- : requirePath.replace(/^([^/]+)(\/.*|$)/, '$1')
151
-
152
- dependencies.add(dep)
153
- }
154
-
155
- return Array.from(dependencies)
156
- }
157
-
158
- function resolveDependency(fromDir: string, toPath: string, entryPath: string) {
159
- const [querylessPath] = toPath.split('?', 1)
160
-
161
- let depPath
162
- try {
163
- depPath = require.resolve(path.resolve(fromDir, querylessPath))
164
- } catch (err) {
165
- throw new Error(`Unable to resolve "${querylessPath}" from ${entryPath}`)
166
- }
167
-
168
- let actualPath
169
- try {
170
- actualPath = discoverPathSync(depPath)
171
- } catch (err: any) {
172
- const paths = (err.suggestions || []).map((suggested: string) =>
173
- getDidYouMeanPath(querylessPath, suggested)
174
- )
175
- const didYouMean = paths ? `Did you mean:\n${paths.join('\n- ')}` : ''
176
- throw new Error(`Unable to resolve "${querylessPath}" from ${entryPath}. ${didYouMean}`)
177
- }
178
-
179
- if (actualPath !== depPath) {
180
- const didYouMean = getDidYouMeanPath(querylessPath, actualPath)
181
- throw new Error(
182
- `Unable to resolve "${querylessPath} from ${entryPath}. Did you mean "${didYouMean}"?`
183
- )
184
- }
185
-
186
- return actualPath
187
- }
188
-
189
- function getDidYouMeanPath(wanted: string, suggested: string) {
190
- const end = wanted.replace(/[./]+/, '')
191
- const start = wanted.slice(0, 0 - end.length)
192
- return `${start}${suggested.slice(0 - end.length)}`
193
- }
194
- */
195
- //# sourceMappingURL=find.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"find.js","sourceRoot":"","sources":["../../../src/dependencies/find.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgME"}
@@ -1,3 +0,0 @@
1
- export declare function validateImports({ basePath }: {
2
- basePath: string;
3
- }): Promise<string[]>;