@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,40 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.transformFile = transformFile;
7
+ exports.transformFileAsync = transformFileAsync;
8
+ exports.transformFileSync = transformFileSync;
9
+ function _gensync() {
10
+ const data = require("gensync");
11
+ _gensync = function () {
12
+ return data;
13
+ };
14
+ return data;
15
+ }
16
+ var _index = require("./config/index.js");
17
+ var _index2 = require("./transformation/index.js");
18
+ var fs = require("./gensync-utils/fs.js");
19
+ ({});
20
+ const transformFileRunner = _gensync()(function* (filename, opts) {
21
+ const options = Object.assign({}, opts, {
22
+ filename
23
+ });
24
+ const config = yield* (0, _index.default)(options);
25
+ if (config === null) return null;
26
+ const code = yield* fs.readFile(filename, "utf8");
27
+ return yield* (0, _index2.run)(config, code);
28
+ });
29
+ function transformFile(...args) {
30
+ transformFileRunner.errback(...args);
31
+ }
32
+ function transformFileSync(...args) {
33
+ return transformFileRunner.sync(...args);
34
+ }
35
+ function transformFileAsync(...args) {
36
+ return transformFileRunner.async(...args);
37
+ }
38
+ 0 && 0;
39
+
40
+ //# sourceMappingURL=transform-file.js.map
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.transform = void 0;
7
+ exports.transformAsync = transformAsync;
8
+ exports.transformSync = transformSync;
9
+ function _gensync() {
10
+ const data = require("gensync");
11
+ _gensync = function () {
12
+ return data;
13
+ };
14
+ return data;
15
+ }
16
+ var _index = require("./config/index.js");
17
+ var _index2 = require("./transformation/index.js");
18
+ var _rewriteStackTrace = require("./errors/rewrite-stack-trace.js");
19
+ const transformRunner = _gensync()(function* transform(code, opts) {
20
+ const config = yield* (0, _index.default)(opts);
21
+ if (config === null) return null;
22
+ return yield* (0, _index2.run)(config, code);
23
+ });
24
+ const transform = exports.transform = function transform(code, optsOrCallback, maybeCallback) {
25
+ let opts;
26
+ let callback;
27
+ if (typeof optsOrCallback === "function") {
28
+ callback = optsOrCallback;
29
+ opts = undefined;
30
+ } else {
31
+ opts = optsOrCallback;
32
+ callback = maybeCallback;
33
+ }
34
+ if (callback === undefined) {
35
+ {
36
+ return (0, _rewriteStackTrace.beginHiddenCallStack)(transformRunner.sync)(code, opts);
37
+ }
38
+ }
39
+ (0, _rewriteStackTrace.beginHiddenCallStack)(transformRunner.errback)(code, opts, callback);
40
+ };
41
+ function transformSync(...args) {
42
+ return (0, _rewriteStackTrace.beginHiddenCallStack)(transformRunner.sync)(...args);
43
+ }
44
+ function transformAsync(...args) {
45
+ return (0, _rewriteStackTrace.beginHiddenCallStack)(transformRunner.async)(...args);
46
+ }
47
+ 0 && 0;
48
+
49
+ //# sourceMappingURL=transform.js.map
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = loadBlockHoistPlugin;
7
+ function _traverse() {
8
+ const data = require("@babel/traverse");
9
+ _traverse = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ var _plugin = require("../config/plugin.js");
15
+ let LOADED_PLUGIN;
16
+ const blockHoistPlugin = {
17
+ name: "internal.blockHoist",
18
+ visitor: {
19
+ Block: {
20
+ exit({
21
+ node
22
+ }) {
23
+ node.body = performHoisting(node.body);
24
+ }
25
+ },
26
+ SwitchCase: {
27
+ exit({
28
+ node
29
+ }) {
30
+ node.consequent = performHoisting(node.consequent);
31
+ }
32
+ }
33
+ }
34
+ };
35
+ function performHoisting(body) {
36
+ let max = Math.pow(2, 30) - 1;
37
+ let hasChange = false;
38
+ for (let i = 0; i < body.length; i++) {
39
+ const n = body[i];
40
+ const p = priority(n);
41
+ if (p > max) {
42
+ hasChange = true;
43
+ break;
44
+ }
45
+ max = p;
46
+ }
47
+ if (!hasChange) return body;
48
+ return stableSort(body.slice());
49
+ }
50
+ function loadBlockHoistPlugin() {
51
+ if (!LOADED_PLUGIN) {
52
+ LOADED_PLUGIN = new _plugin.default(Object.assign({}, blockHoistPlugin, {
53
+ visitor: _traverse().default.explode(blockHoistPlugin.visitor)
54
+ }), {});
55
+ }
56
+ return LOADED_PLUGIN;
57
+ }
58
+ function priority(bodyNode) {
59
+ const priority = bodyNode == null ? void 0 : bodyNode._blockHoist;
60
+ if (priority == null) return 1;
61
+ if (priority === true) return 2;
62
+ return priority;
63
+ }
64
+ function stableSort(body) {
65
+ const buckets = Object.create(null);
66
+ for (let i = 0; i < body.length; i++) {
67
+ const n = body[i];
68
+ const p = priority(n);
69
+ const bucket = buckets[p] || (buckets[p] = []);
70
+ bucket.push(n);
71
+ }
72
+ const keys = Object.keys(buckets).map(k => +k).sort((a, b) => b - a);
73
+ let index = 0;
74
+ for (const key of keys) {
75
+ const bucket = buckets[key];
76
+ for (const n of bucket) {
77
+ body[index++] = n;
78
+ }
79
+ }
80
+ return body;
81
+ }
82
+ 0 && 0;
83
+
84
+ //# sourceMappingURL=block-hoist-plugin.js.map
@@ -0,0 +1,4 @@
1
+ exports.getModuleName = () => require("@babel/helper-module-transforms").getModuleName;
2
+ 0 && 0;
3
+
4
+ //# sourceMappingURL=babel-7-helpers.cjs.map
@@ -0,0 +1,214 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ function helpers() {
8
+ const data = require("@babel/helpers");
9
+ helpers = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ function _traverse() {
15
+ const data = require("@babel/traverse");
16
+ _traverse = function () {
17
+ return data;
18
+ };
19
+ return data;
20
+ }
21
+ function _codeFrame() {
22
+ const data = require("@babel/code-frame");
23
+ _codeFrame = function () {
24
+ return data;
25
+ };
26
+ return data;
27
+ }
28
+ function _t() {
29
+ const data = require("@babel/types");
30
+ _t = function () {
31
+ return data;
32
+ };
33
+ return data;
34
+ }
35
+ function _semver() {
36
+ const data = require("semver");
37
+ _semver = function () {
38
+ return data;
39
+ };
40
+ return data;
41
+ }
42
+ var babel7 = _interopRequireWildcard(require("./babel-7-helpers.cjs"), true);
43
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
44
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
45
+ const {
46
+ cloneNode,
47
+ interpreterDirective
48
+ } = _t();
49
+ const errorVisitor = {
50
+ enter(path, state) {
51
+ const loc = path.node.loc;
52
+ if (loc) {
53
+ state.loc = loc;
54
+ path.stop();
55
+ }
56
+ }
57
+ };
58
+ class File {
59
+ constructor(options, {
60
+ code,
61
+ ast,
62
+ inputMap
63
+ }) {
64
+ this._map = new Map();
65
+ this.opts = void 0;
66
+ this.declarations = {};
67
+ this.path = void 0;
68
+ this.ast = void 0;
69
+ this.scope = void 0;
70
+ this.metadata = {};
71
+ this.code = "";
72
+ this.inputMap = void 0;
73
+ this.hub = {
74
+ file: this,
75
+ getCode: () => this.code,
76
+ getScope: () => this.scope,
77
+ addHelper: this.addHelper.bind(this),
78
+ buildError: this.buildCodeFrameError.bind(this)
79
+ };
80
+ this.opts = options;
81
+ this.code = code;
82
+ this.ast = ast;
83
+ this.inputMap = inputMap;
84
+ this.path = _traverse().NodePath.get({
85
+ hub: this.hub,
86
+ parentPath: null,
87
+ parent: this.ast,
88
+ container: this.ast,
89
+ key: "program"
90
+ }).setContext();
91
+ this.scope = this.path.scope;
92
+ }
93
+ get shebang() {
94
+ const {
95
+ interpreter
96
+ } = this.path.node;
97
+ return interpreter ? interpreter.value : "";
98
+ }
99
+ set shebang(value) {
100
+ if (value) {
101
+ this.path.get("interpreter").replaceWith(interpreterDirective(value));
102
+ } else {
103
+ this.path.get("interpreter").remove();
104
+ }
105
+ }
106
+ set(key, val) {
107
+ {
108
+ if (key === "helpersNamespace") {
109
+ throw new Error("Babel 7.0.0-beta.56 has dropped support for the 'helpersNamespace' utility." + "If you are using @babel/plugin-external-helpers you will need to use a newer " + "version than the one you currently have installed. " + "If you have your own implementation, you'll want to explore using 'helperGenerator' " + "alongside 'file.availableHelper()'.");
110
+ }
111
+ }
112
+ this._map.set(key, val);
113
+ }
114
+ get(key) {
115
+ return this._map.get(key);
116
+ }
117
+ has(key) {
118
+ return this._map.has(key);
119
+ }
120
+ availableHelper(name, versionRange) {
121
+ let minVersion;
122
+ try {
123
+ minVersion = helpers().minVersion(name);
124
+ } catch (err) {
125
+ if (err.code !== "BABEL_HELPER_UNKNOWN") throw err;
126
+ return false;
127
+ }
128
+ if (typeof versionRange !== "string") return true;
129
+ if (_semver().valid(versionRange)) versionRange = `^${versionRange}`;
130
+ {
131
+ return !_semver().intersects(`<${minVersion}`, versionRange) && !_semver().intersects(`>=8.0.0`, versionRange);
132
+ }
133
+ }
134
+ addHelper(name) {
135
+ const declar = this.declarations[name];
136
+ if (declar) return cloneNode(declar);
137
+ const generator = this.get("helperGenerator");
138
+ if (generator) {
139
+ const res = generator(name);
140
+ if (res) return res;
141
+ }
142
+ helpers().minVersion(name);
143
+ const uid = this.declarations[name] = this.scope.generateUidIdentifier(name);
144
+ const dependencies = {};
145
+ for (const dep of helpers().getDependencies(name)) {
146
+ dependencies[dep] = this.addHelper(dep);
147
+ }
148
+ const {
149
+ nodes,
150
+ globals
151
+ } = helpers().get(name, dep => dependencies[dep], uid.name, Object.keys(this.scope.getAllBindings()));
152
+ globals.forEach(name => {
153
+ if (this.path.scope.hasBinding(name, true)) {
154
+ this.path.scope.rename(name);
155
+ }
156
+ });
157
+ nodes.forEach(node => {
158
+ node._compact = true;
159
+ });
160
+ const added = this.path.unshiftContainer("body", nodes);
161
+ for (const path of added) {
162
+ if (path.isVariableDeclaration()) this.scope.registerDeclaration(path);
163
+ }
164
+ return uid;
165
+ }
166
+ buildCodeFrameError(node, msg, _Error = SyntaxError) {
167
+ let loc = node == null ? void 0 : node.loc;
168
+ if (!loc && node) {
169
+ const state = {
170
+ loc: null
171
+ };
172
+ (0, _traverse().default)(node, errorVisitor, this.scope, state);
173
+ loc = state.loc;
174
+ let txt = "This is an error on an internal node. Probably an internal error.";
175
+ if (loc) txt += " Location has been estimated.";
176
+ msg += ` (${txt})`;
177
+ }
178
+ if (loc) {
179
+ const {
180
+ highlightCode = true
181
+ } = this.opts;
182
+ msg += "\n" + (0, _codeFrame().codeFrameColumns)(this.code, {
183
+ start: {
184
+ line: loc.start.line,
185
+ column: loc.start.column + 1
186
+ },
187
+ end: loc.end && loc.start.line === loc.end.line ? {
188
+ line: loc.end.line,
189
+ column: loc.end.column + 1
190
+ } : undefined
191
+ }, {
192
+ highlightCode
193
+ });
194
+ }
195
+ return new _Error(msg);
196
+ }
197
+ }
198
+ exports.default = File;
199
+ {
200
+ File.prototype.addImport = function addImport() {
201
+ throw new Error("This API has been removed. If you're looking for this " + "functionality in Babel 7, you should import the " + "'@babel/helper-module-imports' module and use the functions exposed " + " from that module, such as 'addNamed' or 'addDefault'.");
202
+ };
203
+ File.prototype.addTemplateObject = function addTemplateObject() {
204
+ throw new Error("This function has been moved into the template literal transform itself.");
205
+ };
206
+ {
207
+ File.prototype.getModuleName = function getModuleName() {
208
+ return babel7.getModuleName()(this.opts, this.opts);
209
+ };
210
+ }
211
+ }
212
+ 0 && 0;
213
+
214
+ //# sourceMappingURL=file.js.map
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = generateCode;
7
+ function _convertSourceMap() {
8
+ const data = require("convert-source-map");
9
+ _convertSourceMap = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ function _generator() {
15
+ const data = require("@babel/generator");
16
+ _generator = function () {
17
+ return data;
18
+ };
19
+ return data;
20
+ }
21
+ var _mergeMap = require("./merge-map.js");
22
+ function generateCode(pluginPasses, file) {
23
+ const {
24
+ opts,
25
+ ast,
26
+ code,
27
+ inputMap
28
+ } = file;
29
+ const {
30
+ generatorOpts
31
+ } = opts;
32
+ generatorOpts.inputSourceMap = inputMap == null ? void 0 : inputMap.toObject();
33
+ const results = [];
34
+ for (const plugins of pluginPasses) {
35
+ for (const plugin of plugins) {
36
+ const {
37
+ generatorOverride
38
+ } = plugin;
39
+ if (generatorOverride) {
40
+ const result = generatorOverride(ast, generatorOpts, code, _generator().default);
41
+ if (result !== undefined) results.push(result);
42
+ }
43
+ }
44
+ }
45
+ let result;
46
+ if (results.length === 0) {
47
+ result = (0, _generator().default)(ast, generatorOpts, code);
48
+ } else if (results.length === 1) {
49
+ result = results[0];
50
+ if (typeof result.then === "function") {
51
+ throw new Error(`You appear to be using an async codegen 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.`);
52
+ }
53
+ } else {
54
+ throw new Error("More than one plugin attempted to override codegen.");
55
+ }
56
+ let {
57
+ code: outputCode,
58
+ decodedMap: outputMap = result.map
59
+ } = result;
60
+ if (result.__mergedMap) {
61
+ outputMap = Object.assign({}, result.map);
62
+ } else {
63
+ if (outputMap) {
64
+ if (inputMap) {
65
+ outputMap = (0, _mergeMap.default)(inputMap.toObject(), outputMap, generatorOpts.sourceFileName);
66
+ } else {
67
+ outputMap = result.map;
68
+ }
69
+ }
70
+ }
71
+ if (opts.sourceMaps === "inline" || opts.sourceMaps === "both") {
72
+ outputCode += "\n" + _convertSourceMap().fromObject(outputMap).toComment();
73
+ }
74
+ if (opts.sourceMaps === "inline") {
75
+ outputMap = null;
76
+ }
77
+ return {
78
+ outputCode,
79
+ outputMap
80
+ };
81
+ }
82
+ 0 && 0;
83
+
84
+ //# sourceMappingURL=generate.js.map
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = mergeSourceMap;
7
+ function _remapping() {
8
+ const data = require("@ampproject/remapping");
9
+ _remapping = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ function mergeSourceMap(inputMap, map, sourceFileName) {
15
+ const source = sourceFileName.replace(/\\/g, "/");
16
+ let found = false;
17
+ const result = _remapping()(rootless(map), (s, ctx) => {
18
+ if (s === source && !found) {
19
+ found = true;
20
+ ctx.source = "";
21
+ return rootless(inputMap);
22
+ }
23
+ return null;
24
+ });
25
+ if (typeof inputMap.sourceRoot === "string") {
26
+ result.sourceRoot = inputMap.sourceRoot;
27
+ }
28
+ return Object.assign({}, result);
29
+ }
30
+ function rootless(map) {
31
+ return Object.assign({}, map, {
32
+ sourceRoot: null
33
+ });
34
+ }
35
+ 0 && 0;
36
+
37
+ //# sourceMappingURL=merge-map.js.map
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.run = run;
7
+ function _traverse() {
8
+ const data = require("@babel/traverse");
9
+ _traverse = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ var _pluginPass = require("./plugin-pass.js");
15
+ var _blockHoistPlugin = require("./block-hoist-plugin.js");
16
+ var _normalizeOpts = require("./normalize-opts.js");
17
+ var _normalizeFile = require("./normalize-file.js");
18
+ var _generate = require("./file/generate.js");
19
+ var _deepArray = require("../config/helpers/deep-array.js");
20
+ var _async = require("../gensync-utils/async.js");
21
+ function* run(config, code, ast) {
22
+ const file = yield* (0, _normalizeFile.default)(config.passes, (0, _normalizeOpts.default)(config), code, ast);
23
+ const opts = file.opts;
24
+ try {
25
+ yield* transformFile(file, config.passes);
26
+ } catch (e) {
27
+ var _opts$filename;
28
+ e.message = `${(_opts$filename = opts.filename) != null ? _opts$filename : "unknown file"}: ${e.message}`;
29
+ if (!e.code) {
30
+ e.code = "BABEL_TRANSFORM_ERROR";
31
+ }
32
+ throw e;
33
+ }
34
+ let outputCode, outputMap;
35
+ try {
36
+ if (opts.code !== false) {
37
+ ({
38
+ outputCode,
39
+ outputMap
40
+ } = (0, _generate.default)(config.passes, file));
41
+ }
42
+ } catch (e) {
43
+ var _opts$filename2;
44
+ e.message = `${(_opts$filename2 = opts.filename) != null ? _opts$filename2 : "unknown file"}: ${e.message}`;
45
+ if (!e.code) {
46
+ e.code = "BABEL_GENERATE_ERROR";
47
+ }
48
+ throw e;
49
+ }
50
+ return {
51
+ metadata: file.metadata,
52
+ options: opts,
53
+ ast: opts.ast === true ? file.ast : null,
54
+ code: outputCode === undefined ? null : outputCode,
55
+ map: outputMap === undefined ? null : outputMap,
56
+ sourceType: file.ast.program.sourceType,
57
+ externalDependencies: (0, _deepArray.flattenToSet)(config.externalDependencies)
58
+ };
59
+ }
60
+ function* transformFile(file, pluginPasses) {
61
+ const async = yield* (0, _async.isAsync)();
62
+ for (const pluginPairs of pluginPasses) {
63
+ const passPairs = [];
64
+ const passes = [];
65
+ const visitors = [];
66
+ for (const plugin of pluginPairs.concat([(0, _blockHoistPlugin.default)()])) {
67
+ const pass = new _pluginPass.default(file, plugin.key, plugin.options, async);
68
+ passPairs.push([plugin, pass]);
69
+ passes.push(pass);
70
+ visitors.push(plugin.visitor);
71
+ }
72
+ for (const [plugin, pass] of passPairs) {
73
+ if (plugin.pre) {
74
+ const fn = (0, _async.maybeAsync)(plugin.pre, `You appear to be using an async plugin/preset, but Babel has been called synchronously`);
75
+ yield* fn.call(pass, file);
76
+ }
77
+ }
78
+ const visitor = _traverse().default.visitors.merge(visitors, passes, file.opts.wrapPluginVisitorMethod);
79
+ {
80
+ (0, _traverse().default)(file.ast, visitor, file.scope);
81
+ }
82
+ for (const [plugin, pass] of passPairs) {
83
+ if (plugin.post) {
84
+ const fn = (0, _async.maybeAsync)(plugin.post, `You appear to be using an async plugin/preset, but Babel has been called synchronously`);
85
+ yield* fn.call(pass, file);
86
+ }
87
+ }
88
+ }
89
+ }
90
+ 0 && 0;
91
+
92
+ //# sourceMappingURL=index.js.map