@hia-doc/cssdoc-runner 0.0.0-stage → 1.0.0-rc.1

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.
@@ -0,0 +1,57 @@
1
+ export const CSSDOC_CONFIG_SCHEMA_VERSION = "0.1.0-draft";
2
+ export const CSSDOC_CONFIG_SCHEMA_ID = "https://mandolin.github.io/HIA-Documentation/schemas/cssdoc-config-0.1.0-draft.schema.json";
3
+
4
+ const relativeDirectory = {
5
+ type: "string",
6
+ minLength: 1,
7
+ not: {
8
+ anyOf: [
9
+ { pattern: "^(?:[A-Za-z]:|/|\\\\|[A-Za-z][A-Za-z0-9+.-]*:)" },
10
+ { pattern: "(?:^|[\\\\/])\\.\\.(?:[\\\\/]|$)" }
11
+ ]
12
+ }
13
+ };
14
+
15
+ export const CSSDOC_CONFIG_JSON_SCHEMA = Object.freeze({
16
+ $schema: "https://json-schema.org/draft/2020-12/schema",
17
+ $id: CSSDOC_CONFIG_SCHEMA_ID,
18
+ title: "CSSDoc Config",
19
+ type: "object",
20
+ additionalProperties: false,
21
+ required: ["schemaVersion", "workspaceRoot", "outputDirectory", "inputs"],
22
+ properties: {
23
+ $schema: { const: CSSDOC_CONFIG_SCHEMA_ID },
24
+ schemaVersion: { const: CSSDOC_CONFIG_SCHEMA_VERSION },
25
+ workspaceRoot: relativeDirectory,
26
+ outputDirectory: relativeDirectory,
27
+ inputs: {
28
+ type: "array",
29
+ minItems: 1,
30
+ items: {
31
+ type: "object",
32
+ additionalProperties: false,
33
+ required: ["kind", "path"],
34
+ properties: {
35
+ kind: { enum: ["css", "postcss-css", "design-token"] },
36
+ path: relativeDirectory,
37
+ language: { type: "string", minLength: 1 }
38
+ }
39
+ }
40
+ },
41
+ options: {
42
+ type: "object",
43
+ additionalProperties: false,
44
+ properties: {
45
+ emitDocSourceMap: { type: "boolean" },
46
+ sourcesContentPolicy: { enum: ["none", "reference", "embed"] },
47
+ writeResultManifest: { type: "boolean" }
48
+ }
49
+ },
50
+ profileIds: {
51
+ type: "array",
52
+ minItems: 1,
53
+ uniqueItems: true,
54
+ items: { type: "string", pattern: "^[a-z0-9][a-z0-9._-]*$" }
55
+ }
56
+ }
57
+ });
package/src/schema.mjs ADDED
@@ -0,0 +1,86 @@
1
+ /**
2
+ * @lang zh-CN 已确认的新配置身份;历史 schema 原字节保存在 schema-legacy.mjs。
3
+ * @lang en Confirmed current config identity; schema-legacy.mjs preserves the historical module bytes.
4
+ */
5
+ export const CSSDOC_CONFIG_SCHEMA_VERSION = "1.0.0";
6
+ /**
7
+ * @lang zh-CN 公开规范 URL 仅为身份,不触发读取。
8
+ * @lang en Canonical public URL is an identity and triggers no reads.
9
+ */
10
+ export const CSSDOC_CONFIG_SCHEMA_ID = "https://mandolin.github.io/HIA-Documentation/schemas/cssdoc-config-1.0.0.schema.json";
11
+ /** @lang zh-CN 精确旧 schema 读取入口,不套用新默认。 @lang en Exact historical schema entry without imposing new defaults. */
12
+ import * as legacyConfig from "./schema-legacy.mjs";
13
+ /**
14
+ * @lang zh-CN 原档案配置schema的同一对象,不克隆、不插入新默认或修改历史模块。
15
+ * @lang en The original archived config-schema object without cloning, inserting new defaults or changing the historical module.
16
+ */
17
+ export const CSSDOC_LEGACY_CONFIG_JSON_SCHEMA = legacyConfig.CSSDOC_CONFIG_JSON_SCHEMA;
18
+ /**
19
+ * @lang zh-CN 原档案配置schema身份,不读取URL。
20
+ * @lang en Original archived config-schema identity, without URL reads.
21
+ */
22
+ export const CSSDOC_LEGACY_CONFIG_SCHEMA_ID = legacyConfig.CSSDOC_CONFIG_SCHEMA_ID;
23
+ /**
24
+ * @lang zh-CN 原档案配置版本,不重标旧工件。
25
+ * @lang en Original archived config version, without relabeling historical artifacts.
26
+ */
27
+ export const CSSDOC_LEGACY_CONFIG_SCHEMA_VERSION = legacyConfig.CSSDOC_CONFIG_SCHEMA_VERSION;
28
+
29
+ const relativeDirectory = {
30
+ type: "string",
31
+ minLength: 1,
32
+ not: {
33
+ anyOf: [
34
+ { pattern: "^(?:[A-Za-z]:|/|\\\\|[A-Za-z][A-Za-z0-9+.-]*:)" },
35
+ { pattern: "(?:^|[\\\\/])\\.\\.(?:[\\\\/]|$)" }
36
+ ]
37
+ }
38
+ };
39
+
40
+ /**
41
+ * @lang zh-CN 新 schema 与既有目录/kind 缺省行为一致,不会自动填值或修改输入。
42
+ * @lang en The new schema matches existing directory/kind defaults without inserting values or mutating input.
43
+ */
44
+ export const CSSDOC_CONFIG_JSON_SCHEMA = Object.freeze({
45
+ $schema: "https://json-schema.org/draft/2020-12/schema",
46
+ $id: CSSDOC_CONFIG_SCHEMA_ID,
47
+ title: "CSSDoc Config",
48
+ type: "object",
49
+ additionalProperties: false,
50
+ required: ["schemaVersion", "inputs"],
51
+ properties: {
52
+ $schema: { const: CSSDOC_CONFIG_SCHEMA_ID },
53
+ schemaVersion: { const: CSSDOC_CONFIG_SCHEMA_VERSION },
54
+ workspaceRoot: { ...relativeDirectory, default: "." },
55
+ outputDirectory: { ...relativeDirectory, default: "dist/cssdoc" },
56
+ inputs: {
57
+ type: "array",
58
+ minItems: 1,
59
+ items: {
60
+ type: "object",
61
+ additionalProperties: false,
62
+ required: ["path"],
63
+ properties: {
64
+ kind: { enum: ["css", "postcss-css", "design-token"] },
65
+ path: relativeDirectory,
66
+ language: { type: "string", minLength: 1 }
67
+ }
68
+ }
69
+ },
70
+ options: {
71
+ type: "object",
72
+ additionalProperties: false,
73
+ properties: {
74
+ emitDocSourceMap: { type: "boolean" },
75
+ sourcesContentPolicy: { enum: ["none", "reference", "embed"] },
76
+ writeResultManifest: { type: "boolean" }
77
+ }
78
+ },
79
+ profileIds: {
80
+ type: "array",
81
+ minItems: 1,
82
+ uniqueItems: true,
83
+ items: { type: "string", pattern: "^[a-z0-9][a-z0-9._-]*$" }
84
+ }
85
+ }
86
+ });
@@ -0,0 +1,116 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://mandolin.github.io/HIA-Documentation/schemas/cssdoc-config-0.1.0-draft.schema.json",
4
+ "title": "CSSDoc Config",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schemaVersion",
9
+ "workspaceRoot",
10
+ "outputDirectory",
11
+ "inputs"
12
+ ],
13
+ "properties": {
14
+ "$schema": {
15
+ "const": "https://mandolin.github.io/HIA-Documentation/schemas/cssdoc-config-0.1.0-draft.schema.json"
16
+ },
17
+ "schemaVersion": {
18
+ "const": "0.1.0-draft"
19
+ },
20
+ "workspaceRoot": {
21
+ "type": "string",
22
+ "minLength": 1,
23
+ "not": {
24
+ "anyOf": [
25
+ {
26
+ "pattern": "^(?:[A-Za-z]:|/|\\\\|[A-Za-z][A-Za-z0-9+.-]*:)"
27
+ },
28
+ {
29
+ "pattern": "(?:^|[\\\\/])\\.\\.(?:[\\\\/]|$)"
30
+ }
31
+ ]
32
+ }
33
+ },
34
+ "outputDirectory": {
35
+ "type": "string",
36
+ "minLength": 1,
37
+ "not": {
38
+ "anyOf": [
39
+ {
40
+ "pattern": "^(?:[A-Za-z]:|/|\\\\|[A-Za-z][A-Za-z0-9+.-]*:)"
41
+ },
42
+ {
43
+ "pattern": "(?:^|[\\\\/])\\.\\.(?:[\\\\/]|$)"
44
+ }
45
+ ]
46
+ }
47
+ },
48
+ "inputs": {
49
+ "type": "array",
50
+ "minItems": 1,
51
+ "items": {
52
+ "type": "object",
53
+ "additionalProperties": false,
54
+ "required": [
55
+ "kind",
56
+ "path"
57
+ ],
58
+ "properties": {
59
+ "kind": {
60
+ "enum": [
61
+ "css",
62
+ "postcss-css",
63
+ "design-token"
64
+ ]
65
+ },
66
+ "path": {
67
+ "type": "string",
68
+ "minLength": 1,
69
+ "not": {
70
+ "anyOf": [
71
+ {
72
+ "pattern": "^(?:[A-Za-z]:|/|\\\\|[A-Za-z][A-Za-z0-9+.-]*:)"
73
+ },
74
+ {
75
+ "pattern": "(?:^|[\\\\/])\\.\\.(?:[\\\\/]|$)"
76
+ }
77
+ ]
78
+ }
79
+ },
80
+ "language": {
81
+ "type": "string",
82
+ "minLength": 1
83
+ }
84
+ }
85
+ }
86
+ },
87
+ "options": {
88
+ "type": "object",
89
+ "additionalProperties": false,
90
+ "properties": {
91
+ "emitDocSourceMap": {
92
+ "type": "boolean"
93
+ },
94
+ "sourcesContentPolicy": {
95
+ "enum": [
96
+ "none",
97
+ "reference",
98
+ "embed"
99
+ ]
100
+ },
101
+ "writeResultManifest": {
102
+ "type": "boolean"
103
+ }
104
+ }
105
+ },
106
+ "profileIds": {
107
+ "type": "array",
108
+ "minItems": 1,
109
+ "uniqueItems": true,
110
+ "items": {
111
+ "type": "string",
112
+ "pattern": "^[a-z0-9][a-z0-9._-]*$"
113
+ }
114
+ }
115
+ }
116
+ }
@@ -0,0 +1,115 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://mandolin.github.io/HIA-Documentation/schemas/cssdoc-config-1.0.0.schema.json",
4
+ "title": "CSSDoc Config",
5
+ "type": "object",
6
+ "additionalProperties": false,
7
+ "required": [
8
+ "schemaVersion",
9
+ "inputs"
10
+ ],
11
+ "properties": {
12
+ "$schema": {
13
+ "const": "https://mandolin.github.io/HIA-Documentation/schemas/cssdoc-config-1.0.0.schema.json"
14
+ },
15
+ "schemaVersion": {
16
+ "const": "1.0.0"
17
+ },
18
+ "workspaceRoot": {
19
+ "type": "string",
20
+ "minLength": 1,
21
+ "not": {
22
+ "anyOf": [
23
+ {
24
+ "pattern": "^(?:[A-Za-z]:|/|\\\\|[A-Za-z][A-Za-z0-9+.-]*:)"
25
+ },
26
+ {
27
+ "pattern": "(?:^|[\\\\/])\\.\\.(?:[\\\\/]|$)"
28
+ }
29
+ ]
30
+ },
31
+ "default": "."
32
+ },
33
+ "outputDirectory": {
34
+ "type": "string",
35
+ "minLength": 1,
36
+ "not": {
37
+ "anyOf": [
38
+ {
39
+ "pattern": "^(?:[A-Za-z]:|/|\\\\|[A-Za-z][A-Za-z0-9+.-]*:)"
40
+ },
41
+ {
42
+ "pattern": "(?:^|[\\\\/])\\.\\.(?:[\\\\/]|$)"
43
+ }
44
+ ]
45
+ },
46
+ "default": "dist/cssdoc"
47
+ },
48
+ "inputs": {
49
+ "type": "array",
50
+ "minItems": 1,
51
+ "items": {
52
+ "type": "object",
53
+ "additionalProperties": false,
54
+ "required": [
55
+ "path"
56
+ ],
57
+ "properties": {
58
+ "kind": {
59
+ "enum": [
60
+ "css",
61
+ "postcss-css",
62
+ "design-token"
63
+ ]
64
+ },
65
+ "path": {
66
+ "type": "string",
67
+ "minLength": 1,
68
+ "not": {
69
+ "anyOf": [
70
+ {
71
+ "pattern": "^(?:[A-Za-z]:|/|\\\\|[A-Za-z][A-Za-z0-9+.-]*:)"
72
+ },
73
+ {
74
+ "pattern": "(?:^|[\\\\/])\\.\\.(?:[\\\\/]|$)"
75
+ }
76
+ ]
77
+ }
78
+ },
79
+ "language": {
80
+ "type": "string",
81
+ "minLength": 1
82
+ }
83
+ }
84
+ }
85
+ },
86
+ "options": {
87
+ "type": "object",
88
+ "additionalProperties": false,
89
+ "properties": {
90
+ "emitDocSourceMap": {
91
+ "type": "boolean"
92
+ },
93
+ "sourcesContentPolicy": {
94
+ "enum": [
95
+ "none",
96
+ "reference",
97
+ "embed"
98
+ ]
99
+ },
100
+ "writeResultManifest": {
101
+ "type": "boolean"
102
+ }
103
+ }
104
+ },
105
+ "profileIds": {
106
+ "type": "array",
107
+ "minItems": 1,
108
+ "uniqueItems": true,
109
+ "items": {
110
+ "type": "string",
111
+ "pattern": "^[a-z0-9][a-z0-9._-]*$"
112
+ }
113
+ }
114
+ }
115
+ }