stitch2 0.0.0-stage → 0.7.2

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 (69) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +208 -2
  3. package/config.schema.json +109 -0
  4. package/dist/assets.d.ts +1 -0
  5. package/dist/assets.js +59 -0
  6. package/dist/audit.d.ts +10 -0
  7. package/dist/audit.js +259 -0
  8. package/dist/build-design.d.ts +39 -0
  9. package/dist/build-design.js +337 -0
  10. package/dist/build-elements.d.ts +1 -0
  11. package/dist/build-elements.js +33 -0
  12. package/dist/canvas.html +689 -0
  13. package/dist/check.d.ts +1 -0
  14. package/dist/check.js +86 -0
  15. package/dist/cli.d.ts +2 -0
  16. package/dist/cli.js +73 -0
  17. package/dist/colours.d.ts +2 -0
  18. package/dist/colours.js +57 -0
  19. package/dist/compare.d.ts +1 -0
  20. package/dist/compare.js +185 -0
  21. package/dist/config.d.ts +53 -0
  22. package/dist/config.js +38 -0
  23. package/dist/consistency.d.ts +40 -0
  24. package/dist/consistency.js +336 -0
  25. package/dist/design-md.d.ts +27 -0
  26. package/dist/design-md.js +49 -0
  27. package/dist/design-page.d.ts +1 -0
  28. package/dist/design-page.js +127 -0
  29. package/dist/elements.d.ts +32 -0
  30. package/dist/elements.js +69 -0
  31. package/dist/exports.d.ts +25 -0
  32. package/dist/exports.js +86 -0
  33. package/dist/extract.d.ts +1 -0
  34. package/dist/extract.js +197 -0
  35. package/dist/init.d.ts +5 -0
  36. package/dist/init.js +83 -0
  37. package/dist/list.d.ts +1 -0
  38. package/dist/list.js +17 -0
  39. package/dist/pick.d.ts +10 -0
  40. package/dist/pick.js +38 -0
  41. package/dist/report.d.ts +1 -0
  42. package/dist/report.js +110 -0
  43. package/dist/sandbox.d.ts +1 -0
  44. package/dist/sandbox.js +183 -0
  45. package/dist/screens.d.ts +34 -0
  46. package/dist/screens.js +85 -0
  47. package/dist/serve.d.ts +4 -0
  48. package/dist/serve.js +181 -0
  49. package/dist/setup.d.ts +1 -0
  50. package/dist/setup.js +214 -0
  51. package/dist/tokens.d.ts +1 -0
  52. package/dist/tokens.js +128 -0
  53. package/dist/type.d.ts +1 -0
  54. package/dist/type.js +60 -0
  55. package/dist/typecheck.d.ts +35 -0
  56. package/dist/typecheck.js +112 -0
  57. package/package.json +53 -4
  58. package/skills/stitch2/SKILL.md +80 -0
  59. package/skills/stitch2/references/components.md +59 -0
  60. package/skills/stitch2/references/guides.md +20 -0
  61. package/skills/stitch2/references/principles.md +80 -0
  62. package/skills/stitch2/references/screens.md +70 -0
  63. package/skills/stitch2/references/typography.md +106 -0
  64. package/skills/stitch2-app-sync/SKILL.md +65 -0
  65. package/skills/stitch2-consistency/SKILL.md +59 -0
  66. package/skills/stitch2-design-md/SKILL.md +64 -0
  67. package/skills/stitch2-import-from-google-stitch/SKILL.md +47 -0
  68. package/skills/stitch2-import-from-google-stitch/references/how-stitch-works.md +36 -0
  69. package/skills/stitch2-variants/SKILL.md +45 -0
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Bundles a project's elements entry (the file that calls defineElements from stitch2/elements) into one
3
+ * script for the screens, with esbuild: JSX, TypeScript and the project's own dependencies (React and its
4
+ * components) resolved from the entry's folder.
5
+ * Usage: stitch2 elements <entry> [--out <file>] (default <design>/components/<prefix>.elements.js)
6
+ */
7
+ import { resolve } from 'node:path';
8
+ import { build } from 'esbuild';
9
+ import { BASE, config } from './config.js';
10
+ import { ROOT } from './screens.js';
11
+ const args = process.argv.slice(2);
12
+ const entry = args.find((a) => !a.startsWith('--'));
13
+ if (!entry) {
14
+ console.error('usage: stitch2 elements <entry> [--out <file>]');
15
+ process.exit(1);
16
+ }
17
+ const outIndex = args.indexOf('--out');
18
+ const out = outIndex >= 0 ? resolve(BASE, args[outIndex + 1]) : resolve(ROOT, `components/${config.prefix}.elements.js`);
19
+ await build({
20
+ entryPoints: [resolve(BASE, entry)],
21
+ outfile: out,
22
+ bundle: true,
23
+ format: 'iife',
24
+ platform: 'browser',
25
+ target: 'es2022',
26
+ jsx: 'automatic',
27
+ define: { 'process.env.NODE_ENV': '"production"' },
28
+ minify: true,
29
+ legalComments: 'none',
30
+ banner: { js: `/* Generated by stitch2 elements from ${entry}. Do not edit. */` },
31
+ logLevel: 'warning',
32
+ });
33
+ console.log(`elements: ${entry} → ${out.replace(`${BASE}/`, '')}`);