@tachybase/module-cloud-component 0.23.8

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 (109) hide show
  1. package/.turbo/turbo-build.log +9 -0
  2. package/README.md +1 -0
  3. package/client.d.ts +2 -0
  4. package/client.js +1 -0
  5. package/dist/client/CloudComponent.provider.d.ts +2 -0
  6. package/dist/client/cloud-library-manager/CloudLibrary.collection.d.ts +2 -0
  7. package/dist/client/cloud-library-manager/CloudLibraryManager.d.ts +2 -0
  8. package/dist/client/cloud-library-manager/CloudLibraryManager.fields.d.ts +82 -0
  9. package/dist/client/cloud-library-manager/CloudLibraryManager.schema.d.ts +1075 -0
  10. package/dist/client/components/CloudComponentLink.d.ts +2 -0
  11. package/dist/client/components/ComponentEditor.d.ts +6 -0
  12. package/dist/client/components/MarkdownEditor.d.ts +9 -0
  13. package/dist/client/components/Preview.d.ts +9 -0
  14. package/dist/client/index.d.ts +8 -0
  15. package/dist/client/index.js +1107 -0
  16. package/dist/client/locale.d.ts +9 -0
  17. package/dist/client/settings/CloudComponentBlock.d.ts +4 -0
  18. package/dist/client/settings/InitializerItem.d.ts +2 -0
  19. package/dist/client/settings/schema.d.ts +2 -0
  20. package/dist/client/settings/settings.d.ts +2 -0
  21. package/dist/externalVersion.js +15 -0
  22. package/dist/index.d.ts +2 -0
  23. package/dist/index.js +39 -0
  24. package/dist/locale/en-US.json +12 -0
  25. package/dist/locale/zh-CN.json +12 -0
  26. package/dist/node_modules/@babel/core/LICENSE +22 -0
  27. package/dist/node_modules/@babel/core/cjs-proxy.cjs +68 -0
  28. package/dist/node_modules/@babel/core/lib/config/cache-contexts.js +3 -0
  29. package/dist/node_modules/@babel/core/lib/config/caching.js +261 -0
  30. package/dist/node_modules/@babel/core/lib/config/config-chain.js +469 -0
  31. package/dist/node_modules/@babel/core/lib/config/config-descriptors.js +190 -0
  32. package/dist/node_modules/@babel/core/lib/config/files/configuration.js +287 -0
  33. package/dist/node_modules/@babel/core/lib/config/files/import.cjs +6 -0
  34. package/dist/node_modules/@babel/core/lib/config/files/index-browser.js +58 -0
  35. package/dist/node_modules/@babel/core/lib/config/files/index.js +78 -0
  36. package/dist/node_modules/@babel/core/lib/config/files/module-types.js +195 -0
  37. package/dist/node_modules/@babel/core/lib/config/files/package.js +61 -0
  38. package/dist/node_modules/@babel/core/lib/config/files/plugins.js +229 -0
  39. package/dist/node_modules/@babel/core/lib/config/files/types.js +3 -0
  40. package/dist/node_modules/@babel/core/lib/config/files/utils.js +36 -0
  41. package/dist/node_modules/@babel/core/lib/config/full.js +312 -0
  42. package/dist/node_modules/@babel/core/lib/config/helpers/config-api.js +84 -0
  43. package/dist/node_modules/@babel/core/lib/config/helpers/deep-array.js +23 -0
  44. package/dist/node_modules/@babel/core/lib/config/helpers/environment.js +12 -0
  45. package/dist/node_modules/@babel/core/lib/config/index.js +93 -0
  46. package/dist/node_modules/@babel/core/lib/config/item.js +67 -0
  47. package/dist/node_modules/@babel/core/lib/config/partial.js +158 -0
  48. package/dist/node_modules/@babel/core/lib/config/pattern-to-regex.js +38 -0
  49. package/dist/node_modules/@babel/core/lib/config/plugin.js +33 -0
  50. package/dist/node_modules/@babel/core/lib/config/printer.js +113 -0
  51. package/dist/node_modules/@babel/core/lib/config/resolve-targets-browser.js +41 -0
  52. package/dist/node_modules/@babel/core/lib/config/resolve-targets.js +61 -0
  53. package/dist/node_modules/@babel/core/lib/config/util.js +31 -0
  54. package/dist/node_modules/@babel/core/lib/config/validation/option-assertions.js +277 -0
  55. package/dist/node_modules/@babel/core/lib/config/validation/options.js +189 -0
  56. package/dist/node_modules/@babel/core/lib/config/validation/plugins.js +67 -0
  57. package/dist/node_modules/@babel/core/lib/config/validation/removed.js +68 -0
  58. package/dist/node_modules/@babel/core/lib/errors/config-error.js +18 -0
  59. package/dist/node_modules/@babel/core/lib/errors/rewrite-stack-trace.js +98 -0
  60. package/dist/node_modules/@babel/core/lib/gensync-utils/async.js +90 -0
  61. package/dist/node_modules/@babel/core/lib/gensync-utils/fs.js +31 -0
  62. package/dist/node_modules/@babel/core/lib/gensync-utils/functional.js +58 -0
  63. package/dist/node_modules/@babel/core/lib/index.js +227 -0
  64. package/dist/node_modules/@babel/core/lib/parse.js +47 -0
  65. package/dist/node_modules/@babel/core/lib/parser/index.js +79 -0
  66. package/dist/node_modules/@babel/core/lib/parser/util/missing-plugin-helper.js +339 -0
  67. package/dist/node_modules/@babel/core/lib/tools/build-external-helpers.js +144 -0
  68. package/dist/node_modules/@babel/core/lib/transform-ast.js +50 -0
  69. package/dist/node_modules/@babel/core/lib/transform-file-browser.js +23 -0
  70. package/dist/node_modules/@babel/core/lib/transform-file.js +40 -0
  71. package/dist/node_modules/@babel/core/lib/transform.js +49 -0
  72. package/dist/node_modules/@babel/core/lib/transformation/block-hoist-plugin.js +84 -0
  73. package/dist/node_modules/@babel/core/lib/transformation/file/babel-7-helpers.cjs +4 -0
  74. package/dist/node_modules/@babel/core/lib/transformation/file/file.js +214 -0
  75. package/dist/node_modules/@babel/core/lib/transformation/file/generate.js +84 -0
  76. package/dist/node_modules/@babel/core/lib/transformation/file/merge-map.js +37 -0
  77. package/dist/node_modules/@babel/core/lib/transformation/index.js +92 -0
  78. package/dist/node_modules/@babel/core/lib/transformation/normalize-file.js +129 -0
  79. package/dist/node_modules/@babel/core/lib/transformation/normalize-opts.js +59 -0
  80. package/dist/node_modules/@babel/core/lib/transformation/plugin-pass.js +50 -0
  81. package/dist/node_modules/@babel/core/lib/transformation/util/clone-deep.js +36 -0
  82. package/dist/node_modules/@babel/core/lib/vendor/import-meta-resolve.js +1043 -0
  83. package/dist/node_modules/@babel/core/node_modules/.bin/json5 +17 -0
  84. package/dist/node_modules/@babel/core/node_modules/.bin/parser +17 -0
  85. package/dist/node_modules/@babel/core/node_modules/.bin/semver +17 -0
  86. package/dist/node_modules/@babel/core/package.json +1 -0
  87. package/dist/node_modules/@babel/core/src/config/files/index-browser.ts +113 -0
  88. package/dist/node_modules/@babel/core/src/config/files/index.ts +29 -0
  89. package/dist/node_modules/@babel/core/src/config/resolve-targets-browser.ts +40 -0
  90. package/dist/node_modules/@babel/core/src/config/resolve-targets.ts +56 -0
  91. package/dist/node_modules/@babel/core/src/transform-file-browser.ts +31 -0
  92. package/dist/node_modules/@babel/core/src/transform-file.ts +55 -0
  93. package/dist/server/actions/cloud-libraries-controller.d.ts +7 -0
  94. package/dist/server/actions/cloud-libraries-controller.js +147 -0
  95. package/dist/server/collections/cloud-libraries.d.ts +2 -0
  96. package/dist/server/collections/cloud-libraries.js +98 -0
  97. package/dist/server/collections/effect-libraries.d.ts +2 -0
  98. package/dist/server/collections/effect-libraries.js +78 -0
  99. package/dist/server/index.d.ts +1 -0
  100. package/dist/server/index.js +33 -0
  101. package/dist/server/plugin.d.ts +4 -0
  102. package/dist/server/plugin.js +87 -0
  103. package/dist/server/services/cloud-compiler.d.ts +8 -0
  104. package/dist/server/services/cloud-compiler.js +116 -0
  105. package/dist/server/services/cloud-libraries-service.d.ts +11 -0
  106. package/dist/server/services/cloud-libraries-service.js +196 -0
  107. package/package.json +44 -0
  108. package/server.d.ts +2 -0
  109. package/server.js +1 -0
@@ -0,0 +1,277 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.access = access;
7
+ exports.assertArray = assertArray;
8
+ exports.assertAssumptions = assertAssumptions;
9
+ exports.assertBabelrcSearch = assertBabelrcSearch;
10
+ exports.assertBoolean = assertBoolean;
11
+ exports.assertCallerMetadata = assertCallerMetadata;
12
+ exports.assertCompact = assertCompact;
13
+ exports.assertConfigApplicableTest = assertConfigApplicableTest;
14
+ exports.assertConfigFileSearch = assertConfigFileSearch;
15
+ exports.assertFunction = assertFunction;
16
+ exports.assertIgnoreList = assertIgnoreList;
17
+ exports.assertInputSourceMap = assertInputSourceMap;
18
+ exports.assertObject = assertObject;
19
+ exports.assertPluginList = assertPluginList;
20
+ exports.assertRootMode = assertRootMode;
21
+ exports.assertSourceMaps = assertSourceMaps;
22
+ exports.assertSourceType = assertSourceType;
23
+ exports.assertString = assertString;
24
+ exports.assertTargets = assertTargets;
25
+ exports.msg = msg;
26
+ function _helperCompilationTargets() {
27
+ const data = require("@babel/helper-compilation-targets");
28
+ _helperCompilationTargets = function () {
29
+ return data;
30
+ };
31
+ return data;
32
+ }
33
+ var _options = require("./options.js");
34
+ function msg(loc) {
35
+ switch (loc.type) {
36
+ case "root":
37
+ return ``;
38
+ case "env":
39
+ return `${msg(loc.parent)}.env["${loc.name}"]`;
40
+ case "overrides":
41
+ return `${msg(loc.parent)}.overrides[${loc.index}]`;
42
+ case "option":
43
+ return `${msg(loc.parent)}.${loc.name}`;
44
+ case "access":
45
+ return `${msg(loc.parent)}[${JSON.stringify(loc.name)}]`;
46
+ default:
47
+ throw new Error(`Assertion failure: Unknown type ${loc.type}`);
48
+ }
49
+ }
50
+ function access(loc, name) {
51
+ return {
52
+ type: "access",
53
+ name,
54
+ parent: loc
55
+ };
56
+ }
57
+ function assertRootMode(loc, value) {
58
+ if (value !== undefined && value !== "root" && value !== "upward" && value !== "upward-optional") {
59
+ throw new Error(`${msg(loc)} must be a "root", "upward", "upward-optional" or undefined`);
60
+ }
61
+ return value;
62
+ }
63
+ function assertSourceMaps(loc, value) {
64
+ if (value !== undefined && typeof value !== "boolean" && value !== "inline" && value !== "both") {
65
+ throw new Error(`${msg(loc)} must be a boolean, "inline", "both", or undefined`);
66
+ }
67
+ return value;
68
+ }
69
+ function assertCompact(loc, value) {
70
+ if (value !== undefined && typeof value !== "boolean" && value !== "auto") {
71
+ throw new Error(`${msg(loc)} must be a boolean, "auto", or undefined`);
72
+ }
73
+ return value;
74
+ }
75
+ function assertSourceType(loc, value) {
76
+ if (value !== undefined && value !== "module" && value !== "script" && value !== "unambiguous") {
77
+ throw new Error(`${msg(loc)} must be "module", "script", "unambiguous", or undefined`);
78
+ }
79
+ return value;
80
+ }
81
+ function assertCallerMetadata(loc, value) {
82
+ const obj = assertObject(loc, value);
83
+ if (obj) {
84
+ if (typeof obj.name !== "string") {
85
+ throw new Error(`${msg(loc)} set but does not contain "name" property string`);
86
+ }
87
+ for (const prop of Object.keys(obj)) {
88
+ const propLoc = access(loc, prop);
89
+ const value = obj[prop];
90
+ if (value != null && typeof value !== "boolean" && typeof value !== "string" && typeof value !== "number") {
91
+ throw new Error(`${msg(propLoc)} must be null, undefined, a boolean, a string, or a number.`);
92
+ }
93
+ }
94
+ }
95
+ return value;
96
+ }
97
+ function assertInputSourceMap(loc, value) {
98
+ if (value !== undefined && typeof value !== "boolean" && (typeof value !== "object" || !value)) {
99
+ throw new Error(`${msg(loc)} must be a boolean, object, or undefined`);
100
+ }
101
+ return value;
102
+ }
103
+ function assertString(loc, value) {
104
+ if (value !== undefined && typeof value !== "string") {
105
+ throw new Error(`${msg(loc)} must be a string, or undefined`);
106
+ }
107
+ return value;
108
+ }
109
+ function assertFunction(loc, value) {
110
+ if (value !== undefined && typeof value !== "function") {
111
+ throw new Error(`${msg(loc)} must be a function, or undefined`);
112
+ }
113
+ return value;
114
+ }
115
+ function assertBoolean(loc, value) {
116
+ if (value !== undefined && typeof value !== "boolean") {
117
+ throw new Error(`${msg(loc)} must be a boolean, or undefined`);
118
+ }
119
+ return value;
120
+ }
121
+ function assertObject(loc, value) {
122
+ if (value !== undefined && (typeof value !== "object" || Array.isArray(value) || !value)) {
123
+ throw new Error(`${msg(loc)} must be an object, or undefined`);
124
+ }
125
+ return value;
126
+ }
127
+ function assertArray(loc, value) {
128
+ if (value != null && !Array.isArray(value)) {
129
+ throw new Error(`${msg(loc)} must be an array, or undefined`);
130
+ }
131
+ return value;
132
+ }
133
+ function assertIgnoreList(loc, value) {
134
+ const arr = assertArray(loc, value);
135
+ arr == null || arr.forEach((item, i) => assertIgnoreItem(access(loc, i), item));
136
+ return arr;
137
+ }
138
+ function assertIgnoreItem(loc, value) {
139
+ if (typeof value !== "string" && typeof value !== "function" && !(value instanceof RegExp)) {
140
+ throw new Error(`${msg(loc)} must be an array of string/Function/RegExp values, or undefined`);
141
+ }
142
+ return value;
143
+ }
144
+ function assertConfigApplicableTest(loc, value) {
145
+ if (value === undefined) {
146
+ return value;
147
+ }
148
+ if (Array.isArray(value)) {
149
+ value.forEach((item, i) => {
150
+ if (!checkValidTest(item)) {
151
+ throw new Error(`${msg(access(loc, i))} must be a string/Function/RegExp.`);
152
+ }
153
+ });
154
+ } else if (!checkValidTest(value)) {
155
+ throw new Error(`${msg(loc)} must be a string/Function/RegExp, or an array of those`);
156
+ }
157
+ return value;
158
+ }
159
+ function checkValidTest(value) {
160
+ return typeof value === "string" || typeof value === "function" || value instanceof RegExp;
161
+ }
162
+ function assertConfigFileSearch(loc, value) {
163
+ if (value !== undefined && typeof value !== "boolean" && typeof value !== "string") {
164
+ throw new Error(`${msg(loc)} must be a undefined, a boolean, a string, ` + `got ${JSON.stringify(value)}`);
165
+ }
166
+ return value;
167
+ }
168
+ function assertBabelrcSearch(loc, value) {
169
+ if (value === undefined || typeof value === "boolean") {
170
+ return value;
171
+ }
172
+ if (Array.isArray(value)) {
173
+ value.forEach((item, i) => {
174
+ if (!checkValidTest(item)) {
175
+ throw new Error(`${msg(access(loc, i))} must be a string/Function/RegExp.`);
176
+ }
177
+ });
178
+ } else if (!checkValidTest(value)) {
179
+ throw new Error(`${msg(loc)} must be a undefined, a boolean, a string/Function/RegExp ` + `or an array of those, got ${JSON.stringify(value)}`);
180
+ }
181
+ return value;
182
+ }
183
+ function assertPluginList(loc, value) {
184
+ const arr = assertArray(loc, value);
185
+ if (arr) {
186
+ arr.forEach((item, i) => assertPluginItem(access(loc, i), item));
187
+ }
188
+ return arr;
189
+ }
190
+ function assertPluginItem(loc, value) {
191
+ if (Array.isArray(value)) {
192
+ if (value.length === 0) {
193
+ throw new Error(`${msg(loc)} must include an object`);
194
+ }
195
+ if (value.length > 3) {
196
+ throw new Error(`${msg(loc)} may only be a two-tuple or three-tuple`);
197
+ }
198
+ assertPluginTarget(access(loc, 0), value[0]);
199
+ if (value.length > 1) {
200
+ const opts = value[1];
201
+ if (opts !== undefined && opts !== false && (typeof opts !== "object" || Array.isArray(opts) || opts === null)) {
202
+ throw new Error(`${msg(access(loc, 1))} must be an object, false, or undefined`);
203
+ }
204
+ }
205
+ if (value.length === 3) {
206
+ const name = value[2];
207
+ if (name !== undefined && typeof name !== "string") {
208
+ throw new Error(`${msg(access(loc, 2))} must be a string, or undefined`);
209
+ }
210
+ }
211
+ } else {
212
+ assertPluginTarget(loc, value);
213
+ }
214
+ return value;
215
+ }
216
+ function assertPluginTarget(loc, value) {
217
+ if ((typeof value !== "object" || !value) && typeof value !== "string" && typeof value !== "function") {
218
+ throw new Error(`${msg(loc)} must be a string, object, function`);
219
+ }
220
+ return value;
221
+ }
222
+ function assertTargets(loc, value) {
223
+ if ((0, _helperCompilationTargets().isBrowsersQueryValid)(value)) return value;
224
+ if (typeof value !== "object" || !value || Array.isArray(value)) {
225
+ throw new Error(`${msg(loc)} must be a string, an array of strings or an object`);
226
+ }
227
+ const browsersLoc = access(loc, "browsers");
228
+ const esmodulesLoc = access(loc, "esmodules");
229
+ assertBrowsersList(browsersLoc, value.browsers);
230
+ assertBoolean(esmodulesLoc, value.esmodules);
231
+ for (const key of Object.keys(value)) {
232
+ const val = value[key];
233
+ const subLoc = access(loc, key);
234
+ if (key === "esmodules") assertBoolean(subLoc, val);else if (key === "browsers") assertBrowsersList(subLoc, val);else if (!hasOwnProperty.call(_helperCompilationTargets().TargetNames, key)) {
235
+ const validTargets = Object.keys(_helperCompilationTargets().TargetNames).join(", ");
236
+ throw new Error(`${msg(subLoc)} is not a valid target. Supported targets are ${validTargets}`);
237
+ } else assertBrowserVersion(subLoc, val);
238
+ }
239
+ return value;
240
+ }
241
+ function assertBrowsersList(loc, value) {
242
+ if (value !== undefined && !(0, _helperCompilationTargets().isBrowsersQueryValid)(value)) {
243
+ throw new Error(`${msg(loc)} must be undefined, a string or an array of strings`);
244
+ }
245
+ }
246
+ function assertBrowserVersion(loc, value) {
247
+ if (typeof value === "number" && Math.round(value) === value) return;
248
+ if (typeof value === "string") return;
249
+ throw new Error(`${msg(loc)} must be a string or an integer number`);
250
+ }
251
+ function assertAssumptions(loc, value) {
252
+ if (value === undefined) return;
253
+ if (typeof value !== "object" || value === null) {
254
+ throw new Error(`${msg(loc)} must be an object or undefined.`);
255
+ }
256
+ let root = loc;
257
+ do {
258
+ root = root.parent;
259
+ } while (root.type !== "root");
260
+ const inPreset = root.source === "preset";
261
+ for (const name of Object.keys(value)) {
262
+ const subLoc = access(loc, name);
263
+ if (!_options.assumptionsNames.has(name)) {
264
+ throw new Error(`${msg(subLoc)} is not a supported assumption.`);
265
+ }
266
+ if (typeof value[name] !== "boolean") {
267
+ throw new Error(`${msg(subLoc)} must be a boolean.`);
268
+ }
269
+ if (inPreset && value[name] === false) {
270
+ throw new Error(`${msg(subLoc)} cannot be set to 'false' inside presets.`);
271
+ }
272
+ }
273
+ return value;
274
+ }
275
+ 0 && 0;
276
+
277
+ //# sourceMappingURL=option-assertions.js.map
@@ -0,0 +1,189 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.assumptionsNames = void 0;
7
+ exports.checkNoUnwrappedItemOptionPairs = checkNoUnwrappedItemOptionPairs;
8
+ exports.validate = validate;
9
+ var _removed = require("./removed.js");
10
+ var _optionAssertions = require("./option-assertions.js");
11
+ var _configError = require("../../errors/config-error.js");
12
+ const ROOT_VALIDATORS = {
13
+ cwd: _optionAssertions.assertString,
14
+ root: _optionAssertions.assertString,
15
+ rootMode: _optionAssertions.assertRootMode,
16
+ configFile: _optionAssertions.assertConfigFileSearch,
17
+ caller: _optionAssertions.assertCallerMetadata,
18
+ filename: _optionAssertions.assertString,
19
+ filenameRelative: _optionAssertions.assertString,
20
+ code: _optionAssertions.assertBoolean,
21
+ ast: _optionAssertions.assertBoolean,
22
+ cloneInputAst: _optionAssertions.assertBoolean,
23
+ envName: _optionAssertions.assertString
24
+ };
25
+ const BABELRC_VALIDATORS = {
26
+ babelrc: _optionAssertions.assertBoolean,
27
+ babelrcRoots: _optionAssertions.assertBabelrcSearch
28
+ };
29
+ const NONPRESET_VALIDATORS = {
30
+ extends: _optionAssertions.assertString,
31
+ ignore: _optionAssertions.assertIgnoreList,
32
+ only: _optionAssertions.assertIgnoreList,
33
+ targets: _optionAssertions.assertTargets,
34
+ browserslistConfigFile: _optionAssertions.assertConfigFileSearch,
35
+ browserslistEnv: _optionAssertions.assertString
36
+ };
37
+ const COMMON_VALIDATORS = {
38
+ inputSourceMap: _optionAssertions.assertInputSourceMap,
39
+ presets: _optionAssertions.assertPluginList,
40
+ plugins: _optionAssertions.assertPluginList,
41
+ passPerPreset: _optionAssertions.assertBoolean,
42
+ assumptions: _optionAssertions.assertAssumptions,
43
+ env: assertEnvSet,
44
+ overrides: assertOverridesList,
45
+ test: _optionAssertions.assertConfigApplicableTest,
46
+ include: _optionAssertions.assertConfigApplicableTest,
47
+ exclude: _optionAssertions.assertConfigApplicableTest,
48
+ retainLines: _optionAssertions.assertBoolean,
49
+ comments: _optionAssertions.assertBoolean,
50
+ shouldPrintComment: _optionAssertions.assertFunction,
51
+ compact: _optionAssertions.assertCompact,
52
+ minified: _optionAssertions.assertBoolean,
53
+ auxiliaryCommentBefore: _optionAssertions.assertString,
54
+ auxiliaryCommentAfter: _optionAssertions.assertString,
55
+ sourceType: _optionAssertions.assertSourceType,
56
+ wrapPluginVisitorMethod: _optionAssertions.assertFunction,
57
+ highlightCode: _optionAssertions.assertBoolean,
58
+ sourceMaps: _optionAssertions.assertSourceMaps,
59
+ sourceMap: _optionAssertions.assertSourceMaps,
60
+ sourceFileName: _optionAssertions.assertString,
61
+ sourceRoot: _optionAssertions.assertString,
62
+ parserOpts: _optionAssertions.assertObject,
63
+ generatorOpts: _optionAssertions.assertObject
64
+ };
65
+ {
66
+ Object.assign(COMMON_VALIDATORS, {
67
+ getModuleId: _optionAssertions.assertFunction,
68
+ moduleRoot: _optionAssertions.assertString,
69
+ moduleIds: _optionAssertions.assertBoolean,
70
+ moduleId: _optionAssertions.assertString
71
+ });
72
+ }
73
+ const knownAssumptions = ["arrayLikeIsIterable", "constantReexports", "constantSuper", "enumerableModuleMeta", "ignoreFunctionLength", "ignoreToPrimitiveHint", "iterableIsArray", "mutableTemplateObject", "noClassCalls", "noDocumentAll", "noIncompleteNsImportDetection", "noNewArrows", "noUninitializedPrivateFieldAccess", "objectRestNoSymbols", "privateFieldsAsSymbols", "privateFieldsAsProperties", "pureGetters", "setClassMethods", "setComputedProperties", "setPublicClassFields", "setSpreadProperties", "skipForOfIteratorClosing", "superIsCallableConstructor"];
74
+ const assumptionsNames = exports.assumptionsNames = new Set(knownAssumptions);
75
+ function getSource(loc) {
76
+ return loc.type === "root" ? loc.source : getSource(loc.parent);
77
+ }
78
+ function validate(type, opts, filename) {
79
+ try {
80
+ return validateNested({
81
+ type: "root",
82
+ source: type
83
+ }, opts);
84
+ } catch (error) {
85
+ const configError = new _configError.default(error.message, filename);
86
+ if (error.code) configError.code = error.code;
87
+ throw configError;
88
+ }
89
+ }
90
+ function validateNested(loc, opts) {
91
+ const type = getSource(loc);
92
+ assertNoDuplicateSourcemap(opts);
93
+ Object.keys(opts).forEach(key => {
94
+ const optLoc = {
95
+ type: "option",
96
+ name: key,
97
+ parent: loc
98
+ };
99
+ if (type === "preset" && NONPRESET_VALIDATORS[key]) {
100
+ throw new Error(`${(0, _optionAssertions.msg)(optLoc)} is not allowed in preset options`);
101
+ }
102
+ if (type !== "arguments" && ROOT_VALIDATORS[key]) {
103
+ throw new Error(`${(0, _optionAssertions.msg)(optLoc)} is only allowed in root programmatic options`);
104
+ }
105
+ if (type !== "arguments" && type !== "configfile" && BABELRC_VALIDATORS[key]) {
106
+ if (type === "babelrcfile" || type === "extendsfile") {
107
+ throw new Error(`${(0, _optionAssertions.msg)(optLoc)} is not allowed in .babelrc or "extends"ed files, only in root programmatic options, ` + `or babel.config.js/config file options`);
108
+ }
109
+ throw new Error(`${(0, _optionAssertions.msg)(optLoc)} is only allowed in root programmatic options, or babel.config.js/config file options`);
110
+ }
111
+ const validator = COMMON_VALIDATORS[key] || NONPRESET_VALIDATORS[key] || BABELRC_VALIDATORS[key] || ROOT_VALIDATORS[key] || throwUnknownError;
112
+ validator(optLoc, opts[key]);
113
+ });
114
+ return opts;
115
+ }
116
+ function throwUnknownError(loc) {
117
+ const key = loc.name;
118
+ if (_removed.default[key]) {
119
+ const {
120
+ message,
121
+ version = 5
122
+ } = _removed.default[key];
123
+ throw new Error(`Using removed Babel ${version} option: ${(0, _optionAssertions.msg)(loc)} - ${message}`);
124
+ } else {
125
+ const unknownOptErr = new Error(`Unknown option: ${(0, _optionAssertions.msg)(loc)}. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options.`);
126
+ unknownOptErr.code = "BABEL_UNKNOWN_OPTION";
127
+ throw unknownOptErr;
128
+ }
129
+ }
130
+ function assertNoDuplicateSourcemap(opts) {
131
+ if (hasOwnProperty.call(opts, "sourceMap") && hasOwnProperty.call(opts, "sourceMaps")) {
132
+ throw new Error(".sourceMap is an alias for .sourceMaps, cannot use both");
133
+ }
134
+ }
135
+ function assertEnvSet(loc, value) {
136
+ if (loc.parent.type === "env") {
137
+ throw new Error(`${(0, _optionAssertions.msg)(loc)} is not allowed inside of another .env block`);
138
+ }
139
+ const parent = loc.parent;
140
+ const obj = (0, _optionAssertions.assertObject)(loc, value);
141
+ if (obj) {
142
+ for (const envName of Object.keys(obj)) {
143
+ const env = (0, _optionAssertions.assertObject)((0, _optionAssertions.access)(loc, envName), obj[envName]);
144
+ if (!env) continue;
145
+ const envLoc = {
146
+ type: "env",
147
+ name: envName,
148
+ parent
149
+ };
150
+ validateNested(envLoc, env);
151
+ }
152
+ }
153
+ return obj;
154
+ }
155
+ function assertOverridesList(loc, value) {
156
+ if (loc.parent.type === "env") {
157
+ throw new Error(`${(0, _optionAssertions.msg)(loc)} is not allowed inside an .env block`);
158
+ }
159
+ if (loc.parent.type === "overrides") {
160
+ throw new Error(`${(0, _optionAssertions.msg)(loc)} is not allowed inside an .overrides block`);
161
+ }
162
+ const parent = loc.parent;
163
+ const arr = (0, _optionAssertions.assertArray)(loc, value);
164
+ if (arr) {
165
+ for (const [index, item] of arr.entries()) {
166
+ const objLoc = (0, _optionAssertions.access)(loc, index);
167
+ const env = (0, _optionAssertions.assertObject)(objLoc, item);
168
+ if (!env) throw new Error(`${(0, _optionAssertions.msg)(objLoc)} must be an object`);
169
+ const overridesLoc = {
170
+ type: "overrides",
171
+ index,
172
+ parent
173
+ };
174
+ validateNested(overridesLoc, env);
175
+ }
176
+ }
177
+ return arr;
178
+ }
179
+ function checkNoUnwrappedItemOptionPairs(items, index, type, e) {
180
+ if (index === 0) return;
181
+ const lastItem = items[index - 1];
182
+ const thisItem = items[index];
183
+ if (lastItem.file && lastItem.options === undefined && typeof thisItem.value === "object") {
184
+ e.message += `\n- Maybe you meant to use\n` + `"${type}s": [\n ["${lastItem.file.request}", ${JSON.stringify(thisItem.value, undefined, 2)}]\n]\n` + `To be a valid ${type}, its name and options should be wrapped in a pair of brackets`;
185
+ }
186
+ }
187
+ 0 && 0;
188
+
189
+ //# sourceMappingURL=options.js.map
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.validatePluginObject = validatePluginObject;
7
+ var _optionAssertions = require("./option-assertions.js");
8
+ const VALIDATORS = {
9
+ name: _optionAssertions.assertString,
10
+ manipulateOptions: _optionAssertions.assertFunction,
11
+ pre: _optionAssertions.assertFunction,
12
+ post: _optionAssertions.assertFunction,
13
+ inherits: _optionAssertions.assertFunction,
14
+ visitor: assertVisitorMap,
15
+ parserOverride: _optionAssertions.assertFunction,
16
+ generatorOverride: _optionAssertions.assertFunction
17
+ };
18
+ function assertVisitorMap(loc, value) {
19
+ const obj = (0, _optionAssertions.assertObject)(loc, value);
20
+ if (obj) {
21
+ Object.keys(obj).forEach(prop => {
22
+ if (prop !== "_exploded" && prop !== "_verified") {
23
+ assertVisitorHandler(prop, obj[prop]);
24
+ }
25
+ });
26
+ if (obj.enter || obj.exit) {
27
+ throw new Error(`${(0, _optionAssertions.msg)(loc)} cannot contain catch-all "enter" or "exit" handlers. Please target individual nodes.`);
28
+ }
29
+ }
30
+ return obj;
31
+ }
32
+ function assertVisitorHandler(key, value) {
33
+ if (value && typeof value === "object") {
34
+ Object.keys(value).forEach(handler => {
35
+ if (handler !== "enter" && handler !== "exit") {
36
+ throw new Error(`.visitor["${key}"] may only have .enter and/or .exit handlers.`);
37
+ }
38
+ });
39
+ } else if (typeof value !== "function") {
40
+ throw new Error(`.visitor["${key}"] must be a function`);
41
+ }
42
+ }
43
+ function validatePluginObject(obj) {
44
+ const rootPath = {
45
+ type: "root",
46
+ source: "plugin"
47
+ };
48
+ Object.keys(obj).forEach(key => {
49
+ const validator = VALIDATORS[key];
50
+ if (validator) {
51
+ const optLoc = {
52
+ type: "option",
53
+ name: key,
54
+ parent: rootPath
55
+ };
56
+ validator(optLoc, obj[key]);
57
+ } else {
58
+ const invalidPluginPropertyError = new Error(`.${key} is not a valid Plugin property`);
59
+ invalidPluginPropertyError.code = "BABEL_UNKNOWN_PLUGIN_PROPERTY";
60
+ throw invalidPluginPropertyError;
61
+ }
62
+ });
63
+ return obj;
64
+ }
65
+ 0 && 0;
66
+
67
+ //# sourceMappingURL=plugins.js.map
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _default = exports.default = {
8
+ auxiliaryComment: {
9
+ message: "Use `auxiliaryCommentBefore` or `auxiliaryCommentAfter`"
10
+ },
11
+ blacklist: {
12
+ message: "Put the specific transforms you want in the `plugins` option"
13
+ },
14
+ breakConfig: {
15
+ message: "This is not a necessary option in Babel 6"
16
+ },
17
+ experimental: {
18
+ message: "Put the specific transforms you want in the `plugins` option"
19
+ },
20
+ externalHelpers: {
21
+ message: "Use the `external-helpers` plugin instead. " + "Check out http://babeljs.io/docs/plugins/external-helpers/"
22
+ },
23
+ extra: {
24
+ message: ""
25
+ },
26
+ jsxPragma: {
27
+ message: "use the `pragma` option in the `react-jsx` plugin. " + "Check out http://babeljs.io/docs/plugins/transform-react-jsx/"
28
+ },
29
+ loose: {
30
+ message: "Specify the `loose` option for the relevant plugin you are using " + "or use a preset that sets the option."
31
+ },
32
+ metadataUsedHelpers: {
33
+ message: "Not required anymore as this is enabled by default"
34
+ },
35
+ modules: {
36
+ message: "Use the corresponding module transform plugin in the `plugins` option. " + "Check out http://babeljs.io/docs/plugins/#modules"
37
+ },
38
+ nonStandard: {
39
+ message: "Use the `react-jsx` and `flow-strip-types` plugins to support JSX and Flow. " + "Also check out the react preset http://babeljs.io/docs/plugins/preset-react/"
40
+ },
41
+ optional: {
42
+ message: "Put the specific transforms you want in the `plugins` option"
43
+ },
44
+ sourceMapName: {
45
+ message: "The `sourceMapName` option has been removed because it makes more sense for the " + "tooling that calls Babel to assign `map.file` themselves."
46
+ },
47
+ stage: {
48
+ message: "Check out the corresponding stage-x presets http://babeljs.io/docs/plugins/#presets"
49
+ },
50
+ whitelist: {
51
+ message: "Put the specific transforms you want in the `plugins` option"
52
+ },
53
+ resolveModuleSource: {
54
+ version: 6,
55
+ message: "Use `babel-plugin-module-resolver@3`'s 'resolvePath' options"
56
+ },
57
+ metadata: {
58
+ version: 6,
59
+ message: "Generated plugin metadata is always included in the output result"
60
+ },
61
+ sourceMapTarget: {
62
+ version: 6,
63
+ message: "The `sourceMapTarget` option has been removed because it makes more sense for the tooling " + "that calls Babel to assign `map.file` themselves."
64
+ }
65
+ };
66
+ 0 && 0;
67
+
68
+ //# sourceMappingURL=removed.js.map
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _rewriteStackTrace = require("./rewrite-stack-trace.js");
8
+ class ConfigError extends Error {
9
+ constructor(message, filename) {
10
+ super(message);
11
+ (0, _rewriteStackTrace.expectedError)(this);
12
+ if (filename) (0, _rewriteStackTrace.injectVirtualStackFrame)(this, filename);
13
+ }
14
+ }
15
+ exports.default = ConfigError;
16
+ 0 && 0;
17
+
18
+ //# sourceMappingURL=config-error.js.map