@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,229 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.loadPlugin = loadPlugin;
7
+ exports.loadPreset = loadPreset;
8
+ exports.resolvePreset = exports.resolvePlugin = void 0;
9
+ function _debug() {
10
+ const data = require("debug");
11
+ _debug = function () {
12
+ return data;
13
+ };
14
+ return data;
15
+ }
16
+ function _path() {
17
+ const data = require("path");
18
+ _path = function () {
19
+ return data;
20
+ };
21
+ return data;
22
+ }
23
+ var _async = require("../../gensync-utils/async.js");
24
+ var _moduleTypes = require("./module-types.js");
25
+ function _url() {
26
+ const data = require("url");
27
+ _url = function () {
28
+ return data;
29
+ };
30
+ return data;
31
+ }
32
+ var _importMetaResolve = require("../../vendor/import-meta-resolve.js");
33
+ function _fs() {
34
+ const data = require("fs");
35
+ _fs = function () {
36
+ return data;
37
+ };
38
+ return data;
39
+ }
40
+ const debug = _debug()("babel:config:loading:files:plugins");
41
+ const EXACT_RE = /^module:/;
42
+ const BABEL_PLUGIN_PREFIX_RE = /^(?!@|module:|[^/]+\/|babel-plugin-)/;
43
+ const BABEL_PRESET_PREFIX_RE = /^(?!@|module:|[^/]+\/|babel-preset-)/;
44
+ const BABEL_PLUGIN_ORG_RE = /^(@babel\/)(?!plugin-|[^/]+\/)/;
45
+ const BABEL_PRESET_ORG_RE = /^(@babel\/)(?!preset-|[^/]+\/)/;
46
+ const OTHER_PLUGIN_ORG_RE = /^(@(?!babel\/)[^/]+\/)(?![^/]*babel-plugin(?:-|\/|$)|[^/]+\/)/;
47
+ const OTHER_PRESET_ORG_RE = /^(@(?!babel\/)[^/]+\/)(?![^/]*babel-preset(?:-|\/|$)|[^/]+\/)/;
48
+ const OTHER_ORG_DEFAULT_RE = /^(@(?!babel$)[^/]+)$/;
49
+ const resolvePlugin = exports.resolvePlugin = resolveStandardizedName.bind(null, "plugin");
50
+ const resolvePreset = exports.resolvePreset = resolveStandardizedName.bind(null, "preset");
51
+ function* loadPlugin(name, dirname) {
52
+ const {
53
+ filepath,
54
+ loader
55
+ } = resolvePlugin(name, dirname, yield* (0, _async.isAsync)());
56
+ const value = yield* requireModule("plugin", loader, filepath);
57
+ debug("Loaded plugin %o from %o.", name, dirname);
58
+ return {
59
+ filepath,
60
+ value
61
+ };
62
+ }
63
+ function* loadPreset(name, dirname) {
64
+ const {
65
+ filepath,
66
+ loader
67
+ } = resolvePreset(name, dirname, yield* (0, _async.isAsync)());
68
+ const value = yield* requireModule("preset", loader, filepath);
69
+ debug("Loaded preset %o from %o.", name, dirname);
70
+ return {
71
+ filepath,
72
+ value
73
+ };
74
+ }
75
+ function standardizeName(type, name) {
76
+ if (_path().isAbsolute(name)) return name;
77
+ const isPreset = type === "preset";
78
+ return name.replace(isPreset ? BABEL_PRESET_PREFIX_RE : BABEL_PLUGIN_PREFIX_RE, `babel-${type}-`).replace(isPreset ? BABEL_PRESET_ORG_RE : BABEL_PLUGIN_ORG_RE, `$1${type}-`).replace(isPreset ? OTHER_PRESET_ORG_RE : OTHER_PLUGIN_ORG_RE, `$1babel-${type}-`).replace(OTHER_ORG_DEFAULT_RE, `$1/babel-${type}`).replace(EXACT_RE, "");
79
+ }
80
+ function* resolveAlternativesHelper(type, name) {
81
+ const standardizedName = standardizeName(type, name);
82
+ const {
83
+ error,
84
+ value
85
+ } = yield standardizedName;
86
+ if (!error) return value;
87
+ if (error.code !== "MODULE_NOT_FOUND") throw error;
88
+ if (standardizedName !== name && !(yield name).error) {
89
+ error.message += `\n- If you want to resolve "${name}", use "module:${name}"`;
90
+ }
91
+ if (!(yield standardizeName(type, "@babel/" + name)).error) {
92
+ error.message += `\n- Did you mean "@babel/${name}"?`;
93
+ }
94
+ const oppositeType = type === "preset" ? "plugin" : "preset";
95
+ if (!(yield standardizeName(oppositeType, name)).error) {
96
+ error.message += `\n- Did you accidentally pass a ${oppositeType} as a ${type}?`;
97
+ }
98
+ if (type === "plugin") {
99
+ const transformName = standardizedName.replace("-proposal-", "-transform-");
100
+ if (transformName !== standardizedName && !(yield transformName).error) {
101
+ error.message += `\n- Did you mean "${transformName}"?`;
102
+ }
103
+ }
104
+ error.message += `\n
105
+ Make sure that all the Babel plugins and presets you are using
106
+ are defined as dependencies or devDependencies in your package.json
107
+ file. It's possible that the missing plugin is loaded by a preset
108
+ you are using that forgot to add the plugin to its dependencies: you
109
+ can workaround this problem by explicitly adding the missing package
110
+ to your top-level package.json.
111
+ `;
112
+ throw error;
113
+ }
114
+ function tryRequireResolve(id, dirname) {
115
+ try {
116
+ if (dirname) {
117
+ return {
118
+ error: null,
119
+ value: (((v, w) => (v = v.split("."), w = w.split("."), +v[0] > +w[0] || v[0] == w[0] && +v[1] >= +w[1]))(process.versions.node, "8.9") ? require.resolve : (r, {
120
+ paths: [b]
121
+ }, M = require("module")) => {
122
+ let f = M._findPath(r, M._nodeModulePaths(b).concat(b));
123
+ if (f) return f;
124
+ f = new Error(`Cannot resolve module '${r}'`);
125
+ f.code = "MODULE_NOT_FOUND";
126
+ throw f;
127
+ })(id, {
128
+ paths: [dirname]
129
+ })
130
+ };
131
+ } else {
132
+ return {
133
+ error: null,
134
+ value: require.resolve(id)
135
+ };
136
+ }
137
+ } catch (error) {
138
+ return {
139
+ error,
140
+ value: null
141
+ };
142
+ }
143
+ }
144
+ function tryImportMetaResolve(id, options) {
145
+ try {
146
+ return {
147
+ error: null,
148
+ value: (0, _importMetaResolve.resolve)(id, options)
149
+ };
150
+ } catch (error) {
151
+ return {
152
+ error,
153
+ value: null
154
+ };
155
+ }
156
+ }
157
+ function resolveStandardizedNameForRequire(type, name, dirname) {
158
+ const it = resolveAlternativesHelper(type, name);
159
+ let res = it.next();
160
+ while (!res.done) {
161
+ res = it.next(tryRequireResolve(res.value, dirname));
162
+ }
163
+ return {
164
+ loader: "require",
165
+ filepath: res.value
166
+ };
167
+ }
168
+ function resolveStandardizedNameForImport(type, name, dirname) {
169
+ const parentUrl = (0, _url().pathToFileURL)(_path().join(dirname, "./babel-virtual-resolve-base.js")).href;
170
+ const it = resolveAlternativesHelper(type, name);
171
+ let res = it.next();
172
+ while (!res.done) {
173
+ res = it.next(tryImportMetaResolve(res.value, parentUrl));
174
+ }
175
+ return {
176
+ loader: "auto",
177
+ filepath: (0, _url().fileURLToPath)(res.value)
178
+ };
179
+ }
180
+ function resolveStandardizedName(type, name, dirname, allowAsync) {
181
+ if (!_moduleTypes.supportsESM || !allowAsync) {
182
+ return resolveStandardizedNameForRequire(type, name, dirname);
183
+ }
184
+ try {
185
+ const resolved = resolveStandardizedNameForImport(type, name, dirname);
186
+ if (!(0, _fs().existsSync)(resolved.filepath)) {
187
+ throw Object.assign(new Error(`Could not resolve "${name}" in file ${dirname}.`), {
188
+ type: "MODULE_NOT_FOUND"
189
+ });
190
+ }
191
+ return resolved;
192
+ } catch (e) {
193
+ try {
194
+ return resolveStandardizedNameForRequire(type, name, dirname);
195
+ } catch (e2) {
196
+ if (e.type === "MODULE_NOT_FOUND") throw e;
197
+ if (e2.type === "MODULE_NOT_FOUND") throw e2;
198
+ throw e;
199
+ }
200
+ }
201
+ }
202
+ {
203
+ var LOADING_MODULES = new Set();
204
+ }
205
+ function* requireModule(type, loader, name) {
206
+ {
207
+ if (!(yield* (0, _async.isAsync)()) && LOADING_MODULES.has(name)) {
208
+ throw new Error(`Reentrant ${type} detected trying to load "${name}". This module is not ignored ` + "and is trying to load itself while compiling itself, leading to a dependency cycle. " + 'We recommend adding it to your "ignore" list in your babelrc, or to a .babelignore.');
209
+ }
210
+ }
211
+ try {
212
+ {
213
+ LOADING_MODULES.add(name);
214
+ }
215
+ {
216
+ return yield* (0, _moduleTypes.default)(name, loader, `You appear to be using a native ECMAScript module ${type}, ` + "which is only supported when running Babel asynchronously " + "or when using the Node.js `--experimental-require-module` flag.", `You appear to be using a ${type} that contains top-level await, ` + "which is only supported when running Babel asynchronously.", true);
217
+ }
218
+ } catch (err) {
219
+ err.message = `[BABEL]: ${err.message} (While processing: ${name})`;
220
+ throw err;
221
+ } finally {
222
+ {
223
+ LOADING_MODULES.delete(name);
224
+ }
225
+ }
226
+ }
227
+ 0 && 0;
228
+
229
+ //# sourceMappingURL=plugins.js.map
@@ -0,0 +1,3 @@
1
+ 0 && 0;
2
+
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.makeStaticFileCache = makeStaticFileCache;
7
+ var _caching = require("../caching.js");
8
+ var fs = require("../../gensync-utils/fs.js");
9
+ function _fs2() {
10
+ const data = require("fs");
11
+ _fs2 = function () {
12
+ return data;
13
+ };
14
+ return data;
15
+ }
16
+ function makeStaticFileCache(fn) {
17
+ return (0, _caching.makeStrongCache)(function* (filepath, cache) {
18
+ const cached = cache.invalidate(() => fileMtime(filepath));
19
+ if (cached === null) {
20
+ return null;
21
+ }
22
+ return fn(filepath, yield* fs.readFile(filepath, "utf8"));
23
+ });
24
+ }
25
+ function fileMtime(filepath) {
26
+ if (!_fs2().existsSync(filepath)) return null;
27
+ try {
28
+ return +_fs2().statSync(filepath).mtime;
29
+ } catch (e) {
30
+ if (e.code !== "ENOENT" && e.code !== "ENOTDIR") throw e;
31
+ }
32
+ return null;
33
+ }
34
+ 0 && 0;
35
+
36
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1,312 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ function _gensync() {
8
+ const data = require("gensync");
9
+ _gensync = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ var _async = require("../gensync-utils/async.js");
15
+ var _util = require("./util.js");
16
+ var context = require("../index.js");
17
+ var _plugin = require("./plugin.js");
18
+ var _item = require("./item.js");
19
+ var _configChain = require("./config-chain.js");
20
+ var _deepArray = require("./helpers/deep-array.js");
21
+ function _traverse() {
22
+ const data = require("@babel/traverse");
23
+ _traverse = function () {
24
+ return data;
25
+ };
26
+ return data;
27
+ }
28
+ var _caching = require("./caching.js");
29
+ var _options = require("./validation/options.js");
30
+ var _plugins = require("./validation/plugins.js");
31
+ var _configApi = require("./helpers/config-api.js");
32
+ var _partial = require("./partial.js");
33
+ var _configError = require("../errors/config-error.js");
34
+ var _default = exports.default = _gensync()(function* loadFullConfig(inputOpts) {
35
+ var _opts$assumptions;
36
+ const result = yield* (0, _partial.default)(inputOpts);
37
+ if (!result) {
38
+ return null;
39
+ }
40
+ const {
41
+ options,
42
+ context,
43
+ fileHandling
44
+ } = result;
45
+ if (fileHandling === "ignored") {
46
+ return null;
47
+ }
48
+ const optionDefaults = {};
49
+ const {
50
+ plugins,
51
+ presets
52
+ } = options;
53
+ if (!plugins || !presets) {
54
+ throw new Error("Assertion failure - plugins and presets exist");
55
+ }
56
+ const presetContext = Object.assign({}, context, {
57
+ targets: options.targets
58
+ });
59
+ const toDescriptor = item => {
60
+ const desc = (0, _item.getItemDescriptor)(item);
61
+ if (!desc) {
62
+ throw new Error("Assertion failure - must be config item");
63
+ }
64
+ return desc;
65
+ };
66
+ const presetsDescriptors = presets.map(toDescriptor);
67
+ const initialPluginsDescriptors = plugins.map(toDescriptor);
68
+ const pluginDescriptorsByPass = [[]];
69
+ const passes = [];
70
+ const externalDependencies = [];
71
+ const ignored = yield* enhanceError(context, function* recursePresetDescriptors(rawPresets, pluginDescriptorsPass) {
72
+ const presets = [];
73
+ for (let i = 0; i < rawPresets.length; i++) {
74
+ const descriptor = rawPresets[i];
75
+ if (descriptor.options !== false) {
76
+ try {
77
+ var preset = yield* loadPresetDescriptor(descriptor, presetContext);
78
+ } catch (e) {
79
+ if (e.code === "BABEL_UNKNOWN_OPTION") {
80
+ (0, _options.checkNoUnwrappedItemOptionPairs)(rawPresets, i, "preset", e);
81
+ }
82
+ throw e;
83
+ }
84
+ externalDependencies.push(preset.externalDependencies);
85
+ if (descriptor.ownPass) {
86
+ presets.push({
87
+ preset: preset.chain,
88
+ pass: []
89
+ });
90
+ } else {
91
+ presets.unshift({
92
+ preset: preset.chain,
93
+ pass: pluginDescriptorsPass
94
+ });
95
+ }
96
+ }
97
+ }
98
+ if (presets.length > 0) {
99
+ pluginDescriptorsByPass.splice(1, 0, ...presets.map(o => o.pass).filter(p => p !== pluginDescriptorsPass));
100
+ for (const {
101
+ preset,
102
+ pass
103
+ } of presets) {
104
+ if (!preset) return true;
105
+ pass.push(...preset.plugins);
106
+ const ignored = yield* recursePresetDescriptors(preset.presets, pass);
107
+ if (ignored) return true;
108
+ preset.options.forEach(opts => {
109
+ (0, _util.mergeOptions)(optionDefaults, opts);
110
+ });
111
+ }
112
+ }
113
+ })(presetsDescriptors, pluginDescriptorsByPass[0]);
114
+ if (ignored) return null;
115
+ const opts = optionDefaults;
116
+ (0, _util.mergeOptions)(opts, options);
117
+ const pluginContext = Object.assign({}, presetContext, {
118
+ assumptions: (_opts$assumptions = opts.assumptions) != null ? _opts$assumptions : {}
119
+ });
120
+ yield* enhanceError(context, function* loadPluginDescriptors() {
121
+ pluginDescriptorsByPass[0].unshift(...initialPluginsDescriptors);
122
+ for (const descs of pluginDescriptorsByPass) {
123
+ const pass = [];
124
+ passes.push(pass);
125
+ for (let i = 0; i < descs.length; i++) {
126
+ const descriptor = descs[i];
127
+ if (descriptor.options !== false) {
128
+ try {
129
+ var plugin = yield* loadPluginDescriptor(descriptor, pluginContext);
130
+ } catch (e) {
131
+ if (e.code === "BABEL_UNKNOWN_PLUGIN_PROPERTY") {
132
+ (0, _options.checkNoUnwrappedItemOptionPairs)(descs, i, "plugin", e);
133
+ }
134
+ throw e;
135
+ }
136
+ pass.push(plugin);
137
+ externalDependencies.push(plugin.externalDependencies);
138
+ }
139
+ }
140
+ }
141
+ })();
142
+ opts.plugins = passes[0];
143
+ opts.presets = passes.slice(1).filter(plugins => plugins.length > 0).map(plugins => ({
144
+ plugins
145
+ }));
146
+ opts.passPerPreset = opts.presets.length > 0;
147
+ return {
148
+ options: opts,
149
+ passes: passes,
150
+ externalDependencies: (0, _deepArray.finalize)(externalDependencies)
151
+ };
152
+ });
153
+ function enhanceError(context, fn) {
154
+ return function* (arg1, arg2) {
155
+ try {
156
+ return yield* fn(arg1, arg2);
157
+ } catch (e) {
158
+ if (!/^\[BABEL\]/.test(e.message)) {
159
+ var _context$filename;
160
+ e.message = `[BABEL] ${(_context$filename = context.filename) != null ? _context$filename : "unknown file"}: ${e.message}`;
161
+ }
162
+ throw e;
163
+ }
164
+ };
165
+ }
166
+ const makeDescriptorLoader = apiFactory => (0, _caching.makeWeakCache)(function* ({
167
+ value,
168
+ options,
169
+ dirname,
170
+ alias
171
+ }, cache) {
172
+ if (options === false) throw new Error("Assertion failure");
173
+ options = options || {};
174
+ const externalDependencies = [];
175
+ let item = value;
176
+ if (typeof value === "function") {
177
+ const factory = (0, _async.maybeAsync)(value, `You appear to be using an async plugin/preset, but Babel has been called synchronously`);
178
+ const api = Object.assign({}, context, apiFactory(cache, externalDependencies));
179
+ try {
180
+ item = yield* factory(api, options, dirname);
181
+ } catch (e) {
182
+ if (alias) {
183
+ e.message += ` (While processing: ${JSON.stringify(alias)})`;
184
+ }
185
+ throw e;
186
+ }
187
+ }
188
+ if (!item || typeof item !== "object") {
189
+ throw new Error("Plugin/Preset did not return an object.");
190
+ }
191
+ if ((0, _async.isThenable)(item)) {
192
+ yield* [];
193
+ throw new Error(`You appear to be using a promise as a plugin, ` + `which your current version of Babel does not support. ` + `If you're using a published plugin, ` + `you may need to upgrade your @babel/core version. ` + `As an alternative, you can prefix the promise with "await". ` + `(While processing: ${JSON.stringify(alias)})`);
194
+ }
195
+ if (externalDependencies.length > 0 && (!cache.configured() || cache.mode() === "forever")) {
196
+ let error = `A plugin/preset has external untracked dependencies ` + `(${externalDependencies[0]}), but the cache `;
197
+ if (!cache.configured()) {
198
+ error += `has not been configured to be invalidated when the external dependencies change. `;
199
+ } else {
200
+ error += ` has been configured to never be invalidated. `;
201
+ }
202
+ error += `Plugins/presets should configure their cache to be invalidated when the external ` + `dependencies change, for example using \`api.cache.invalidate(() => ` + `statSync(filepath).mtimeMs)\` or \`api.cache.never()\`\n` + `(While processing: ${JSON.stringify(alias)})`;
203
+ throw new Error(error);
204
+ }
205
+ return {
206
+ value: item,
207
+ options,
208
+ dirname,
209
+ alias,
210
+ externalDependencies: (0, _deepArray.finalize)(externalDependencies)
211
+ };
212
+ });
213
+ const pluginDescriptorLoader = makeDescriptorLoader(_configApi.makePluginAPI);
214
+ const presetDescriptorLoader = makeDescriptorLoader(_configApi.makePresetAPI);
215
+ const instantiatePlugin = (0, _caching.makeWeakCache)(function* ({
216
+ value,
217
+ options,
218
+ dirname,
219
+ alias,
220
+ externalDependencies
221
+ }, cache) {
222
+ const pluginObj = (0, _plugins.validatePluginObject)(value);
223
+ const plugin = Object.assign({}, pluginObj);
224
+ if (plugin.visitor) {
225
+ plugin.visitor = _traverse().default.explode(Object.assign({}, plugin.visitor));
226
+ }
227
+ if (plugin.inherits) {
228
+ const inheritsDescriptor = {
229
+ name: undefined,
230
+ alias: `${alias}$inherits`,
231
+ value: plugin.inherits,
232
+ options,
233
+ dirname
234
+ };
235
+ const inherits = yield* (0, _async.forwardAsync)(loadPluginDescriptor, run => {
236
+ return cache.invalidate(data => run(inheritsDescriptor, data));
237
+ });
238
+ plugin.pre = chainMaybeAsync(inherits.pre, plugin.pre);
239
+ plugin.post = chainMaybeAsync(inherits.post, plugin.post);
240
+ plugin.manipulateOptions = chainMaybeAsync(inherits.manipulateOptions, plugin.manipulateOptions);
241
+ plugin.visitor = _traverse().default.visitors.merge([inherits.visitor || {}, plugin.visitor || {}]);
242
+ if (inherits.externalDependencies.length > 0) {
243
+ if (externalDependencies.length === 0) {
244
+ externalDependencies = inherits.externalDependencies;
245
+ } else {
246
+ externalDependencies = (0, _deepArray.finalize)([externalDependencies, inherits.externalDependencies]);
247
+ }
248
+ }
249
+ }
250
+ return new _plugin.default(plugin, options, alias, externalDependencies);
251
+ });
252
+ function* loadPluginDescriptor(descriptor, context) {
253
+ if (descriptor.value instanceof _plugin.default) {
254
+ if (descriptor.options) {
255
+ throw new Error("Passed options to an existing Plugin instance will not work.");
256
+ }
257
+ return descriptor.value;
258
+ }
259
+ return yield* instantiatePlugin(yield* pluginDescriptorLoader(descriptor, context), context);
260
+ }
261
+ const needsFilename = val => val && typeof val !== "function";
262
+ const validateIfOptionNeedsFilename = (options, descriptor) => {
263
+ if (needsFilename(options.test) || needsFilename(options.include) || needsFilename(options.exclude)) {
264
+ const formattedPresetName = descriptor.name ? `"${descriptor.name}"` : "/* your preset */";
265
+ throw new _configError.default([`Preset ${formattedPresetName} requires a filename to be set when babel is called directly,`, `\`\`\``, `babel.transformSync(code, { filename: 'file.ts', presets: [${formattedPresetName}] });`, `\`\`\``, `See https://babeljs.io/docs/en/options#filename for more information.`].join("\n"));
266
+ }
267
+ };
268
+ const validatePreset = (preset, context, descriptor) => {
269
+ if (!context.filename) {
270
+ var _options$overrides;
271
+ const {
272
+ options
273
+ } = preset;
274
+ validateIfOptionNeedsFilename(options, descriptor);
275
+ (_options$overrides = options.overrides) == null || _options$overrides.forEach(overrideOptions => validateIfOptionNeedsFilename(overrideOptions, descriptor));
276
+ }
277
+ };
278
+ const instantiatePreset = (0, _caching.makeWeakCacheSync)(({
279
+ value,
280
+ dirname,
281
+ alias,
282
+ externalDependencies
283
+ }) => {
284
+ return {
285
+ options: (0, _options.validate)("preset", value),
286
+ alias,
287
+ dirname,
288
+ externalDependencies
289
+ };
290
+ });
291
+ function* loadPresetDescriptor(descriptor, context) {
292
+ const preset = instantiatePreset(yield* presetDescriptorLoader(descriptor, context));
293
+ validatePreset(preset, context, descriptor);
294
+ return {
295
+ chain: yield* (0, _configChain.buildPresetChain)(preset, context),
296
+ externalDependencies: preset.externalDependencies
297
+ };
298
+ }
299
+ function chainMaybeAsync(a, b) {
300
+ if (!a) return b;
301
+ if (!b) return a;
302
+ return function (...args) {
303
+ const res = a.apply(this, args);
304
+ if (res && typeof res.then === "function") {
305
+ return res.then(() => b.apply(this, args));
306
+ }
307
+ return b.apply(this, args);
308
+ };
309
+ }
310
+ 0 && 0;
311
+
312
+ //# sourceMappingURL=full.js.map
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.makeConfigAPI = makeConfigAPI;
7
+ exports.makePluginAPI = makePluginAPI;
8
+ exports.makePresetAPI = makePresetAPI;
9
+ function _semver() {
10
+ const data = require("semver");
11
+ _semver = function () {
12
+ return data;
13
+ };
14
+ return data;
15
+ }
16
+ var _index = require("../../index.js");
17
+ var _caching = require("../caching.js");
18
+ function makeConfigAPI(cache) {
19
+ const env = value => cache.using(data => {
20
+ if (value === undefined) return data.envName;
21
+ if (typeof value === "function") {
22
+ return (0, _caching.assertSimpleType)(value(data.envName));
23
+ }
24
+ return (Array.isArray(value) ? value : [value]).some(entry => {
25
+ if (typeof entry !== "string") {
26
+ throw new Error("Unexpected non-string value");
27
+ }
28
+ return entry === data.envName;
29
+ });
30
+ });
31
+ const caller = cb => cache.using(data => (0, _caching.assertSimpleType)(cb(data.caller)));
32
+ return {
33
+ version: _index.version,
34
+ cache: cache.simple(),
35
+ env,
36
+ async: () => false,
37
+ caller,
38
+ assertVersion
39
+ };
40
+ }
41
+ function makePresetAPI(cache, externalDependencies) {
42
+ const targets = () => JSON.parse(cache.using(data => JSON.stringify(data.targets)));
43
+ const addExternalDependency = ref => {
44
+ externalDependencies.push(ref);
45
+ };
46
+ return Object.assign({}, makeConfigAPI(cache), {
47
+ targets,
48
+ addExternalDependency
49
+ });
50
+ }
51
+ function makePluginAPI(cache, externalDependencies) {
52
+ const assumption = name => cache.using(data => data.assumptions[name]);
53
+ return Object.assign({}, makePresetAPI(cache, externalDependencies), {
54
+ assumption
55
+ });
56
+ }
57
+ function assertVersion(range) {
58
+ if (typeof range === "number") {
59
+ if (!Number.isInteger(range)) {
60
+ throw new Error("Expected string or integer value.");
61
+ }
62
+ range = `^${range}.0.0-0`;
63
+ }
64
+ if (typeof range !== "string") {
65
+ throw new Error("Expected string or integer value.");
66
+ }
67
+ if (range === "*" || _semver().satisfies(_index.version, range)) return;
68
+ const limit = Error.stackTraceLimit;
69
+ if (typeof limit === "number" && limit < 25) {
70
+ Error.stackTraceLimit = 25;
71
+ }
72
+ const err = new Error(`Requires Babel "${range}", but was loaded with "${_index.version}". ` + `If you are sure you have a compatible version of @babel/core, ` + `it is likely that something in your build process is loading the ` + `wrong version. Inspect the stack trace of this error to look for ` + `the first entry that doesn't mention "@babel/core" or "babel-core" ` + `to see what is calling Babel.`);
73
+ if (typeof limit === "number") {
74
+ Error.stackTraceLimit = limit;
75
+ }
76
+ throw Object.assign(err, {
77
+ code: "BABEL_VERSION_UNSUPPORTED",
78
+ version: _index.version,
79
+ range
80
+ });
81
+ }
82
+ 0 && 0;
83
+
84
+ //# sourceMappingURL=config-api.js.map
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.finalize = finalize;
7
+ exports.flattenToSet = flattenToSet;
8
+ function finalize(deepArr) {
9
+ return Object.freeze(deepArr);
10
+ }
11
+ function flattenToSet(arr) {
12
+ const result = new Set();
13
+ const stack = [arr];
14
+ while (stack.length > 0) {
15
+ for (const el of stack.pop()) {
16
+ if (Array.isArray(el)) stack.push(el);else result.add(el);
17
+ }
18
+ }
19
+ return result;
20
+ }
21
+ 0 && 0;
22
+
23
+ //# sourceMappingURL=deep-array.js.map
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getEnv = getEnv;
7
+ function getEnv(defaultValue = "development") {
8
+ return process.env.BABEL_ENV || process.env.NODE_ENV || defaultValue;
9
+ }
10
+ 0 && 0;
11
+
12
+ //# sourceMappingURL=environment.js.map