slicejs-cli 4.2.0 → 4.4.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 (49) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +260 -257
  3. package/client.js +927 -780
  4. package/commands/Print.js +163 -163
  5. package/commands/Validations.js +92 -92
  6. package/commands/build/build.js +97 -107
  7. package/commands/buildProduction/buildProduction.js +613 -613
  8. package/commands/bundle/bundle.js +251 -239
  9. package/commands/createComponent/VisualComponentTemplate.js +55 -55
  10. package/commands/createComponent/createComponent.js +128 -128
  11. package/commands/deleteComponent/deleteComponent.js +81 -81
  12. package/commands/docs/docs.js +365 -0
  13. package/commands/doctor/doctor.js +677 -563
  14. package/commands/getComponent/getComponent.js +842 -842
  15. package/commands/init/init.js +526 -475
  16. package/commands/lint/lint.js +75 -0
  17. package/commands/lint/types.js +85 -0
  18. package/commands/listComponents/listComponents.js +172 -172
  19. package/commands/seo/check.js +91 -0
  20. package/commands/seo/images.js +586 -0
  21. package/commands/seo/sitemap.js +106 -0
  22. package/commands/seo/support.js +130 -0
  23. package/commands/setup/lint.js +151 -0
  24. package/commands/skill/skill.js +236 -236
  25. package/commands/startServer/startServer.js +240 -240
  26. package/commands/startServer/watchServer.js +66 -66
  27. package/commands/typecheck/typecheck.js +83 -0
  28. package/commands/types/types.js +1378 -1097
  29. package/commands/utils/JsMinifier.js +230 -230
  30. package/commands/utils/LocalCliDelegation.js +78 -53
  31. package/commands/utils/PackageManager.js +148 -148
  32. package/commands/utils/PathHelper.js +87 -75
  33. package/commands/utils/ProjectValidation.js +274 -0
  34. package/commands/utils/SourceDiagnostics.js +201 -201
  35. package/commands/utils/VersionChecker.js +169 -169
  36. package/commands/utils/analyzeSource.js +77 -77
  37. package/commands/utils/bundling/BundleGenerator.js +3748 -3776
  38. package/commands/utils/bundling/DependencyAnalyzer.js +976 -976
  39. package/commands/utils/bundling/ExternalModuleBundler.js +298 -298
  40. package/commands/utils/componentAudit.js +74 -0
  41. package/commands/utils/compressAssets.js +103 -103
  42. package/commands/utils/cssScope.js +83 -0
  43. package/commands/utils/loadConfig.js +31 -31
  44. package/commands/utils/semver.js +66 -0
  45. package/commands/utils/sliceConfigSchema.js +72 -0
  46. package/commands/utils/sliceScripts.js +48 -48
  47. package/commands/utils/updateManager.js +471 -471
  48. package/eslint-config.js +128 -0
  49. package/package.json +19 -13
@@ -0,0 +1,128 @@
1
+ // ESLint flat config for Slice.js projects.
2
+ //
3
+ // It lives in the CLI (not its own package) because every Slice project already
4
+ // has `slicejs-cli` as a devDependency: one import, one thing to install.
5
+ //
6
+ // // eslint.config.js — an app (browser)
7
+ // import slice from 'slicejs-cli/eslint-config.js';
8
+ // export default [
9
+ // ...slice,
10
+ // { languageOptions: { globals: { ToastProvider: 'writable' } } }, // app globals last
11
+ // ];
12
+ //
13
+ // // eslint.config.js — tooling that runs in Node
14
+ // import { nodeConfig } from 'slicejs-cli/eslint-config.js';
15
+ // export default nodeConfig;
16
+ //
17
+ // What belongs here: the environment, the framework globals, and rules that
18
+ // catch mistakes without turning every project yellow.
19
+ //
20
+ // What does NOT belong here: framework invariants (a component that cannot load,
21
+ // a broken route, a reserved prop). Those are `slice build` / `slice doctor`
22
+ // rules, and they live in exactly one place. Lint runs in your editor; the build
23
+ // decides whether a project ships.
24
+ //
25
+ // A plugin with custom rules was evaluated and rejected for now: an audit of 338
26
+ // components across four apps found no true positive for any candidate rule.
27
+ // Revisit it if a rule shows real findings.
28
+
29
+ import js from '@eslint/js';
30
+ import globals from 'globals';
31
+
32
+ /**
33
+ * The globals a Slice app has in the browser: the DOM ones plus the two the
34
+ * framework adds. Exported so a project can reuse them in an override.
35
+ */
36
+ export const sliceGlobals = {
37
+ ...globals.browser,
38
+ slice: 'readonly',
39
+ Slice: 'readonly'
40
+ };
41
+
42
+ // Deliberately warnings: they catch a mistake in review without failing a build
43
+ // that has been green for months. A project can escalate them in its own config.
44
+ const recommendedWarnings = {
45
+ 'no-unused-vars': ['warn', {
46
+ argsIgnorePattern: '^_',
47
+ varsIgnorePattern: '^_',
48
+ caughtErrorsIgnorePattern: '^_',
49
+ destructuredArrayIgnorePattern: '^_'
50
+ }],
51
+ 'no-console': 'off',
52
+ 'no-constant-condition': ['warn', { checkLoops: false }],
53
+ 'no-constant-binary-expression': 'warn',
54
+ 'no-duplicate-imports': 'warn',
55
+ 'no-self-compare': 'warn',
56
+ 'no-template-curly-in-string': 'warn',
57
+ 'no-unmodified-loop-condition': 'warn',
58
+ 'no-unreachable-loop': 'warn',
59
+ 'no-unused-private-class-members': 'warn',
60
+ 'require-atomic-updates': 'off'
61
+ };
62
+
63
+ // Generated, vendored or throwaway output. `components.js` is rewritten by
64
+ // `slice component list`, `.tmp/` is where the CLI's own tests write, and the
65
+ // agent folders hold a vendored copy of the skill.
66
+ const ignores = [
67
+ 'dist/**',
68
+ 'node_modules/**',
69
+ 'coverage/**',
70
+ 'playwright-report/**',
71
+ 'test-results/**',
72
+ '.tmp/**',
73
+ '.agents/**',
74
+ '.claude/**',
75
+ '.opencode/**',
76
+ 'src/libs/**',
77
+ '**/*.generated.js',
78
+ 'src/Components/components.js'
79
+ ];
80
+
81
+ const base = (globalsForEnv = {}) => [
82
+ js.configs.recommended,
83
+ {
84
+ languageOptions: {
85
+ ecmaVersion: 'latest',
86
+ sourceType: 'module',
87
+ globals: globalsForEnv
88
+ },
89
+ rules: recommendedWarnings
90
+ },
91
+ { ignores }
92
+ ];
93
+
94
+ /** Node globals, for a repo that mixes an app with Node tooling in one config. */
95
+ export const nodeGlobals = { ...globals.node };
96
+
97
+ /** App preset: browser + framework globals for `src/`, Node for the server side. */
98
+ export const appConfig = [
99
+ ...base(),
100
+ {
101
+ // App code runs in the browser and sees the framework globals. Scoped, so a
102
+ // server file does not quietly get `document`/`window` as defined globals.
103
+ files: ['src/**/*.{js,mjs,cjs}'],
104
+ languageOptions: { globals: sliceGlobals }
105
+ },
106
+ {
107
+ // The server entry and build scripts are Node, not browser code.
108
+ files: ['api/**/*.{js,mjs,cjs}', 'scripts/**/*.{js,mjs,cjs}', '*.config.{js,mjs,cjs}'],
109
+ languageOptions: { globals: { ...globals.node } }
110
+ },
111
+ {
112
+ // Specs and e2e helpers run in Node, and Playwright exposes `page`/`browser`.
113
+ files: ['**/*.spec.js', 'tests/**/*.{js,mjs,cjs}', 'playwright/**/*.{js,mjs,cjs}'],
114
+ languageOptions: {
115
+ globals: {
116
+ ...globals.node,
117
+ ...sliceGlobals,
118
+ page: 'readonly',
119
+ browser: 'readonly'
120
+ }
121
+ }
122
+ }
123
+ ];
124
+
125
+ /** Node preset: CLIs, build scripts and tooling. */
126
+ export const nodeConfig = base({ ...globals.node });
127
+
128
+ export default appConfig;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "slicejs-cli",
3
- "version": "4.2.0",
3
+ "version": "4.4.0",
4
4
  "description": "Command client for developing web applications with Slice.js framework",
5
5
  "main": "client.js",
6
6
  "bin": {
@@ -10,30 +10,33 @@
10
10
  "node": ">=20.0.0"
11
11
  },
12
12
  "files": [
13
+ "assets",
13
14
  "client.js",
14
15
  "commands",
15
- "assets"
16
+ "eslint-config.js"
16
17
  ],
17
18
  "repository": {
18
19
  "type": "git",
19
20
  "url": "https://github.com/vkneider/slicejs-cli.git"
20
21
  },
21
22
  "scripts": {
22
- "test": "node --test",
23
- "slice:dev": "slice dev",
23
+ "release:check": "node scripts/release-check.mjs",
24
+ "slice:browse": "slice browse",
24
25
  "slice:build": "slice build",
25
- "slice:start": "slice start",
26
26
  "slice:create": "slice component create",
27
- "slice:list": "slice component list",
28
27
  "slice:delete": "slice component delete",
29
- "slice:init": "slice init",
28
+ "slice:dev": "slice dev",
29
+ "slice:doctor": "node ./node_modules/slicejs-cli/client.js doctor",
30
30
  "slice:get": "slice get",
31
- "slice:browse": "slice browse",
31
+ "slice:help": "node ./node_modules/slicejs-cli/client.js --help",
32
+ "slice:init": "slice init",
33
+ "slice:list": "slice component list",
34
+ "slice:start": "slice start",
32
35
  "slice:sync": "slice sync",
33
- "slice:version": "slice version",
34
36
  "slice:types": "slice types generate",
35
- "slice:doctor": "node ./node_modules/slicejs-cli/client.js doctor",
36
- "slice:help": "node ./node_modules/slicejs-cli/client.js --help"
37
+ "slice:version": "slice version",
38
+ "test": "node --test",
39
+ "lint": "node ./client.js lint"
37
40
  },
38
41
  "keywords": [
39
42
  "framework",
@@ -53,6 +56,7 @@
53
56
  "dependencies": {
54
57
  "@babel/parser": "^7.28.5",
55
58
  "@babel/traverse": "^7.28.5",
59
+ "@eslint/js": "^10.0.1",
56
60
  "chalk": "^5.6.2",
57
61
  "chokidar": "^3.6.0",
58
62
  "clean-css": "^5.3.3",
@@ -60,13 +64,15 @@
60
64
  "commander": "^12.0.0",
61
65
  "esbuild": "^0.28.1",
62
66
  "fs-extra": "^11.2.0",
67
+ "globals": "^17.0.0",
63
68
  "html-minifier-terser": "^7.2.0",
64
69
  "inquirer": "^12.4.2",
65
70
  "ora": "^8.2.0",
66
- "slicejs-web-framework": "^3.5.0",
71
+ "slicejs-web-framework": "^4.0.2",
67
72
  "terser": "^5.43.1"
68
73
  },
69
74
  "devDependencies": {
70
- "@playwright/test": "^1.60.0"
75
+ "@playwright/test": "^1.60.0",
76
+ "eslint": "^9.39.5"
71
77
  }
72
78
  }