@blueking/bkui-form 1.0.1-beta.3 → 1.0.1-beta.4
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.
- package/dist/adapter/common/FieldGroupWrap.d.ts +209 -0
- package/dist/adapter/field/ArrayField.d.ts +147 -0
- package/dist/adapter/field/BooleanField.d.ts +145 -0
- package/dist/adapter/field/CompositionField.d.ts +151 -0
- package/dist/adapter/field/FieldProps.d.ts +70 -0
- package/dist/adapter/field/NumberField.d.ts +145 -0
- package/dist/adapter/field/ObjectField.d.ts +147 -0
- package/dist/adapter/field/SchemaField.d.ts +145 -0
- package/dist/adapter/field/StringField.d.ts +4 -0
- package/dist/adapter/widget/ArrayWidget.d.ts +154 -0
- package/dist/adapter/widget/ButtonWidget.d.ts +16 -0
- package/dist/adapter/widget/CheckboxWidget.d.ts +34 -0
- package/dist/adapter/widget/CollapseGroupWidget.d.ts +196 -0
- package/dist/adapter/widget/ColorPickerWidget.d.ts +8 -0
- package/dist/adapter/widget/InputWidget.d.ts +30 -0
- package/dist/adapter/widget/KeyValueArrayWidget.d.ts +157 -0
- package/dist/adapter/widget/RadioWidget.d.ts +37 -0
- package/dist/adapter/widget/SelectWidget.d.ts +37 -0
- package/dist/adapter/widget/SwitchWidget.d.ts +10 -0
- package/dist/adapter/widget/TabGroupWidget.d.ts +187 -0
- package/dist/adapter/widget/TableWidget.d.ts +154 -0
- package/dist/adapter/widget/Widget.d.ts +182 -0
- package/dist/controller/form.d.ts +141 -0
- package/dist/controller/props.d.ts +62 -0
- package/dist/core/events.d.ts +10 -0
- package/dist/core/expression.d.ts +13 -0
- package/dist/core/form.d.ts +5 -0
- package/dist/core/lang.d.ts +1 -0
- package/dist/core/layout.d.ts +20 -0
- package/dist/core/lifecycle.d.ts +0 -0
- package/dist/core/path.d.ts +9 -0
- package/dist/core/proxy.d.ts +3 -0
- package/dist/core/reaction.d.ts +5 -0
- package/dist/core/register.d.ts +19 -0
- package/dist/core/schema.d.ts +26 -0
- package/dist/core/validator.d.ts +35 -0
- package/dist/core/widgetTree.d.ts +40 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.es.js +7443 -0
- package/dist/index.umd.js +12 -0
- package/dist/style.css +1 -0
- package/dist/util/fetch.d.ts +10 -0
- package/dist/util/index.d.ts +23 -0
- package/package.json +24 -12
- package/esm/adapter/common/FieldGroupWrap.tsx.js +0 -199
- package/esm/adapter/field/ArrayField.tsx.js +0 -55
- package/esm/adapter/field/BooleanField.tsx.js +0 -41
- package/esm/adapter/field/CompositionField.tsx.js +0 -113
- package/esm/adapter/field/FieldProps.ts.js +0 -85
- package/esm/adapter/field/NumberField.tsx.js +0 -19
- package/esm/adapter/field/ObjectField.tsx.js +0 -58
- package/esm/adapter/field/SchemaField.tsx.js +0 -28
- package/esm/adapter/field/StringField.tsx.js +0 -4
- package/esm/adapter/widget/ArrayWidget.ts.js +0 -196
- package/esm/adapter/widget/ButtonWidget.ts.js +0 -76
- package/esm/adapter/widget/CheckboxWidget.ts.js +0 -101
- package/esm/adapter/widget/CollapseGroupWidget.ts.js +0 -140
- package/esm/adapter/widget/ColorPickerWidget.ts.js +0 -71
- package/esm/adapter/widget/InputWidget.ts.js +0 -79
- package/esm/adapter/widget/KeyValueArrayWidget.tsx.js +0 -156
- package/esm/adapter/widget/RadioWidget.ts.js +0 -98
- package/esm/adapter/widget/SelectWidget.ts.js +0 -98
- package/esm/adapter/widget/SwitchWidget.ts.js +0 -73
- package/esm/adapter/widget/TabGroupWidget.ts.js +0 -145
- package/esm/adapter/widget/TableWidget.ts.js +0 -205
- package/esm/adapter/widget/Widget.ts.js +0 -497
- package/esm/assets/fonts/iconcool.eot +0 -0
- package/esm/assets/fonts/iconcool.svg +0 -53
- package/esm/assets/fonts/iconcool.ttf +0 -0
- package/esm/assets/fonts/iconcool.woff +0 -0
- package/esm/assets/style.css +0 -43
- package/esm/controller/form.css +0 -164
- package/esm/controller/form.tsx.js +0 -159
- package/esm/controller/props.ts.js +0 -75
- package/esm/core/events.ts.js +0 -74
- package/esm/core/expression.ts.js +0 -67
- package/esm/core/lang.ts.js +0 -25
- package/esm/core/layout.ts.js +0 -149
- package/esm/core/path.ts.js +0 -60
- package/esm/core/proxy.ts.js +0 -10
- package/esm/core/reaction.ts.js +0 -116
- package/esm/core/register.ts.js +0 -74
- package/esm/core/schema.ts.js +0 -302
- package/esm/core/validator.ts.js +0 -248
- package/esm/core/widgetTree.ts.js +0 -163
- package/esm/index.ts.js +0 -6
- package/esm/node_modules/@blueking/cli-service/dist/lib/path.js +0 -35
- package/esm/node_modules/@blueking/cli-service/dist/lib/util.js +0 -233
- package/esm/node_modules/@blueking/cli-service/dist/tools/rust/helper/path.js +0 -172
- package/esm/node_modules/ajv/dist/ajv.js +0 -50
- package/esm/node_modules/ajv/dist/compile/codegen/code.js +0 -156
- package/esm/node_modules/ajv/dist/compile/codegen/index.js +0 -697
- package/esm/node_modules/ajv/dist/compile/codegen/scope.js +0 -143
- package/esm/node_modules/ajv/dist/compile/errors.js +0 -123
- package/esm/node_modules/ajv/dist/compile/index.js +0 -242
- package/esm/node_modules/ajv/dist/compile/names.js +0 -28
- package/esm/node_modules/ajv/dist/compile/ref_error.js +0 -12
- package/esm/node_modules/ajv/dist/compile/resolve.js +0 -155
- package/esm/node_modules/ajv/dist/compile/rules.js +0 -26
- package/esm/node_modules/ajv/dist/compile/util.js +0 -178
- package/esm/node_modules/ajv/dist/compile/validate/applicability.js +0 -19
- package/esm/node_modules/ajv/dist/compile/validate/boolSchema.js +0 -50
- package/esm/node_modules/ajv/dist/compile/validate/dataType.js +0 -203
- package/esm/node_modules/ajv/dist/compile/validate/defaults.js +0 -35
- package/esm/node_modules/ajv/dist/compile/validate/index.js +0 -520
- package/esm/node_modules/ajv/dist/compile/validate/keyword.js +0 -124
- package/esm/node_modules/ajv/dist/compile/validate/subschema.js +0 -81
- package/esm/node_modules/ajv/dist/core.js +0 -618
- package/esm/node_modules/ajv/dist/refs/data.json +0 -13
- package/esm/node_modules/ajv/dist/refs/json-schema-draft-07.json +0 -151
- package/esm/node_modules/ajv/dist/runtime/equal.js +0 -7
- package/esm/node_modules/ajv/dist/runtime/ucs2length.js +0 -24
- package/esm/node_modules/ajv/dist/runtime/uri.js +0 -6
- package/esm/node_modules/ajv/dist/runtime/validation_error.js +0 -11
- package/esm/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +0 -49
- package/esm/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +0 -106
- package/esm/node_modules/ajv/dist/vocabularies/applicator/allOf.js +0 -23
- package/esm/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +0 -12
- package/esm/node_modules/ajv/dist/vocabularies/applicator/contains.js +0 -95
- package/esm/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +0 -85
- package/esm/node_modules/ajv/dist/vocabularies/applicator/if.js +0 -66
- package/esm/node_modules/ajv/dist/vocabularies/applicator/index.js +0 -44
- package/esm/node_modules/ajv/dist/vocabularies/applicator/items.js +0 -52
- package/esm/node_modules/ajv/dist/vocabularies/applicator/items2020.js +0 -30
- package/esm/node_modules/ajv/dist/vocabularies/applicator/not.js +0 -26
- package/esm/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +0 -60
- package/esm/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +0 -75
- package/esm/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +0 -12
- package/esm/node_modules/ajv/dist/vocabularies/applicator/properties.js +0 -54
- package/esm/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +0 -38
- package/esm/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +0 -13
- package/esm/node_modules/ajv/dist/vocabularies/code.js +0 -131
- package/esm/node_modules/ajv/dist/vocabularies/core/id.js +0 -10
- package/esm/node_modules/ajv/dist/vocabularies/core/index.js +0 -16
- package/esm/node_modules/ajv/dist/vocabularies/core/ref.js +0 -122
- package/esm/node_modules/ajv/dist/vocabularies/discriminator/index.js +0 -104
- package/esm/node_modules/ajv/dist/vocabularies/discriminator/types.js +0 -9
- package/esm/node_modules/ajv/dist/vocabularies/draft7.js +0 -17
- package/esm/node_modules/ajv/dist/vocabularies/format/format.js +0 -92
- package/esm/node_modules/ajv/dist/vocabularies/format/index.js +0 -6
- package/esm/node_modules/ajv/dist/vocabularies/metadata.js +0 -18
- package/esm/node_modules/ajv/dist/vocabularies/validation/const.js +0 -25
- package/esm/node_modules/ajv/dist/vocabularies/validation/enum.js +0 -48
- package/esm/node_modules/ajv/dist/vocabularies/validation/index.js +0 -33
- package/esm/node_modules/ajv/dist/vocabularies/validation/limitItems.js +0 -24
- package/esm/node_modules/ajv/dist/vocabularies/validation/limitLength.js +0 -27
- package/esm/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +0 -27
- package/esm/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +0 -24
- package/esm/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +0 -26
- package/esm/node_modules/ajv/dist/vocabularies/validation/pattern.js +0 -24
- package/esm/node_modules/ajv/dist/vocabularies/validation/required.js +0 -79
- package/esm/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +0 -64
- package/esm/node_modules/ajv-formats/dist/formats.js +0 -173
- package/esm/node_modules/ajv-formats/dist/index.js +0 -37
- package/esm/node_modules/ajv-formats/dist/limit.js +0 -69
- package/esm/node_modules/ajv-i18n/localize/zh/index.js +0 -154
- package/esm/node_modules/fast-deep-equal/index.js +0 -46
- package/esm/node_modules/fast-uri/index.js +0 -303
- package/esm/node_modules/fast-uri/lib/schemes.js +0 -188
- package/esm/node_modules/fast-uri/lib/scopedChars.js +0 -30
- package/esm/node_modules/fast-uri/lib/utils.js +0 -244
- package/esm/node_modules/json-schema-traverse/index.js +0 -89
- package/esm/node_modules/semver/classes/comparator.js +0 -143
- package/esm/node_modules/semver/classes/range.js +0 -557
- package/esm/node_modules/semver/classes/semver.js +0 -333
- package/esm/node_modules/semver/functions/clean.js +0 -8
- package/esm/node_modules/semver/functions/cmp.js +0 -54
- package/esm/node_modules/semver/functions/coerce.js +0 -62
- package/esm/node_modules/semver/functions/compare-build.js +0 -9
- package/esm/node_modules/semver/functions/compare-loose.js +0 -5
- package/esm/node_modules/semver/functions/compare.js +0 -7
- package/esm/node_modules/semver/functions/diff.js +0 -60
- package/esm/node_modules/semver/functions/eq.js +0 -5
- package/esm/node_modules/semver/functions/gt.js +0 -5
- package/esm/node_modules/semver/functions/gte.js +0 -5
- package/esm/node_modules/semver/functions/inc.js +0 -21
- package/esm/node_modules/semver/functions/lt.js +0 -5
- package/esm/node_modules/semver/functions/lte.js +0 -5
- package/esm/node_modules/semver/functions/major.js +0 -5
- package/esm/node_modules/semver/functions/minor.js +0 -5
- package/esm/node_modules/semver/functions/neq.js +0 -5
- package/esm/node_modules/semver/functions/parse.js +0 -18
- package/esm/node_modules/semver/functions/patch.js +0 -5
- package/esm/node_modules/semver/functions/prerelease.js +0 -8
- package/esm/node_modules/semver/functions/rcompare.js +0 -5
- package/esm/node_modules/semver/functions/rsort.js +0 -5
- package/esm/node_modules/semver/functions/satisfies.js +0 -12
- package/esm/node_modules/semver/functions/sort.js +0 -5
- package/esm/node_modules/semver/functions/valid.js +0 -8
- package/esm/node_modules/semver/index.js +0 -91
- package/esm/node_modules/semver/internal/constants.js +0 -37
- package/esm/node_modules/semver/internal/debug.js +0 -11
- package/esm/node_modules/semver/internal/identifiers.js +0 -29
- package/esm/node_modules/semver/internal/lrucache.js +0 -42
- package/esm/node_modules/semver/internal/parse-options.js +0 -17
- package/esm/node_modules/semver/internal/re.js +0 -223
- package/esm/node_modules/semver/ranges/gtr.js +0 -6
- package/esm/node_modules/semver/ranges/intersects.js +0 -9
- package/esm/node_modules/semver/ranges/ltr.js +0 -6
- package/esm/node_modules/semver/ranges/max-satisfying.js +0 -27
- package/esm/node_modules/semver/ranges/min-satisfying.js +0 -26
- package/esm/node_modules/semver/ranges/min-version.js +0 -63
- package/esm/node_modules/semver/ranges/outside.js +0 -82
- package/esm/node_modules/semver/ranges/simplify.js +0 -49
- package/esm/node_modules/semver/ranges/subset.js +0 -249
- package/esm/node_modules/semver/ranges/to-comparators.js +0 -10
- package/esm/node_modules/semver/ranges/valid.js +0 -13
- package/esm/util/fetch.ts.js +0 -190
- package/esm/util/index.ts.js +0 -276
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
function _define_property(obj, key, value) {
|
|
2
|
-
if (key in obj) {
|
|
3
|
-
Object.defineProperty(obj, key, {
|
|
4
|
-
value: value,
|
|
5
|
-
enumerable: true,
|
|
6
|
-
configurable: true,
|
|
7
|
-
writable: true
|
|
8
|
-
});
|
|
9
|
-
} else {
|
|
10
|
-
obj[key] = value;
|
|
11
|
-
}
|
|
12
|
-
return obj;
|
|
13
|
-
}
|
|
14
|
-
import Path from '../node_modules/@blueking/cli-service/dist/tools/rust/helper/path.js';
|
|
15
|
-
export class WidgetNode {
|
|
16
|
-
// 当前node的值
|
|
17
|
-
get value() {
|
|
18
|
-
var _this_instance;
|
|
19
|
-
return (_this_instance = this.instance) === null || _this_instance === void 0 ? void 0 : _this_instance.value;
|
|
20
|
-
}
|
|
21
|
-
// 是否含有可见子节点
|
|
22
|
-
get isChildrenVisible() {
|
|
23
|
-
if (this.type === 'node') {
|
|
24
|
-
var _this_instance;
|
|
25
|
-
return (_this_instance = this.instance) === null || _this_instance === void 0 ? void 0 : _this_instance.state.visible;
|
|
26
|
-
}
|
|
27
|
-
return this.children.some((child)=>child.isChildrenVisible);
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* 获取 parents
|
|
31
|
-
*/ get parents() {
|
|
32
|
-
if (!this.parent) {
|
|
33
|
-
return [];
|
|
34
|
-
}
|
|
35
|
-
return [
|
|
36
|
-
...this.parent.parents,
|
|
37
|
-
this.parent
|
|
38
|
-
];
|
|
39
|
-
}
|
|
40
|
-
// 第一个子节点
|
|
41
|
-
get firstChild() {
|
|
42
|
-
return this.children[0] || null;
|
|
43
|
-
}
|
|
44
|
-
// 最后一个子节点
|
|
45
|
-
get lastChild() {
|
|
46
|
-
return this.children[this.children.length - 1] || null;
|
|
47
|
-
}
|
|
48
|
-
// 指定属性下的同胞节点
|
|
49
|
-
getSibling(lastProp) {
|
|
50
|
-
var _this_parent;
|
|
51
|
-
const reg = new RegExp(`${Path.getPathLastProp(this.id) || ''}$`);
|
|
52
|
-
const id = this.id.replace(reg, lastProp);
|
|
53
|
-
return (_this_parent = this.parent) === null || _this_parent === void 0 ? void 0 : _this_parent.children.find((node)=>node.id === id);
|
|
54
|
-
}
|
|
55
|
-
// 获取所以同胞节点(不含自己)
|
|
56
|
-
getSiblings() {
|
|
57
|
-
var _this_parent;
|
|
58
|
-
return ((_this_parent = this.parent) === null || _this_parent === void 0 ? void 0 : _this_parent.children.filter((node)=>node.instance !== this.instance)) || [];
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* 是否是叶子节点
|
|
62
|
-
*/ get isLeaf() {
|
|
63
|
-
return !this.children.length;
|
|
64
|
-
}
|
|
65
|
-
appendChild(node) {
|
|
66
|
-
const nodes = Array.isArray(node) ? node : [
|
|
67
|
-
node
|
|
68
|
-
];
|
|
69
|
-
const offset = node.index !== undefined ? node.index : this.children.length;
|
|
70
|
-
this.children.splice(offset, 0, ...nodes);
|
|
71
|
-
this.children.slice(offset).forEach((node, index)=>{
|
|
72
|
-
node.index = offset + index;
|
|
73
|
-
});
|
|
74
|
-
return nodes;
|
|
75
|
-
}
|
|
76
|
-
removeChild(node) {
|
|
77
|
-
const nodes = Array.isArray(node) ? node : [
|
|
78
|
-
node
|
|
79
|
-
];
|
|
80
|
-
const removedChildIndex = [];
|
|
81
|
-
nodes.forEach((node)=>{
|
|
82
|
-
const { index } = node;
|
|
83
|
-
removedChildIndex.push(index);
|
|
84
|
-
this.children.splice(index, 1);
|
|
85
|
-
});
|
|
86
|
-
const minIndex = Math.min(...removedChildIndex);
|
|
87
|
-
this.children.slice(minIndex).forEach((node, index)=>{
|
|
88
|
-
node.index = minIndex + index;
|
|
89
|
-
});
|
|
90
|
-
return nodes;
|
|
91
|
-
}
|
|
92
|
-
constructor(config){
|
|
93
|
-
_define_property(this, "id", void 0);
|
|
94
|
-
_define_property(this, "instance", void 0);
|
|
95
|
-
_define_property(this, "parent", void 0);
|
|
96
|
-
_define_property(this, "type", void 0);
|
|
97
|
-
_define_property(this, "index", void 0);
|
|
98
|
-
_define_property(this, "children", void 0);
|
|
99
|
-
const { id, instance, parent, index, type, children = [] } = config;
|
|
100
|
-
this.id = id;
|
|
101
|
-
this.type = type;
|
|
102
|
-
this.index = index;
|
|
103
|
-
this.instance = instance;
|
|
104
|
-
this.parent = parent;
|
|
105
|
-
this.children = children;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
export class WidgetTree {
|
|
109
|
-
addWidgetNode(path, instance, type, index) {
|
|
110
|
-
if (path === '') {
|
|
111
|
-
// 根节点
|
|
112
|
-
const node = new WidgetNode({
|
|
113
|
-
id: '',
|
|
114
|
-
type,
|
|
115
|
-
index,
|
|
116
|
-
parent: null,
|
|
117
|
-
instance,
|
|
118
|
-
children: []
|
|
119
|
-
});
|
|
120
|
-
this.widgetMap[path] = node;
|
|
121
|
-
} else {
|
|
122
|
-
// 普通节点
|
|
123
|
-
const parentId = Path.getParentPath(path);
|
|
124
|
-
const parentNode = this.widgetMap[parentId];
|
|
125
|
-
const node = new WidgetNode({
|
|
126
|
-
id: (instance === null || instance === void 0 ? void 0 : instance.path) || path,
|
|
127
|
-
type,
|
|
128
|
-
index,
|
|
129
|
-
parent: parentNode,
|
|
130
|
-
instance,
|
|
131
|
-
children: []
|
|
132
|
-
});
|
|
133
|
-
if (!parentNode) {
|
|
134
|
-
console.warn('Unexpected parent id, please check widget node', node);
|
|
135
|
-
} else {
|
|
136
|
-
parentNode.appendChild(node);
|
|
137
|
-
}
|
|
138
|
-
this.widgetMap[path] = node;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
removeWidgetNode(path, instance) {
|
|
142
|
-
const node = this.widgetMap[path];
|
|
143
|
-
if (node) {
|
|
144
|
-
if (node.parent) {
|
|
145
|
-
const { children } = node.parent;
|
|
146
|
-
const index = children.findIndex((item)=>item.instance === instance);
|
|
147
|
-
if (index > -1) {
|
|
148
|
-
children.splice(index, 1);
|
|
149
|
-
children.slice(index).forEach((node, i)=>{
|
|
150
|
-
node.index = index + i;
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
if (node.instance === instance) {
|
|
155
|
-
delete this.widgetMap[path];
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
constructor(){
|
|
160
|
-
_define_property(this, "widgetMap", {});
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
export default new WidgetTree();
|
package/esm/index.ts.js
DELETED
|
@@ -1,35 +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.posix = exports.isAbsolute = exports.relative = exports.basename = exports.extname = exports.dirname = exports.join = exports.resolve = exports.normalize = void 0;
|
|
7
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
-
// 转换路径分隔符为 /
|
|
9
|
-
const normalize = (file) => file.replace(/\\/g, '/');
|
|
10
|
-
exports.normalize = normalize;
|
|
11
|
-
// 解析路径
|
|
12
|
-
const resolve = (...files) => (0, exports.normalize)(node_path_1.default.resolve(...files));
|
|
13
|
-
exports.resolve = resolve;
|
|
14
|
-
// 连接路径
|
|
15
|
-
const join = (...files) => (0, exports.normalize)(node_path_1.default.join(...files));
|
|
16
|
-
exports.join = join;
|
|
17
|
-
// 获取文件目录
|
|
18
|
-
const dirname = (file) => node_path_1.default.dirname(file);
|
|
19
|
-
exports.dirname = dirname;
|
|
20
|
-
// 获取文件扩展名
|
|
21
|
-
const extname = (file) => node_path_1.default.extname(file);
|
|
22
|
-
exports.extname = extname;
|
|
23
|
-
// 获取文件名
|
|
24
|
-
const basename = (file, suffix) => node_path_1.default.basename(file, suffix);
|
|
25
|
-
exports.basename = basename;
|
|
26
|
-
// 获取相对路径
|
|
27
|
-
const relative = (path1, path2) => (0, exports.normalize)(node_path_1.default.relative(path1, path2));
|
|
28
|
-
exports.relative = relative;
|
|
29
|
-
// 判断是否是绝对路径
|
|
30
|
-
const isAbsolute = (file) => node_path_1.default.isAbsolute(file);
|
|
31
|
-
exports.isAbsolute = isAbsolute;
|
|
32
|
-
// posix
|
|
33
|
-
exports.posix = {
|
|
34
|
-
join: (...files) => (0, exports.normalize)(node_path_1.default.posix.join(...files)),
|
|
35
|
-
};
|
|
@@ -1,233 +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.getDirName = exports.getFileName = exports.isNodeBuiltInModule = exports.getUniqueId = exports.deepMerge = exports.getVueVersion = exports.isEmpty = exports.isFunction = exports.isArray = exports.isString = exports.isObject = exports.resolveLocal = exports.resolveUserPath = exports.isAbsolutePath = exports.getAbsolutePath = exports.getRelativePath = exports.getAssetPath = void 0;
|
|
7
|
-
/*
|
|
8
|
-
* Tencent is pleased to support the open source community by making
|
|
9
|
-
* 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
|
|
10
|
-
*
|
|
11
|
-
* Copyright (C) 2021 Tencent. All rights reserved.
|
|
12
|
-
*
|
|
13
|
-
* 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
|
|
14
|
-
*
|
|
15
|
-
* License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
|
|
16
|
-
*
|
|
17
|
-
* ---------------------------------------------------
|
|
18
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
19
|
-
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
|
|
20
|
-
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
|
|
21
|
-
* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
22
|
-
*
|
|
23
|
-
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
|
|
24
|
-
* the Software.
|
|
25
|
-
*
|
|
26
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
|
27
|
-
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
28
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
29
|
-
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
30
|
-
* IN THE SOFTWARE.
|
|
31
|
-
*/
|
|
32
|
-
const semver_1 = __importDefault(require('../../../../semver/index.js'));
|
|
33
|
-
const path_1 = require('../tools/rust/helper/path.js');
|
|
34
|
-
/**
|
|
35
|
-
* 获取资源路径
|
|
36
|
-
* @param options 配置
|
|
37
|
-
* @param filePath 文件路径
|
|
38
|
-
* @returns 资源路径
|
|
39
|
-
*/
|
|
40
|
-
const getAssetPath = (options, filePath) => (options.outputAssetsDirName
|
|
41
|
-
? path_1.posix.join(options.outputAssetsDirName, filePath)
|
|
42
|
-
: filePath);
|
|
43
|
-
exports.getAssetPath = getAssetPath;
|
|
44
|
-
/**
|
|
45
|
-
* 获取相对路径
|
|
46
|
-
* @param workDir 项目路径
|
|
47
|
-
* @param absolutePath 绝对路径
|
|
48
|
-
* @returns 相对路径
|
|
49
|
-
*/
|
|
50
|
-
const getRelativePath = (from, to) => {
|
|
51
|
-
// 获取相对路径
|
|
52
|
-
let relativePath = (0, path_1.relative)(from, to);
|
|
53
|
-
// 处理空路径的情况
|
|
54
|
-
if (!relativePath) {
|
|
55
|
-
return '.';
|
|
56
|
-
}
|
|
57
|
-
// 如果是当前目录,直接返回 ./
|
|
58
|
-
if (relativePath === '.') {
|
|
59
|
-
return relativePath;
|
|
60
|
-
}
|
|
61
|
-
// 如果不是以 . 或 .. 开头,添加 ./
|
|
62
|
-
if (!relativePath.startsWith('.')) {
|
|
63
|
-
relativePath = `./${relativePath}`;
|
|
64
|
-
}
|
|
65
|
-
return relativePath;
|
|
66
|
-
};
|
|
67
|
-
exports.getRelativePath = getRelativePath;
|
|
68
|
-
/**
|
|
69
|
-
* 返回资源绝对路径
|
|
70
|
-
* @param workDir 项目路径
|
|
71
|
-
* @param paths 资源相对路径
|
|
72
|
-
* @returns 绝对路径
|
|
73
|
-
*/
|
|
74
|
-
const getAbsolutePath = (workDir, ...paths) => (0, path_1.resolve)(workDir, ...paths.filter(v => v));
|
|
75
|
-
exports.getAbsolutePath = getAbsolutePath;
|
|
76
|
-
/**
|
|
77
|
-
* 判断是否是绝对路径
|
|
78
|
-
* @param userPath 路径
|
|
79
|
-
* @returns 是否是绝对路径
|
|
80
|
-
*/
|
|
81
|
-
const isAbsolutePath = (userPath) => (0, path_1.isAbsolute)(userPath);
|
|
82
|
-
exports.isAbsolutePath = isAbsolutePath;
|
|
83
|
-
/**
|
|
84
|
-
* 处理用户输入的路径,如果是绝对路径直接返回,如果是相对路径,返回绝对路径
|
|
85
|
-
* @param workDir 用户目录
|
|
86
|
-
* @param userPath 文件路径
|
|
87
|
-
* @returns 文件绝对路径
|
|
88
|
-
*/
|
|
89
|
-
const resolveUserPath = (workDir, userPath) => {
|
|
90
|
-
if ((0, exports.isAbsolutePath)(userPath)) {
|
|
91
|
-
return userPath;
|
|
92
|
-
}
|
|
93
|
-
return (0, exports.getAbsolutePath)(workDir, userPath);
|
|
94
|
-
};
|
|
95
|
-
exports.resolveUserPath = resolveUserPath;
|
|
96
|
-
/**
|
|
97
|
-
* 返回 cli service 所以目录的相对目录
|
|
98
|
-
* @param workDir 用户目录
|
|
99
|
-
* @param _path 文件路径
|
|
100
|
-
* @returns 文件绝对路径
|
|
101
|
-
*/
|
|
102
|
-
const resolveLocal = (...dirs) => (0, path_1.join)(__dirname, '../../', ...dirs);
|
|
103
|
-
exports.resolveLocal = resolveLocal;
|
|
104
|
-
/**
|
|
105
|
-
* 判断值是否为对象
|
|
106
|
-
* @param { unknown } target 值
|
|
107
|
-
* @returns boolean
|
|
108
|
-
*/
|
|
109
|
-
const isObject = (target) => Object.prototype.toString.call(target) === '[object Object]';
|
|
110
|
-
exports.isObject = isObject;
|
|
111
|
-
/**
|
|
112
|
-
* 判断值是否为字符串
|
|
113
|
-
* @param { unknown } target 值
|
|
114
|
-
* @returns boolean
|
|
115
|
-
*/
|
|
116
|
-
const isString = (target) => typeof target === 'string';
|
|
117
|
-
exports.isString = isString;
|
|
118
|
-
/**
|
|
119
|
-
* 判断值是否为数组
|
|
120
|
-
* @param { unknown } target 值
|
|
121
|
-
* @returns boolean
|
|
122
|
-
*/
|
|
123
|
-
const isArray = (target) => Array.isArray(target);
|
|
124
|
-
exports.isArray = isArray;
|
|
125
|
-
/**
|
|
126
|
-
* 判断值是否为函数
|
|
127
|
-
* @param { unknown } target 值
|
|
128
|
-
* @returns boolean
|
|
129
|
-
*/
|
|
130
|
-
const isFunction = (target) => Object.prototype.toString.call(target) === '[object Function]';
|
|
131
|
-
exports.isFunction = isFunction;
|
|
132
|
-
/**
|
|
133
|
-
* 判断值是否为空
|
|
134
|
-
* @param { unknown } value 值
|
|
135
|
-
* @returns boolean
|
|
136
|
-
*/
|
|
137
|
-
const isEmpty = (value) => {
|
|
138
|
-
if (value === ''
|
|
139
|
-
|| value === null
|
|
140
|
-
|| value === undefined) {
|
|
141
|
-
return true;
|
|
142
|
-
}
|
|
143
|
-
if (Array.isArray(value) && value.length < 1) {
|
|
144
|
-
return true;
|
|
145
|
-
}
|
|
146
|
-
if ((0, exports.isObject)(value) && Object.keys(value).length < 1) {
|
|
147
|
-
return true;
|
|
148
|
-
}
|
|
149
|
-
return false;
|
|
150
|
-
};
|
|
151
|
-
exports.isEmpty = isEmpty;
|
|
152
|
-
/**
|
|
153
|
-
* 获取 vue 版本
|
|
154
|
-
* @returns vue 版本
|
|
155
|
-
*/
|
|
156
|
-
const getVueVersion = () => {
|
|
157
|
-
let vue;
|
|
158
|
-
try {
|
|
159
|
-
vue = require('vue');
|
|
160
|
-
}
|
|
161
|
-
catch (error) {
|
|
162
|
-
}
|
|
163
|
-
const vueVersion = vue ? semver_1.default.major(vue.version) : undefined;
|
|
164
|
-
return vueVersion;
|
|
165
|
-
};
|
|
166
|
-
exports.getVueVersion = getVueVersion;
|
|
167
|
-
/**
|
|
168
|
-
* deep merge
|
|
169
|
-
* @param target 目标对象
|
|
170
|
-
* @param source 源对象
|
|
171
|
-
* @returns 深度合并对象
|
|
172
|
-
*/
|
|
173
|
-
const deepMerge = (target, source) => {
|
|
174
|
-
const result = { ...target };
|
|
175
|
-
for (const [key, value] of Object.entries(source)) {
|
|
176
|
-
if (value && typeof value === 'object' && !Array.isArray(value)) {
|
|
177
|
-
if (target[key] && typeof target[key] === 'object' && !Array.isArray(target[key])) {
|
|
178
|
-
result[key] = (0, exports.deepMerge)(target[key], value);
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
result[key] = value;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
-
result[key] = value;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
return result;
|
|
189
|
-
};
|
|
190
|
-
exports.deepMerge = deepMerge;
|
|
191
|
-
/**
|
|
192
|
-
* 获取唯一 id
|
|
193
|
-
* @returns 唯一 id
|
|
194
|
-
*/
|
|
195
|
-
const getUniqueId = (len = 8) => Math.random().toString(36)
|
|
196
|
-
.substring(2, 2 + len);
|
|
197
|
-
exports.getUniqueId = getUniqueId;
|
|
198
|
-
/**
|
|
199
|
-
* 判断是否是 node 内置模块
|
|
200
|
-
* @param moduleName 模块名
|
|
201
|
-
* @returns 是否是 node 内置模块
|
|
202
|
-
*/
|
|
203
|
-
const isNodeBuiltInModule = (moduleName) => {
|
|
204
|
-
if (moduleName.startsWith('node:'))
|
|
205
|
-
return true;
|
|
206
|
-
const nodeBuiltinModules = [
|
|
207
|
-
'fs', 'path', 'http', 'https', 'url', 'os', 'util', 'stream',
|
|
208
|
-
'events', 'crypto', 'zlib', 'buffer', 'child_process', 'cluster',
|
|
209
|
-
'dns', 'net', 'querystring', 'readline', 'string_decoder', 'tls',
|
|
210
|
-
'tty', 'dgram', 'v8', 'vm', 'worker_threads', 'perf_hooks', 'assert',
|
|
211
|
-
'constants',
|
|
212
|
-
];
|
|
213
|
-
return nodeBuiltinModules.includes(moduleName);
|
|
214
|
-
};
|
|
215
|
-
exports.isNodeBuiltInModule = isNodeBuiltInModule;
|
|
216
|
-
/**
|
|
217
|
-
* 获取文件名
|
|
218
|
-
* @param filePath 文件路径
|
|
219
|
-
* @returns 文件名
|
|
220
|
-
*/
|
|
221
|
-
const getFileName = (filePath) => {
|
|
222
|
-
return (0, path_1.basename)(filePath, (0, path_1.extname)(filePath));
|
|
223
|
-
};
|
|
224
|
-
exports.getFileName = getFileName;
|
|
225
|
-
/**
|
|
226
|
-
* 获取文件所在文件夹的名称
|
|
227
|
-
* @param filePath 文件路径
|
|
228
|
-
* @returns 文件夹名称
|
|
229
|
-
*/
|
|
230
|
-
const getDirName = (filePath) => {
|
|
231
|
-
return (0, path_1.dirname)(filePath);
|
|
232
|
-
};
|
|
233
|
-
exports.getDirName = getDirName;
|
|
@@ -1,172 +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.parseDependencyQueryAndHash = exports.getDependencyQueryAndHash = exports.getAbsoluteDependencyPath = exports.isPathMatchExternal = exports.resolveOutputAbsoluteFilePath = exports.resolveFilePath = void 0;
|
|
7
|
-
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
-
const util_1 = require('../../../lib/util.js');
|
|
9
|
-
const path_1 = require('../../../lib/path.js');
|
|
10
|
-
/**
|
|
11
|
-
* 解析文件路径,有一些简写会导致访问不到文件
|
|
12
|
-
* @param filePath 文件路径
|
|
13
|
-
* @returns 解析后的路径
|
|
14
|
-
*/
|
|
15
|
-
const resolveFilePath = (filePath) => {
|
|
16
|
-
if (node_fs_1.default.existsSync(filePath) && node_fs_1.default.statSync(filePath).isFile()) {
|
|
17
|
-
return filePath;
|
|
18
|
-
}
|
|
19
|
-
// 如果是目录且存在 package.json,则认为是一个包
|
|
20
|
-
if (node_fs_1.default.existsSync(filePath) && node_fs_1.default.statSync(filePath).isDirectory() && node_fs_1.default.existsSync(`${filePath}/package.json`)) {
|
|
21
|
-
const packageJson = JSON.parse(node_fs_1.default.readFileSync(`${filePath}/package.json`, 'utf-8'));
|
|
22
|
-
if (packageJson.main) {
|
|
23
|
-
return (0, path_1.resolve)(filePath, packageJson.main);
|
|
24
|
-
}
|
|
25
|
-
if (packageJson.module) {
|
|
26
|
-
return (0, path_1.resolve)(filePath, packageJson.module);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
const jsPath = `${filePath}.js`;
|
|
30
|
-
if (node_fs_1.default.existsSync(jsPath)) {
|
|
31
|
-
return jsPath;
|
|
32
|
-
}
|
|
33
|
-
const tsPath = `${filePath}.ts`;
|
|
34
|
-
if (node_fs_1.default.existsSync(tsPath)) {
|
|
35
|
-
return tsPath;
|
|
36
|
-
}
|
|
37
|
-
const tsxPath = `${filePath}.tsx`;
|
|
38
|
-
if (node_fs_1.default.existsSync(tsxPath)) {
|
|
39
|
-
return tsxPath;
|
|
40
|
-
}
|
|
41
|
-
const jsxPath = `${filePath}.jsx`;
|
|
42
|
-
if (node_fs_1.default.existsSync(jsxPath)) {
|
|
43
|
-
return jsxPath;
|
|
44
|
-
}
|
|
45
|
-
const indexJsPath = `${filePath}/index.js`;
|
|
46
|
-
if (node_fs_1.default.existsSync(indexJsPath)) {
|
|
47
|
-
return indexJsPath;
|
|
48
|
-
}
|
|
49
|
-
const indexTsPath = `${filePath}/index.ts`;
|
|
50
|
-
if (node_fs_1.default.existsSync(indexTsPath)) {
|
|
51
|
-
return indexTsPath;
|
|
52
|
-
}
|
|
53
|
-
const indexVuePath = `${filePath}/index.vue`;
|
|
54
|
-
if (node_fs_1.default.existsSync(indexVuePath)) {
|
|
55
|
-
return indexVuePath;
|
|
56
|
-
}
|
|
57
|
-
const indexTsxPath = `${filePath}/index.tsx`;
|
|
58
|
-
if (node_fs_1.default.existsSync(indexTsxPath)) {
|
|
59
|
-
return indexTsxPath;
|
|
60
|
-
}
|
|
61
|
-
const indexJsxPath = `${filePath}/index.jsx`;
|
|
62
|
-
if (node_fs_1.default.existsSync(indexJsxPath)) {
|
|
63
|
-
return indexJsxPath;
|
|
64
|
-
}
|
|
65
|
-
return filePath;
|
|
66
|
-
};
|
|
67
|
-
exports.resolveFilePath = resolveFilePath;
|
|
68
|
-
/**
|
|
69
|
-
* 解析输出路径
|
|
70
|
-
* @param outputAbsoluteFilePath 输出路径
|
|
71
|
-
* @param context 上下文
|
|
72
|
-
* @returns 解析后的路径
|
|
73
|
-
*/
|
|
74
|
-
const resolveOutputAbsoluteFilePath = (outputAbsoluteFilePath, context) => {
|
|
75
|
-
if (outputAbsoluteFilePath.includes('node_modules')) {
|
|
76
|
-
return outputAbsoluteFilePath.replace(/.+node_modules\/(.+)/, `${context.workDir}/${context.options.preserveModulesRoot ? `${context.options.preserveModulesRoot}/` : ''}node_modules/$1`);
|
|
77
|
-
}
|
|
78
|
-
return outputAbsoluteFilePath;
|
|
79
|
-
};
|
|
80
|
-
exports.resolveOutputAbsoluteFilePath = resolveOutputAbsoluteFilePath;
|
|
81
|
-
/**
|
|
82
|
-
* 判断路径是否是 External 的路径
|
|
83
|
-
* @param filePath 文件路径
|
|
84
|
-
* @param context 上下文
|
|
85
|
-
* @returns 是否匹配
|
|
86
|
-
*/
|
|
87
|
-
const isPathMatchExternal = (filePath, context) => {
|
|
88
|
-
const externals = context.options.configureWebpack?.externals || {};
|
|
89
|
-
const externalKeys = Object.keys(externals);
|
|
90
|
-
let isMatch = false;
|
|
91
|
-
externalKeys.forEach((key) => {
|
|
92
|
-
if (key === filePath) {
|
|
93
|
-
isMatch = true;
|
|
94
|
-
}
|
|
95
|
-
if (filePath.startsWith(`${key}/`)) {
|
|
96
|
-
isMatch = true;
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
return isMatch;
|
|
100
|
-
};
|
|
101
|
-
exports.isPathMatchExternal = isPathMatchExternal;
|
|
102
|
-
/**
|
|
103
|
-
* 获取依赖的绝对路径
|
|
104
|
-
* @param dependencyPath 引入依赖的路径
|
|
105
|
-
* @param originAbsoluteFilePath 引入方的绝对路径
|
|
106
|
-
* @param context 上下文
|
|
107
|
-
* @returns 依赖的绝对路径
|
|
108
|
-
*/
|
|
109
|
-
const getAbsoluteDependencyPath = (dependencyPath, originAbsoluteFilePath, context) => {
|
|
110
|
-
let toPath = dependencyPath;
|
|
111
|
-
const aliasMap = {
|
|
112
|
-
'@': (0, util_1.getAbsolutePath)(context.workDir, 'src'),
|
|
113
|
-
};
|
|
114
|
-
// 用户配置的 alias
|
|
115
|
-
Object.keys(context.options.configureWebpack?.resolve?.alias || {}).forEach((key) => {
|
|
116
|
-
aliasMap[key] = (0, util_1.resolveUserPath)(context.workDir, context.options.configureWebpack.resolve.alias[key]);
|
|
117
|
-
});
|
|
118
|
-
// 替换 alias 路径
|
|
119
|
-
let aliasKey = '';
|
|
120
|
-
let aliasValue = '';
|
|
121
|
-
// 遍历 aliasMap 替换路径
|
|
122
|
-
Object.keys(aliasMap).forEach((key) => {
|
|
123
|
-
// 命中别名,最长命中优先级更高
|
|
124
|
-
if (toPath.startsWith(key) && key.length > aliasKey.length) {
|
|
125
|
-
aliasKey = key;
|
|
126
|
-
aliasValue = aliasMap[key];
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
if (aliasKey && aliasValue) {
|
|
130
|
-
toPath = toPath.replace(aliasKey, aliasValue);
|
|
131
|
-
}
|
|
132
|
-
return (0, util_1.resolveUserPath)((0, util_1.getDirName)(originAbsoluteFilePath), toPath);
|
|
133
|
-
};
|
|
134
|
-
exports.getAbsoluteDependencyPath = getAbsoluteDependencyPath;
|
|
135
|
-
/**
|
|
136
|
-
* 获取依赖的参数
|
|
137
|
-
* @param dependency 依赖
|
|
138
|
-
* @returns 参数
|
|
139
|
-
*/
|
|
140
|
-
const getDependencyQueryAndHash = (dependency) => {
|
|
141
|
-
let queryAndHash = '';
|
|
142
|
-
if (dependency.query) {
|
|
143
|
-
queryAndHash += `?${dependency.query}`;
|
|
144
|
-
}
|
|
145
|
-
if (dependency.hash) {
|
|
146
|
-
queryAndHash += `#${dependency.hash}`;
|
|
147
|
-
}
|
|
148
|
-
return queryAndHash;
|
|
149
|
-
};
|
|
150
|
-
exports.getDependencyQueryAndHash = getDependencyQueryAndHash;
|
|
151
|
-
/**
|
|
152
|
-
* 解析依赖参数
|
|
153
|
-
* @param originDependencyPath 原始引用路径
|
|
154
|
-
* @returns 引用参数
|
|
155
|
-
*/
|
|
156
|
-
const parseDependencyQueryAndHash = (originDependencyPath) => {
|
|
157
|
-
let hash = '';
|
|
158
|
-
let query = '';
|
|
159
|
-
let dependencyPath = originDependencyPath;
|
|
160
|
-
if (dependencyPath.includes('#')) {
|
|
161
|
-
[dependencyPath, hash] = dependencyPath.split('#');
|
|
162
|
-
}
|
|
163
|
-
if (dependencyPath.includes('?')) {
|
|
164
|
-
[dependencyPath, query] = dependencyPath.split('?');
|
|
165
|
-
}
|
|
166
|
-
return {
|
|
167
|
-
dependencyPath,
|
|
168
|
-
hash,
|
|
169
|
-
query,
|
|
170
|
-
};
|
|
171
|
-
};
|
|
172
|
-
exports.parseDependencyQueryAndHash = parseDependencyQueryAndHash;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = exports.Ajv = void 0;
|
|
4
|
-
const core_1 = require('./core.js');
|
|
5
|
-
const draft7_1 = require('./vocabularies/draft7.js');
|
|
6
|
-
const discriminator_1 = require('./vocabularies/discriminator/index.js');
|
|
7
|
-
const draft7MetaSchema = require('./refs/json-schema-draft-07.json');
|
|
8
|
-
const META_SUPPORT_DATA = ["/properties"];
|
|
9
|
-
const META_SCHEMA_ID = "http://json-schema.org/draft-07/schema";
|
|
10
|
-
class Ajv extends core_1.default {
|
|
11
|
-
_addVocabularies() {
|
|
12
|
-
super._addVocabularies();
|
|
13
|
-
draft7_1.default.forEach((v) => this.addVocabulary(v));
|
|
14
|
-
if (this.opts.discriminator)
|
|
15
|
-
this.addKeyword(discriminator_1.default);
|
|
16
|
-
}
|
|
17
|
-
_addDefaultMetaSchema() {
|
|
18
|
-
super._addDefaultMetaSchema();
|
|
19
|
-
if (!this.opts.meta)
|
|
20
|
-
return;
|
|
21
|
-
const metaSchema = this.opts.$data
|
|
22
|
-
? this.$dataMetaSchema(draft7MetaSchema, META_SUPPORT_DATA)
|
|
23
|
-
: draft7MetaSchema;
|
|
24
|
-
this.addMetaSchema(metaSchema, META_SCHEMA_ID, false);
|
|
25
|
-
this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID;
|
|
26
|
-
}
|
|
27
|
-
defaultMeta() {
|
|
28
|
-
return (this.opts.defaultMeta =
|
|
29
|
-
super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined));
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
exports.Ajv = Ajv;
|
|
33
|
-
module.exports = exports = Ajv;
|
|
34
|
-
module.exports.Ajv = Ajv;
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.default = Ajv;
|
|
37
|
-
var validate_1 = require('./compile/validate/index.js');
|
|
38
|
-
Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } });
|
|
39
|
-
var codegen_1 = require('./compile/codegen/index.js');
|
|
40
|
-
Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } });
|
|
41
|
-
Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } });
|
|
42
|
-
Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } });
|
|
43
|
-
Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } });
|
|
44
|
-
Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } });
|
|
45
|
-
Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } });
|
|
46
|
-
var validation_error_1 = require('./runtime/validation_error.js');
|
|
47
|
-
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return validation_error_1.default; } });
|
|
48
|
-
var ref_error_1 = require('./compile/ref_error.js');
|
|
49
|
-
Object.defineProperty(exports, "MissingRefError", { enumerable: true, get: function () { return ref_error_1.default; } });
|
|
50
|
-
//# sourceMappingURL=ajv.js.map
|