reactive-md 0.3.1 → 0.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 (172) hide show
  1. package/CHANGELOG-ch.md +96 -0
  2. package/CHANGELOG.md +82 -39
  3. package/CONTRIBUTING-ch.md +62 -0
  4. package/CONTRIBUTING.md +64 -65
  5. package/README-ch.md +122 -0
  6. package/README-en.md +146 -0
  7. package/README.md +146 -89
  8. package/SECURITY-ch.md +80 -0
  9. package/SECURITY.md +58 -49
  10. package/THIRD_PARTY_NOTICES.md +85 -1
  11. package/bin/reactive-md.mjs +40 -0
  12. package/cli/args.mjs +181 -0
  13. package/cli/assets.mjs +390 -0
  14. package/cli/build.mjs +268 -0
  15. package/cli/document.mjs +130 -0
  16. package/cli/errors.mjs +61 -0
  17. package/cli/fs-utils.mjs +133 -0
  18. package/cli/glob.mjs +203 -0
  19. package/cli/help.mjs +138 -0
  20. package/cli/lint.mjs +177 -0
  21. package/cli/main.mjs +55 -0
  22. package/cli/migrate.mjs +368 -0
  23. package/cli/package.mjs +209 -0
  24. package/dist-library/reactive-md-react.js +3425 -1647
  25. package/dist-library/reactive-md.css +1 -1
  26. package/dist-library/reactive-md.js +1798 -4
  27. package/dist-library/runtime-DtjdPXxJ.js +15410 -0
  28. package/dist-library/types/index.d.ts +1 -0
  29. package/dist-library/types/local/LocalDocumentView.d.ts +66 -3
  30. package/dist-library/types/local/authoring.d.ts +63 -0
  31. package/dist-library/types/local/collection-functions.d.ts +4 -0
  32. package/dist-library/types/local/colors.d.ts +2 -0
  33. package/dist-library/types/local/computations.d.ts +53 -0
  34. package/dist-library/types/local/data-functions.d.ts +22 -0
  35. package/dist-library/types/local/data-table.d.ts +65 -0
  36. package/dist-library/types/local/dates.d.ts +2 -0
  37. package/dist-library/types/local/dependencies.d.ts +31 -0
  38. package/dist-library/types/local/diagnostics.d.ts +1450 -0
  39. package/dist-library/types/local/expression.d.ts +13 -3
  40. package/dist-library/types/local/formatting.d.ts +41 -0
  41. package/dist-library/types/local/heading-anchors.d.ts +13 -2
  42. package/dist-library/types/local/i18n.d.ts +18 -0
  43. package/dist-library/types/local/index.d.ts +18 -1
  44. package/dist-library/types/local/limits.d.ts +32 -1
  45. package/dist-library/types/local/locale.d.ts +1 -0
  46. package/dist-library/types/local/math.d.ts +6 -1
  47. package/dist-library/types/local/parser.d.ts +10 -4
  48. package/dist-library/types/local/render-types.d.ts +5 -1
  49. package/dist-library/types/local/retention.d.ts +23 -0
  50. package/dist-library/types/local/schema.d.ts +25 -3
  51. package/dist-library/types/local/source-migration.d.ts +35 -0
  52. package/dist-library/types/local/state.d.ts +80 -0
  53. package/dist-library/types/local/text-length.d.ts +13 -0
  54. package/dist-library/types/local/theme.d.ts +30 -0
  55. package/dist-library/types/local/types.d.ts +112 -4
  56. package/dist-library/types/local/validation.d.ts +32 -0
  57. package/dist-library/types/local/version.d.ts +1 -1
  58. package/dist-library/types/local/worker.d.ts +82 -0
  59. package/dist-library/types/react/index.d.ts +4 -1
  60. package/dist-library/types/shareable.d.ts +64 -0
  61. package/dist-standalone/reactive-md-standalone.css +2 -0
  62. package/dist-standalone/reactive-md-standalone.js +57 -0
  63. package/docs/author-tools-ch.md +56 -0
  64. package/docs/author-tools-en.md +56 -0
  65. package/docs/compatibility-ch.md +103 -0
  66. package/docs/compatibility-en.md +103 -0
  67. package/docs/{component-development.md → component-development-ch.md} +210 -206
  68. package/docs/component-development-en.md +210 -0
  69. package/docs/{component-protocol.md → component-protocol-ch.md} +710 -685
  70. package/docs/component-protocol-en.md +710 -0
  71. package/docs/computations-formatting-ch.md +87 -0
  72. package/docs/computations-formatting-en.md +87 -0
  73. package/docs/constraints-collections-ch.md +84 -0
  74. package/docs/constraints-collections-en.md +84 -0
  75. package/docs/diagnostics-counting-ch.md +84 -0
  76. package/docs/diagnostics-counting-en.md +84 -0
  77. package/docs/local-components-v2-ch.md +138 -0
  78. package/docs/local-components-v2-en.md +104 -0
  79. package/docs/{local-guide.md → local-guide-ch.md} +28 -8
  80. package/docs/local-guide-en.md +961 -0
  81. package/docs/local-integration-ch.md +363 -0
  82. package/docs/local-integration-en.md +363 -0
  83. package/docs/{local-interaction-syntax.md → local-interaction-syntax-ch.md} +66 -20
  84. package/docs/local-interaction-syntax-en.md +483 -0
  85. package/docs/{performance.md → performance-ch.md} +12 -3
  86. package/docs/performance-en.md +76 -0
  87. package/docs/release-0.4.0-ch.md +89 -0
  88. package/docs/release-0.4.0-en.md +89 -0
  89. package/docs/releasing-ch.md +101 -0
  90. package/docs/releasing-en.md +101 -0
  91. package/docs/shareable-export-ch.md +205 -0
  92. package/docs/shareable-export-en.md +207 -0
  93. package/docs/source-versioning-ch.md +159 -0
  94. package/docs/source-versioning-en.md +159 -0
  95. package/docs/theme-protocol-ch.md +107 -0
  96. package/docs/theme-protocol-en.md +107 -0
  97. package/examples/conformance/README.md +33 -31
  98. package/examples/conformance/component-protocol-1.json +482 -194
  99. package/examples/conformance/component-protocol-1.schema.json +76 -76
  100. package/examples/conformance/history/v0.3.1/catalog.reactive.md +20 -0
  101. package/examples/conformance/history/v0.3.1/charts.reactive.md +73 -0
  102. package/examples/conformance/history/v0.3.1/checklist.reactive.md +32 -0
  103. package/examples/conformance/history/v0.3.1/comparison.reactive.md +47 -0
  104. package/examples/conformance/history/v0.3.1/components.reactive.md +44 -0
  105. package/examples/conformance/history/v0.3.1/counter.reactive.md +7 -0
  106. package/examples/conformance/history/v0.3.1/diagnostics.reactive.md +54 -0
  107. package/examples/conformance/history/v0.3.1/diagram.reactive.md +44 -0
  108. package/examples/conformance/history/v0.3.1/gallery.reactive.md +61 -0
  109. package/examples/conformance/history/v0.3.1/local-draft-1.json +50 -0
  110. package/examples/conformance/history/v0.3.1/parameters.reactive.md +36 -0
  111. package/examples/conformance/history/v0.3.1/planning.reactive.md +24 -0
  112. package/examples/conformance/history/v0.3.1/pricing.reactive.md +20 -0
  113. package/examples/conformance/history/v0.3.1/provenance.json +72 -0
  114. package/examples/conformance/local-draft-2.json +212 -0
  115. package/examples/integration/README.md +45 -29
  116. package/examples/integration/core/index.mjs +32 -19
  117. package/examples/integration/react/index.html +1 -1
  118. package/examples/integration/react/main.jsx +5 -5
  119. package/examples/integration/worker/index.html +19 -0
  120. package/examples/integration/worker/main.js +61 -0
  121. package/examples/integration/worker/package.json +13 -0
  122. package/examples/integration/worker/worker.js +3 -0
  123. package/examples/local/README.md +64 -58
  124. package/examples/local/catalog.reactive.md +14 -14
  125. package/examples/local/charts.reactive.md +34 -34
  126. package/examples/local/checklist.reactive.md +19 -19
  127. package/examples/local/comparison.reactive.md +23 -23
  128. package/examples/local/components.reactive.md +20 -20
  129. package/examples/local/counter.reactive.md +4 -4
  130. package/examples/local/diagnostics.reactive.md +25 -25
  131. package/examples/local/diagram.reactive.md +20 -20
  132. package/examples/local/gallery.reactive.md +31 -31
  133. package/examples/local/parameters.reactive.md +19 -19
  134. package/examples/local/planning.reactive.md +15 -15
  135. package/examples/local/pricing.reactive.md +10 -10
  136. package/examples/local/recipes/invoice-zh.reactive.md +36 -0
  137. package/examples/local/recipes/invoice.reactive.md +36 -0
  138. package/examples/local/recipes/workshop-zh.reactive.md +33 -0
  139. package/examples/local/recipes/workshop.reactive.md +33 -0
  140. package/examples/local/showcase/README.md +25 -0
  141. package/examples/local/showcase/explore.reactive.md +102 -0
  142. package/examples/local/showcase/flow.reactive.md +86 -0
  143. package/examples/local/showcase/forms.reactive.md +126 -0
  144. package/examples/local/showcase/functions.reactive.md +119 -0
  145. package/examples/local/showcase/layout.reactive.md +100 -0
  146. package/examples/local/showcase/statistics.reactive.md +108 -0
  147. package/examples/local/showcase/tasks.reactive.md +89 -0
  148. package/examples/local/showcase/zh/explore.reactive.md +102 -0
  149. package/examples/local/showcase/zh/flow.reactive.md +86 -0
  150. package/examples/local/showcase/zh/forms.reactive.md +126 -0
  151. package/examples/local/showcase/zh/functions.reactive.md +119 -0
  152. package/examples/local/showcase/zh/layout.reactive.md +100 -0
  153. package/examples/local/showcase/zh/statistics.reactive.md +108 -0
  154. package/examples/local/showcase/zh/tasks.reactive.md +89 -0
  155. package/examples/local/zh/catalog.reactive.md +20 -0
  156. package/examples/local/zh/charts.reactive.md +73 -0
  157. package/examples/local/zh/checklist.reactive.md +32 -0
  158. package/examples/local/zh/comparison.reactive.md +47 -0
  159. package/examples/local/zh/components.reactive.md +44 -0
  160. package/examples/local/zh/counter.reactive.md +7 -0
  161. package/examples/local/zh/diagnostics.reactive.md +54 -0
  162. package/examples/local/zh/diagram.reactive.md +44 -0
  163. package/examples/local/zh/gallery.reactive.md +61 -0
  164. package/examples/local/zh/parameters.reactive.md +36 -0
  165. package/examples/local/zh/planning.reactive.md +24 -0
  166. package/examples/local/zh/pricing.reactive.md +20 -0
  167. package/package.json +16 -3
  168. package/README.en.md +0 -76
  169. package/dist-library/runtime-CPzMEMcW.js +0 -11111
  170. package/docs/compatibility.md +0 -68
  171. package/docs/local-integration.md +0 -218
  172. package/docs/releasing.md +0 -92
@@ -1,6 +1,6 @@
1
1
  # Third-party notices
2
2
 
3
- Reactive MD bundles its Markdown dependencies. This file preserves license texts for the installed dependency trees of remark-gfm, remark-parse and unified, including supporting type packages. React and React DOM are host-provided peer dependencies and are distributed separately.
3
+ Reactive MD bundles its Markdown dependencies. The standalone HTML runtime also bundles React, React DOM and scheduler. This file preserves license texts for those installed dependency trees, including supporting type packages. The library React entry uses host-provided React and React DOM peers.
4
4
 
5
5
  Regenerate after dependency updates with `node scripts/generate-notices.mjs`.
6
6
 
@@ -1623,6 +1623,62 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1623
1623
  SOFTWARE.
1624
1624
  ```
1625
1625
 
1626
+ ## react-dom@19.3.1
1627
+
1628
+ Declared license: MIT
1629
+
1630
+ ```text
1631
+ MIT License
1632
+
1633
+ Copyright (c) Meta Platforms, Inc. and affiliates.
1634
+
1635
+ Permission is hereby granted, free of charge, to any person obtaining a copy
1636
+ of this software and associated documentation files (the "Software"), to deal
1637
+ in the Software without restriction, including without limitation the rights
1638
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1639
+ copies of the Software, and to permit persons to whom the Software is
1640
+ furnished to do so, subject to the following conditions:
1641
+
1642
+ The above copyright notice and this permission notice shall be included in all
1643
+ copies or substantial portions of the Software.
1644
+
1645
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1646
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1647
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1648
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1649
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1650
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1651
+ SOFTWARE.
1652
+ ```
1653
+
1654
+ ## react@19.3.1
1655
+
1656
+ Declared license: MIT
1657
+
1658
+ ```text
1659
+ MIT License
1660
+
1661
+ Copyright (c) Meta Platforms, Inc. and affiliates.
1662
+
1663
+ Permission is hereby granted, free of charge, to any person obtaining a copy
1664
+ of this software and associated documentation files (the "Software"), to deal
1665
+ in the Software without restriction, including without limitation the rights
1666
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1667
+ copies of the Software, and to permit persons to whom the Software is
1668
+ furnished to do so, subject to the following conditions:
1669
+
1670
+ The above copyright notice and this permission notice shall be included in all
1671
+ copies or substantial portions of the Software.
1672
+
1673
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1674
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1675
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1676
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1677
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1678
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1679
+ SOFTWARE.
1680
+ ```
1681
+
1626
1682
  ## remark-gfm@4.0.1
1627
1683
 
1628
1684
  Declared license: MIT
@@ -1708,6 +1764,34 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1708
1764
  THE SOFTWARE.
1709
1765
  ```
1710
1766
 
1767
+ ## scheduler@0.28.0
1768
+
1769
+ Declared license: MIT
1770
+
1771
+ ```text
1772
+ MIT License
1773
+
1774
+ Copyright (c) Meta Platforms, Inc. and affiliates.
1775
+
1776
+ Permission is hereby granted, free of charge, to any person obtaining a copy
1777
+ of this software and associated documentation files (the "Software"), to deal
1778
+ in the Software without restriction, including without limitation the rights
1779
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1780
+ copies of the Software, and to permit persons to whom the Software is
1781
+ furnished to do so, subject to the following conditions:
1782
+
1783
+ The above copyright notice and this permission notice shall be included in all
1784
+ copies or substantial portions of the Software.
1785
+
1786
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1787
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1788
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1789
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1790
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1791
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1792
+ SOFTWARE.
1793
+ ```
1794
+
1711
1795
  ## trough@2.2.0
1712
1796
 
1713
1797
  Declared license: MIT
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env node
2
+ /*
3
+ * reactive-md command-line interface.
4
+ *
5
+ * Exit codes:
6
+ * 0 success
7
+ * 2 usage or argument error
8
+ * 3 document compile, render, React or build-artifact error
9
+ * 4 input or output file I/O error
10
+ * 5 asset or security policy error
11
+ *
12
+ * Build artifacts and the package metadata are located relative to this file's
13
+ * installed package root (bin/..), never the current working directory.
14
+ */
15
+ import path from 'node:path';
16
+ import { fileURLToPath } from 'node:url';
17
+ import { CliError, EXIT } from '../cli/errors.mjs';
18
+ import { runCli } from '../cli/main.mjs';
19
+
20
+ const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
21
+ const context = {
22
+ packageRoot,
23
+ stdout: process.stdout,
24
+ stderr: process.stderr,
25
+ };
26
+
27
+ try {
28
+ process.exitCode = await runCli(process.argv.slice(2), context);
29
+ } catch (error) {
30
+ if (error instanceof CliError) {
31
+ if (!error.reported) {
32
+ context.stderr.write(`reactive-md: ${error.message}\n`);
33
+ }
34
+ process.exitCode = error.exitCode;
35
+ } else {
36
+ const message = error instanceof Error ? error.message : String(error);
37
+ context.stderr.write(`reactive-md: unexpected error: ${message}\n`);
38
+ process.exitCode = EXIT.DOCUMENT;
39
+ }
40
+ }
package/cli/args.mjs ADDED
@@ -0,0 +1,181 @@
1
+ import { usageError } from './errors.mjs';
2
+
3
+ /** A local asset root may be a Windows drive path; it must never be a URL. */
4
+ function isUrlLike(value) {
5
+ const match = /^([a-z][a-z0-9+.-]*):/i.exec(value);
6
+ if (!match) return false;
7
+ // C:\docs and C:/docs are local drive paths, not URL schemes.
8
+ if (match[1].length === 1 && /^[a-z]:[\\/]/i.test(value)) return false;
9
+ return true;
10
+ }
11
+
12
+ /**
13
+ * @param {string[]} argv
14
+ * @param {Map<string, {key: string, boolean?: boolean}>} spec
15
+ * @returns {{positionals: string[], options: Record<string, string | boolean>}}
16
+ */
17
+ function parseOptions(argv, spec) {
18
+ const positionals = [];
19
+ const options = {};
20
+ let literal = false;
21
+
22
+ for (let index = 0; index < argv.length; index += 1) {
23
+ const token = argv[index];
24
+ if (literal) {
25
+ positionals.push(token);
26
+ continue;
27
+ }
28
+ if (token === '--') {
29
+ literal = true;
30
+ continue;
31
+ }
32
+ if (token === '-' || !token.startsWith('-')) {
33
+ positionals.push(token);
34
+ continue;
35
+ }
36
+
37
+ let name = token;
38
+ let inlineValue;
39
+ if (token.startsWith('--')) {
40
+ const equals = token.indexOf('=');
41
+ if (equals > 2) {
42
+ name = token.slice(0, equals);
43
+ inlineValue = token.slice(equals + 1);
44
+ }
45
+ }
46
+ const entry = spec.get(name);
47
+ if (!entry) {
48
+ throw usageError(`Unknown option "${name}". Run "reactive-md build --help" or "reactive-md lint --help" for usage.`);
49
+ }
50
+ if (entry.boolean) {
51
+ if (inlineValue !== undefined) throw usageError(`Option "${name}" does not take a value.`);
52
+ options[entry.key] = true;
53
+ continue;
54
+ }
55
+ let value = inlineValue;
56
+ if (value === undefined) {
57
+ if (index + 1 >= argv.length) throw usageError(`Option "${name}" requires a value.`);
58
+ value = argv[index + 1];
59
+ index += 1;
60
+ }
61
+ options[entry.key] = value;
62
+ }
63
+
64
+ return { positionals, options };
65
+ }
66
+
67
+ /** @param {unknown} value */
68
+ function requireText(value, option) {
69
+ if (typeof value !== 'string' || value.trim() === '') {
70
+ throw usageError(`Option "${option}" requires a non-empty value.`);
71
+ }
72
+ return value;
73
+ }
74
+
75
+ /** @param {unknown} value @param {string} option @param {readonly string[]} choices */
76
+ function choice(value, option, choices) {
77
+ const normalized = String(value).toLowerCase();
78
+ if (!choices.includes(normalized)) {
79
+ throw usageError(`Invalid value for "${option}": "${value}". Expected ${choices.join(' or ')}.`);
80
+ }
81
+ return normalized;
82
+ }
83
+
84
+ const BUILD_SPEC = new Map([
85
+ ['-o', { key: 'output' }],
86
+ ['--output', { key: 'output' }],
87
+ ['--mode', { key: 'mode' }],
88
+ ['--state-file', { key: 'stateFile' }],
89
+ ['--assets', { key: 'assets' }],
90
+ ['--asset-root', { key: 'assetRoot' }],
91
+ ['--locale', { key: 'locale' }],
92
+ ['--color-scheme', { key: 'colorScheme' }],
93
+ ['--title', { key: 'title' }],
94
+ ['--strict', { key: 'strict', boolean: true }],
95
+ ['-h', { key: 'help', boolean: true }],
96
+ ['--help', { key: 'help', boolean: true }],
97
+ ]);
98
+
99
+ const LINT_SPEC = new Map([
100
+ ['--json', { key: 'json', boolean: true }],
101
+ ['--strict', { key: 'strict', boolean: true }],
102
+ ['-h', { key: 'help', boolean: true }],
103
+ ['--help', { key: 'help', boolean: true }],
104
+ ]);
105
+
106
+ /**
107
+ * @param {string[]} argv
108
+ * @returns {{
109
+ * help: boolean, input?: string, output?: string, mode?: 'interactive'|'static',
110
+ * stateFile?: string, assets?: 'inline'|'omit', assetRoot?: string,
111
+ * locale?: 'en'|'zh', colorScheme?: 'auto'|'light'|'dark', title?: string,
112
+ * strict?: boolean
113
+ * }}
114
+ */
115
+ export function parseBuildArgs(argv) {
116
+ const { positionals, options } = parseOptions(argv, BUILD_SPEC);
117
+ if (options.help) return { help: true };
118
+
119
+ if (positionals.length === 0) {
120
+ throw usageError('Missing input document. Usage: reactive-md build <doc.reactive.md> -o <doc.html>.');
121
+ }
122
+ if (positionals.length > 1) {
123
+ throw usageError(`Expected one input document, received ${positionals.length}: ${positionals.join(', ')}.`);
124
+ }
125
+ const input = requireText(positionals[0], 'input');
126
+ if (options.output === undefined) {
127
+ throw usageError('Missing required option "--output" (-o). Usage: reactive-md build <doc.reactive.md> -o <doc.html>.');
128
+ }
129
+ const output = requireText(options.output, '--output');
130
+ const mode = options.mode === undefined ? 'interactive' : choice(options.mode, '--mode', ['interactive', 'static']);
131
+ const assets = options.assets === undefined ? 'inline' : choice(options.assets, '--assets', ['inline', 'omit']);
132
+ const locale = options.locale === undefined ? 'en' : choice(options.locale, '--locale', ['en', 'zh']);
133
+ const colorScheme = options.colorScheme === undefined
134
+ ? 'auto'
135
+ : choice(options.colorScheme, '--color-scheme', ['auto', 'light', 'dark']);
136
+
137
+ let stateFile;
138
+ if (options.stateFile !== undefined) stateFile = requireText(options.stateFile, '--state-file');
139
+ let assetRoot;
140
+ if (options.assetRoot !== undefined) {
141
+ assetRoot = requireText(options.assetRoot, '--asset-root');
142
+ if (isUrlLike(assetRoot)) {
143
+ throw usageError('Option "--asset-root" must be a local directory path; URLs are not supported.');
144
+ }
145
+ }
146
+
147
+ return {
148
+ help: false,
149
+ input,
150
+ output,
151
+ mode,
152
+ stateFile,
153
+ assets,
154
+ assetRoot,
155
+ locale,
156
+ colorScheme,
157
+ title: typeof options.title === 'string' ? options.title : undefined,
158
+ strict: options.strict === true,
159
+ };
160
+ }
161
+
162
+ /**
163
+ * @param {string[]} argv
164
+ * @returns {{help: boolean, inputs?: string[], json?: boolean, strict?: boolean}}
165
+ */
166
+ export function parseLintArgs(argv) {
167
+ const { positionals, options } = parseOptions(argv, LINT_SPEC);
168
+ if (options.help) return { help: true };
169
+ if (positionals.length === 0) {
170
+ throw usageError('Missing lint inputs. Usage: reactive-md lint <files-or-dirs-or-globs...>.');
171
+ }
172
+ if (positionals.some((input) => input.trim() === '')) {
173
+ throw usageError('Lint input paths must not be empty.');
174
+ }
175
+ return {
176
+ help: false,
177
+ inputs: positionals,
178
+ json: options.json === true,
179
+ strict: options.strict === true,
180
+ };
181
+ }