@tachybase/module-pdf 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 (135) hide show
  1. package/.turbo/turbo-build.log +15 -0
  2. package/README.md +1 -0
  3. package/client.d.ts +2 -0
  4. package/client.js +1 -0
  5. package/dist/client/PdfInstruction.d.ts +107 -0
  6. package/dist/client/index.d.ts +10 -0
  7. package/dist/client/index.js +239 -0
  8. package/dist/externalVersion.js +11 -0
  9. package/dist/index.d.ts +2 -0
  10. package/dist/index.js +39 -0
  11. package/dist/node_modules/@babel/core/LICENSE +22 -0
  12. package/dist/node_modules/@babel/core/cjs-proxy.cjs +68 -0
  13. package/dist/node_modules/@babel/core/lib/config/cache-contexts.js +3 -0
  14. package/dist/node_modules/@babel/core/lib/config/caching.js +261 -0
  15. package/dist/node_modules/@babel/core/lib/config/config-chain.js +469 -0
  16. package/dist/node_modules/@babel/core/lib/config/config-descriptors.js +190 -0
  17. package/dist/node_modules/@babel/core/lib/config/files/configuration.js +287 -0
  18. package/dist/node_modules/@babel/core/lib/config/files/import.cjs +6 -0
  19. package/dist/node_modules/@babel/core/lib/config/files/index-browser.js +58 -0
  20. package/dist/node_modules/@babel/core/lib/config/files/index.js +78 -0
  21. package/dist/node_modules/@babel/core/lib/config/files/module-types.js +195 -0
  22. package/dist/node_modules/@babel/core/lib/config/files/package.js +61 -0
  23. package/dist/node_modules/@babel/core/lib/config/files/plugins.js +229 -0
  24. package/dist/node_modules/@babel/core/lib/config/files/types.js +3 -0
  25. package/dist/node_modules/@babel/core/lib/config/files/utils.js +36 -0
  26. package/dist/node_modules/@babel/core/lib/config/full.js +312 -0
  27. package/dist/node_modules/@babel/core/lib/config/helpers/config-api.js +84 -0
  28. package/dist/node_modules/@babel/core/lib/config/helpers/deep-array.js +23 -0
  29. package/dist/node_modules/@babel/core/lib/config/helpers/environment.js +12 -0
  30. package/dist/node_modules/@babel/core/lib/config/index.js +93 -0
  31. package/dist/node_modules/@babel/core/lib/config/item.js +67 -0
  32. package/dist/node_modules/@babel/core/lib/config/partial.js +158 -0
  33. package/dist/node_modules/@babel/core/lib/config/pattern-to-regex.js +38 -0
  34. package/dist/node_modules/@babel/core/lib/config/plugin.js +33 -0
  35. package/dist/node_modules/@babel/core/lib/config/printer.js +113 -0
  36. package/dist/node_modules/@babel/core/lib/config/resolve-targets-browser.js +41 -0
  37. package/dist/node_modules/@babel/core/lib/config/resolve-targets.js +61 -0
  38. package/dist/node_modules/@babel/core/lib/config/util.js +31 -0
  39. package/dist/node_modules/@babel/core/lib/config/validation/option-assertions.js +277 -0
  40. package/dist/node_modules/@babel/core/lib/config/validation/options.js +189 -0
  41. package/dist/node_modules/@babel/core/lib/config/validation/plugins.js +67 -0
  42. package/dist/node_modules/@babel/core/lib/config/validation/removed.js +68 -0
  43. package/dist/node_modules/@babel/core/lib/errors/config-error.js +18 -0
  44. package/dist/node_modules/@babel/core/lib/errors/rewrite-stack-trace.js +98 -0
  45. package/dist/node_modules/@babel/core/lib/gensync-utils/async.js +90 -0
  46. package/dist/node_modules/@babel/core/lib/gensync-utils/fs.js +31 -0
  47. package/dist/node_modules/@babel/core/lib/gensync-utils/functional.js +58 -0
  48. package/dist/node_modules/@babel/core/lib/index.js +227 -0
  49. package/dist/node_modules/@babel/core/lib/parse.js +47 -0
  50. package/dist/node_modules/@babel/core/lib/parser/index.js +79 -0
  51. package/dist/node_modules/@babel/core/lib/parser/util/missing-plugin-helper.js +339 -0
  52. package/dist/node_modules/@babel/core/lib/tools/build-external-helpers.js +144 -0
  53. package/dist/node_modules/@babel/core/lib/transform-ast.js +50 -0
  54. package/dist/node_modules/@babel/core/lib/transform-file-browser.js +23 -0
  55. package/dist/node_modules/@babel/core/lib/transform-file.js +40 -0
  56. package/dist/node_modules/@babel/core/lib/transform.js +49 -0
  57. package/dist/node_modules/@babel/core/lib/transformation/block-hoist-plugin.js +84 -0
  58. package/dist/node_modules/@babel/core/lib/transformation/file/babel-7-helpers.cjs +4 -0
  59. package/dist/node_modules/@babel/core/lib/transformation/file/file.js +214 -0
  60. package/dist/node_modules/@babel/core/lib/transformation/file/generate.js +84 -0
  61. package/dist/node_modules/@babel/core/lib/transformation/file/merge-map.js +37 -0
  62. package/dist/node_modules/@babel/core/lib/transformation/index.js +92 -0
  63. package/dist/node_modules/@babel/core/lib/transformation/normalize-file.js +129 -0
  64. package/dist/node_modules/@babel/core/lib/transformation/normalize-opts.js +59 -0
  65. package/dist/node_modules/@babel/core/lib/transformation/plugin-pass.js +50 -0
  66. package/dist/node_modules/@babel/core/lib/transformation/util/clone-deep.js +36 -0
  67. package/dist/node_modules/@babel/core/lib/vendor/import-meta-resolve.js +1043 -0
  68. package/dist/node_modules/@babel/core/node_modules/.bin/json5 +17 -0
  69. package/dist/node_modules/@babel/core/node_modules/.bin/parser +17 -0
  70. package/dist/node_modules/@babel/core/node_modules/.bin/semver +17 -0
  71. package/dist/node_modules/@babel/core/package.json +1 -0
  72. package/dist/node_modules/@babel/core/src/config/files/index-browser.ts +113 -0
  73. package/dist/node_modules/@babel/core/src/config/files/index.ts +29 -0
  74. package/dist/node_modules/@babel/core/src/config/resolve-targets-browser.ts +40 -0
  75. package/dist/node_modules/@babel/core/src/config/resolve-targets.ts +56 -0
  76. package/dist/node_modules/@babel/core/src/transform-file-browser.ts +31 -0
  77. package/dist/node_modules/@babel/core/src/transform-file.ts +55 -0
  78. package/dist/node_modules/@react-pdf/renderer/index.d.ts +590 -0
  79. package/dist/node_modules/@react-pdf/renderer/lib/react-pdf.browser.cjs +4558 -0
  80. package/dist/node_modules/@react-pdf/renderer/lib/react-pdf.browser.d.cts +590 -0
  81. package/dist/node_modules/@react-pdf/renderer/lib/react-pdf.browser.d.ts +590 -0
  82. package/dist/node_modules/@react-pdf/renderer/lib/react-pdf.browser.js +4505 -0
  83. package/dist/node_modules/@react-pdf/renderer/lib/react-pdf.browser.min.cjs +10 -0
  84. package/dist/node_modules/@react-pdf/renderer/lib/react-pdf.browser.min.d.cts +590 -0
  85. package/dist/node_modules/@react-pdf/renderer/lib/react-pdf.browser.min.d.ts +590 -0
  86. package/dist/node_modules/@react-pdf/renderer/lib/react-pdf.browser.min.js +10 -0
  87. package/dist/node_modules/@react-pdf/renderer/lib/react-pdf.cjs +40 -0
  88. package/dist/node_modules/@react-pdf/renderer/lib/react-pdf.d.cts +590 -0
  89. package/dist/node_modules/@react-pdf/renderer/lib/react-pdf.d.ts +590 -0
  90. package/dist/node_modules/@react-pdf/renderer/lib/react-pdf.js +4393 -0
  91. package/dist/node_modules/@react-pdf/renderer/lib/react-pdf.min.cjs +10 -0
  92. package/dist/node_modules/@react-pdf/renderer/lib/react-pdf.min.d.cts +590 -0
  93. package/dist/node_modules/@react-pdf/renderer/lib/react-pdf.min.d.ts +590 -0
  94. package/dist/node_modules/@react-pdf/renderer/lib/react-pdf.min.js +10 -0
  95. package/dist/node_modules/@react-pdf/renderer/package.json +1 -0
  96. package/dist/node_modules/fs-extra/LICENSE +15 -0
  97. package/dist/node_modules/fs-extra/lib/copy/copy-sync.js +161 -0
  98. package/dist/node_modules/fs-extra/lib/copy/copy.js +177 -0
  99. package/dist/node_modules/fs-extra/lib/copy/index.js +7 -0
  100. package/dist/node_modules/fs-extra/lib/empty/index.js +39 -0
  101. package/dist/node_modules/fs-extra/lib/ensure/file.js +66 -0
  102. package/dist/node_modules/fs-extra/lib/ensure/index.js +23 -0
  103. package/dist/node_modules/fs-extra/lib/ensure/link.js +64 -0
  104. package/dist/node_modules/fs-extra/lib/ensure/symlink-paths.js +101 -0
  105. package/dist/node_modules/fs-extra/lib/ensure/symlink-type.js +34 -0
  106. package/dist/node_modules/fs-extra/lib/ensure/symlink.js +67 -0
  107. package/dist/node_modules/fs-extra/lib/fs/index.js +140 -0
  108. package/dist/node_modules/fs-extra/lib/index.js +1 -0
  109. package/dist/node_modules/fs-extra/lib/json/index.js +16 -0
  110. package/dist/node_modules/fs-extra/lib/json/jsonfile.js +11 -0
  111. package/dist/node_modules/fs-extra/lib/json/output-json-sync.js +12 -0
  112. package/dist/node_modules/fs-extra/lib/json/output-json.js +12 -0
  113. package/dist/node_modules/fs-extra/lib/mkdirs/index.js +14 -0
  114. package/dist/node_modules/fs-extra/lib/mkdirs/make-dir.js +27 -0
  115. package/dist/node_modules/fs-extra/lib/mkdirs/utils.js +21 -0
  116. package/dist/node_modules/fs-extra/lib/move/index.js +7 -0
  117. package/dist/node_modules/fs-extra/lib/move/move-sync.js +55 -0
  118. package/dist/node_modules/fs-extra/lib/move/move.js +59 -0
  119. package/dist/node_modules/fs-extra/lib/output-file/index.js +31 -0
  120. package/dist/node_modules/fs-extra/lib/path-exists/index.js +12 -0
  121. package/dist/node_modules/fs-extra/lib/remove/index.js +17 -0
  122. package/dist/node_modules/fs-extra/lib/util/stat.js +158 -0
  123. package/dist/node_modules/fs-extra/lib/util/utimes.js +36 -0
  124. package/dist/node_modules/fs-extra/package.json +1 -0
  125. package/dist/server/PdfInstruction.d.ts +10 -0
  126. package/dist/server/PdfInstruction.js +108 -0
  127. package/dist/server/index.d.ts +2 -0
  128. package/dist/server/index.js +53 -0
  129. package/dist/server/plugin.d.ts +11 -0
  130. package/dist/server/plugin.js +102 -0
  131. package/dist/server/services/font-manager.d.ts +6 -0
  132. package/dist/server/services/font-manager.js +199 -0
  133. package/package.json +32 -0
  134. package/server.d.ts +2 -0
  135. package/server.js +1 -0
@@ -0,0 +1,287 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ROOT_CONFIG_FILENAMES = void 0;
7
+ exports.findConfigUpwards = findConfigUpwards;
8
+ exports.findRelativeConfig = findRelativeConfig;
9
+ exports.findRootConfig = findRootConfig;
10
+ exports.loadConfig = loadConfig;
11
+ exports.resolveShowConfigPath = resolveShowConfigPath;
12
+ function _debug() {
13
+ const data = require("debug");
14
+ _debug = function () {
15
+ return data;
16
+ };
17
+ return data;
18
+ }
19
+ function _fs() {
20
+ const data = require("fs");
21
+ _fs = function () {
22
+ return data;
23
+ };
24
+ return data;
25
+ }
26
+ function _path() {
27
+ const data = require("path");
28
+ _path = function () {
29
+ return data;
30
+ };
31
+ return data;
32
+ }
33
+ function _json() {
34
+ const data = require("json5");
35
+ _json = function () {
36
+ return data;
37
+ };
38
+ return data;
39
+ }
40
+ function _gensync() {
41
+ const data = require("gensync");
42
+ _gensync = function () {
43
+ return data;
44
+ };
45
+ return data;
46
+ }
47
+ var _caching = require("../caching.js");
48
+ var _configApi = require("../helpers/config-api.js");
49
+ var _utils = require("./utils.js");
50
+ var _moduleTypes = require("./module-types.js");
51
+ var _patternToRegex = require("../pattern-to-regex.js");
52
+ var _configError = require("../../errors/config-error.js");
53
+ var fs = require("../../gensync-utils/fs.js");
54
+ var _rewriteStackTrace = require("../../errors/rewrite-stack-trace.js");
55
+ var _async = require("../../gensync-utils/async.js");
56
+ const debug = _debug()("babel:config:loading:files:configuration");
57
+ const ROOT_CONFIG_FILENAMES = exports.ROOT_CONFIG_FILENAMES = ["babel.config.js", "babel.config.cjs", "babel.config.mjs", "babel.config.json", "babel.config.cts"];
58
+ const RELATIVE_CONFIG_FILENAMES = [".babelrc", ".babelrc.js", ".babelrc.cjs", ".babelrc.mjs", ".babelrc.json", ".babelrc.cts"];
59
+ const BABELIGNORE_FILENAME = ".babelignore";
60
+ const runConfig = (0, _caching.makeWeakCache)(function* runConfig(options, cache) {
61
+ yield* [];
62
+ return {
63
+ options: (0, _rewriteStackTrace.endHiddenCallStack)(options)((0, _configApi.makeConfigAPI)(cache)),
64
+ cacheNeedsConfiguration: !cache.configured()
65
+ };
66
+ });
67
+ function* readConfigCode(filepath, data) {
68
+ if (!_fs().existsSync(filepath)) return null;
69
+ let options = yield* (0, _moduleTypes.default)(filepath, (yield* (0, _async.isAsync)()) ? "auto" : "require", "You appear to be using a native ECMAScript module configuration " + "file, which is only supported when running Babel asynchronously " + "or when using the Node.js `--experimental-require-module` flag.", "You appear to be using a configuration file that contains top-level " + "await, which is only supported when running Babel asynchronously.");
70
+ let cacheNeedsConfiguration = false;
71
+ if (typeof options === "function") {
72
+ ({
73
+ options,
74
+ cacheNeedsConfiguration
75
+ } = yield* runConfig(options, data));
76
+ }
77
+ if (!options || typeof options !== "object" || Array.isArray(options)) {
78
+ throw new _configError.default(`Configuration should be an exported JavaScript object.`, filepath);
79
+ }
80
+ if (typeof options.then === "function") {
81
+ options.catch == null || options.catch(() => {});
82
+ throw new _configError.default(`You appear to be using an async configuration, ` + `which your current version of Babel does not support. ` + `We may add support for this in the future, ` + `but if you're on the most recent version of @babel/core and still ` + `seeing this error, then you'll need to synchronously return your config.`, filepath);
83
+ }
84
+ if (cacheNeedsConfiguration) throwConfigError(filepath);
85
+ return buildConfigFileObject(options, filepath);
86
+ }
87
+ const cfboaf = new WeakMap();
88
+ function buildConfigFileObject(options, filepath) {
89
+ let configFilesByFilepath = cfboaf.get(options);
90
+ if (!configFilesByFilepath) {
91
+ cfboaf.set(options, configFilesByFilepath = new Map());
92
+ }
93
+ let configFile = configFilesByFilepath.get(filepath);
94
+ if (!configFile) {
95
+ configFile = {
96
+ filepath,
97
+ dirname: _path().dirname(filepath),
98
+ options
99
+ };
100
+ configFilesByFilepath.set(filepath, configFile);
101
+ }
102
+ return configFile;
103
+ }
104
+ const packageToBabelConfig = (0, _caching.makeWeakCacheSync)(file => {
105
+ const babel = file.options["babel"];
106
+ if (babel === undefined) return null;
107
+ if (typeof babel !== "object" || Array.isArray(babel) || babel === null) {
108
+ throw new _configError.default(`.babel property must be an object`, file.filepath);
109
+ }
110
+ return {
111
+ filepath: file.filepath,
112
+ dirname: file.dirname,
113
+ options: babel
114
+ };
115
+ });
116
+ const readConfigJSON5 = (0, _utils.makeStaticFileCache)((filepath, content) => {
117
+ let options;
118
+ try {
119
+ options = _json().parse(content);
120
+ } catch (err) {
121
+ throw new _configError.default(`Error while parsing config - ${err.message}`, filepath);
122
+ }
123
+ if (!options) throw new _configError.default(`No config detected`, filepath);
124
+ if (typeof options !== "object") {
125
+ throw new _configError.default(`Config returned typeof ${typeof options}`, filepath);
126
+ }
127
+ if (Array.isArray(options)) {
128
+ throw new _configError.default(`Expected config object but found array`, filepath);
129
+ }
130
+ delete options["$schema"];
131
+ return {
132
+ filepath,
133
+ dirname: _path().dirname(filepath),
134
+ options
135
+ };
136
+ });
137
+ const readIgnoreConfig = (0, _utils.makeStaticFileCache)((filepath, content) => {
138
+ const ignoreDir = _path().dirname(filepath);
139
+ const ignorePatterns = content.split("\n").map(line => line.replace(/#.*$/, "").trim()).filter(Boolean);
140
+ for (const pattern of ignorePatterns) {
141
+ if (pattern[0] === "!") {
142
+ throw new _configError.default(`Negation of file paths is not supported.`, filepath);
143
+ }
144
+ }
145
+ return {
146
+ filepath,
147
+ dirname: _path().dirname(filepath),
148
+ ignore: ignorePatterns.map(pattern => (0, _patternToRegex.default)(pattern, ignoreDir))
149
+ };
150
+ });
151
+ function findConfigUpwards(rootDir) {
152
+ let dirname = rootDir;
153
+ for (;;) {
154
+ for (const filename of ROOT_CONFIG_FILENAMES) {
155
+ if (_fs().existsSync(_path().join(dirname, filename))) {
156
+ return dirname;
157
+ }
158
+ }
159
+ const nextDir = _path().dirname(dirname);
160
+ if (dirname === nextDir) break;
161
+ dirname = nextDir;
162
+ }
163
+ return null;
164
+ }
165
+ function* findRelativeConfig(packageData, envName, caller) {
166
+ let config = null;
167
+ let ignore = null;
168
+ const dirname = _path().dirname(packageData.filepath);
169
+ for (const loc of packageData.directories) {
170
+ if (!config) {
171
+ var _packageData$pkg;
172
+ config = yield* loadOneConfig(RELATIVE_CONFIG_FILENAMES, loc, envName, caller, ((_packageData$pkg = packageData.pkg) == null ? void 0 : _packageData$pkg.dirname) === loc ? packageToBabelConfig(packageData.pkg) : null);
173
+ }
174
+ if (!ignore) {
175
+ const ignoreLoc = _path().join(loc, BABELIGNORE_FILENAME);
176
+ ignore = yield* readIgnoreConfig(ignoreLoc);
177
+ if (ignore) {
178
+ debug("Found ignore %o from %o.", ignore.filepath, dirname);
179
+ }
180
+ }
181
+ }
182
+ return {
183
+ config,
184
+ ignore
185
+ };
186
+ }
187
+ function findRootConfig(dirname, envName, caller) {
188
+ return loadOneConfig(ROOT_CONFIG_FILENAMES, dirname, envName, caller);
189
+ }
190
+ function* loadOneConfig(names, dirname, envName, caller, previousConfig = null) {
191
+ const configs = yield* _gensync().all(names.map(filename => readConfig(_path().join(dirname, filename), envName, caller)));
192
+ const config = configs.reduce((previousConfig, config) => {
193
+ if (config && previousConfig) {
194
+ throw new _configError.default(`Multiple configuration files found. Please remove one:\n` + ` - ${_path().basename(previousConfig.filepath)}\n` + ` - ${config.filepath}\n` + `from ${dirname}`);
195
+ }
196
+ return config || previousConfig;
197
+ }, previousConfig);
198
+ if (config) {
199
+ debug("Found configuration %o from %o.", config.filepath, dirname);
200
+ }
201
+ return config;
202
+ }
203
+ function* loadConfig(name, dirname, envName, caller) {
204
+ const filepath = (((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, {
205
+ paths: [b]
206
+ }, M = require("module")) => {
207
+ let f = M._findPath(r, M._nodeModulePaths(b).concat(b));
208
+ if (f) return f;
209
+ f = new Error(`Cannot resolve module '${r}'`);
210
+ f.code = "MODULE_NOT_FOUND";
211
+ throw f;
212
+ })(name, {
213
+ paths: [dirname]
214
+ });
215
+ const conf = yield* readConfig(filepath, envName, caller);
216
+ if (!conf) {
217
+ throw new _configError.default(`Config file contains no configuration data`, filepath);
218
+ }
219
+ debug("Loaded config %o from %o.", name, dirname);
220
+ return conf;
221
+ }
222
+ function readConfig(filepath, envName, caller) {
223
+ const ext = _path().extname(filepath);
224
+ switch (ext) {
225
+ case ".js":
226
+ case ".cjs":
227
+ case ".mjs":
228
+ case ".cts":
229
+ return readConfigCode(filepath, {
230
+ envName,
231
+ caller
232
+ });
233
+ default:
234
+ return readConfigJSON5(filepath);
235
+ }
236
+ }
237
+ function* resolveShowConfigPath(dirname) {
238
+ const targetPath = process.env.BABEL_SHOW_CONFIG_FOR;
239
+ if (targetPath != null) {
240
+ const absolutePath = _path().resolve(dirname, targetPath);
241
+ const stats = yield* fs.stat(absolutePath);
242
+ if (!stats.isFile()) {
243
+ throw new Error(`${absolutePath}: BABEL_SHOW_CONFIG_FOR must refer to a regular file, directories are not supported.`);
244
+ }
245
+ return absolutePath;
246
+ }
247
+ return null;
248
+ }
249
+ function throwConfigError(filepath) {
250
+ throw new _configError.default(`\
251
+ Caching was left unconfigured. Babel's plugins, presets, and .babelrc.js files can be configured
252
+ for various types of caching, using the first param of their handler functions:
253
+
254
+ module.exports = function(api) {
255
+ // The API exposes the following:
256
+
257
+ // Cache the returned value forever and don't call this function again.
258
+ api.cache(true);
259
+
260
+ // Don't cache at all. Not recommended because it will be very slow.
261
+ api.cache(false);
262
+
263
+ // Cached based on the value of some function. If this function returns a value different from
264
+ // a previously-encountered value, the plugins will re-evaluate.
265
+ var env = api.cache(() => process.env.NODE_ENV);
266
+
267
+ // If testing for a specific env, we recommend specifics to avoid instantiating a plugin for
268
+ // any possible NODE_ENV value that might come up during plugin execution.
269
+ var isProd = api.cache(() => process.env.NODE_ENV === "production");
270
+
271
+ // .cache(fn) will perform a linear search though instances to find the matching plugin based
272
+ // based on previous instantiated plugins. If you want to recreate the plugin and discard the
273
+ // previous instance whenever something changes, you may use:
274
+ var isProd = api.cache.invalidate(() => process.env.NODE_ENV === "production");
275
+
276
+ // Note, we also expose the following more-verbose versions of the above examples:
277
+ api.cache.forever(); // api.cache(true)
278
+ api.cache.never(); // api.cache(false)
279
+ api.cache.using(fn); // api.cache(fn)
280
+
281
+ // Return the value that will be cached.
282
+ return { };
283
+ };`, filepath);
284
+ }
285
+ 0 && 0;
286
+
287
+ //# sourceMappingURL=configuration.js.map
@@ -0,0 +1,6 @@
1
+ module.exports = function import_(filepath) {
2
+ return import(filepath);
3
+ };
4
+ 0 && 0;
5
+
6
+ //# sourceMappingURL=import.cjs.map
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ROOT_CONFIG_FILENAMES = void 0;
7
+ exports.findConfigUpwards = findConfigUpwards;
8
+ exports.findPackageData = findPackageData;
9
+ exports.findRelativeConfig = findRelativeConfig;
10
+ exports.findRootConfig = findRootConfig;
11
+ exports.loadConfig = loadConfig;
12
+ exports.loadPlugin = loadPlugin;
13
+ exports.loadPreset = loadPreset;
14
+ exports.resolvePlugin = resolvePlugin;
15
+ exports.resolvePreset = resolvePreset;
16
+ exports.resolveShowConfigPath = resolveShowConfigPath;
17
+ function findConfigUpwards(rootDir) {
18
+ return null;
19
+ }
20
+ function* findPackageData(filepath) {
21
+ return {
22
+ filepath,
23
+ directories: [],
24
+ pkg: null,
25
+ isPackage: false
26
+ };
27
+ }
28
+ function* findRelativeConfig(pkgData, envName, caller) {
29
+ return {
30
+ config: null,
31
+ ignore: null
32
+ };
33
+ }
34
+ function* findRootConfig(dirname, envName, caller) {
35
+ return null;
36
+ }
37
+ function* loadConfig(name, dirname, envName, caller) {
38
+ throw new Error(`Cannot load ${name} relative to ${dirname} in a browser`);
39
+ }
40
+ function* resolveShowConfigPath(dirname) {
41
+ return null;
42
+ }
43
+ const ROOT_CONFIG_FILENAMES = exports.ROOT_CONFIG_FILENAMES = [];
44
+ function resolvePlugin(name, dirname) {
45
+ return null;
46
+ }
47
+ function resolvePreset(name, dirname) {
48
+ return null;
49
+ }
50
+ function loadPlugin(name, dirname) {
51
+ throw new Error(`Cannot load plugin ${name} relative to ${dirname} in a browser`);
52
+ }
53
+ function loadPreset(name, dirname) {
54
+ throw new Error(`Cannot load preset ${name} relative to ${dirname} in a browser`);
55
+ }
56
+ 0 && 0;
57
+
58
+ //# sourceMappingURL=index-browser.js.map
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "ROOT_CONFIG_FILENAMES", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _configuration.ROOT_CONFIG_FILENAMES;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "findConfigUpwards", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _configuration.findConfigUpwards;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "findPackageData", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _package.findPackageData;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "findRelativeConfig", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _configuration.findRelativeConfig;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "findRootConfig", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _configuration.findRootConfig;
34
+ }
35
+ });
36
+ Object.defineProperty(exports, "loadConfig", {
37
+ enumerable: true,
38
+ get: function () {
39
+ return _configuration.loadConfig;
40
+ }
41
+ });
42
+ Object.defineProperty(exports, "loadPlugin", {
43
+ enumerable: true,
44
+ get: function () {
45
+ return _plugins.loadPlugin;
46
+ }
47
+ });
48
+ Object.defineProperty(exports, "loadPreset", {
49
+ enumerable: true,
50
+ get: function () {
51
+ return _plugins.loadPreset;
52
+ }
53
+ });
54
+ Object.defineProperty(exports, "resolvePlugin", {
55
+ enumerable: true,
56
+ get: function () {
57
+ return _plugins.resolvePlugin;
58
+ }
59
+ });
60
+ Object.defineProperty(exports, "resolvePreset", {
61
+ enumerable: true,
62
+ get: function () {
63
+ return _plugins.resolvePreset;
64
+ }
65
+ });
66
+ Object.defineProperty(exports, "resolveShowConfigPath", {
67
+ enumerable: true,
68
+ get: function () {
69
+ return _configuration.resolveShowConfigPath;
70
+ }
71
+ });
72
+ var _package = require("./package.js");
73
+ var _configuration = require("./configuration.js");
74
+ var _plugins = require("./plugins.js");
75
+ ({});
76
+ 0 && 0;
77
+
78
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,195 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = loadCodeDefault;
7
+ exports.supportsESM = void 0;
8
+ var _async3 = require("../../gensync-utils/async.js");
9
+ function _path() {
10
+ const data = require("path");
11
+ _path = function () {
12
+ return data;
13
+ };
14
+ return data;
15
+ }
16
+ function _url() {
17
+ const data = require("url");
18
+ _url = function () {
19
+ return data;
20
+ };
21
+ return data;
22
+ }
23
+ function _semver() {
24
+ const data = require("semver");
25
+ _semver = function () {
26
+ return data;
27
+ };
28
+ return data;
29
+ }
30
+ function _debug() {
31
+ const data = require("debug");
32
+ _debug = function () {
33
+ return data;
34
+ };
35
+ return data;
36
+ }
37
+ var _rewriteStackTrace = require("../../errors/rewrite-stack-trace.js");
38
+ var _configError = require("../../errors/config-error.js");
39
+ var _transformFile = require("../../transform-file.js");
40
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
41
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
42
+ const debug = _debug()("babel:config:loading:files:module-types");
43
+ {
44
+ try {
45
+ var import_ = require("./import.cjs");
46
+ } catch (_unused) {}
47
+ }
48
+ const supportsESM = exports.supportsESM = _semver().satisfies(process.versions.node, "^12.17 || >=13.2");
49
+ const LOADING_CJS_FILES = new Set();
50
+ function loadCjsDefault(filepath) {
51
+ if (LOADING_CJS_FILES.has(filepath)) {
52
+ debug("Auto-ignoring usage of config %o.", filepath);
53
+ return {};
54
+ }
55
+ let module;
56
+ try {
57
+ LOADING_CJS_FILES.add(filepath);
58
+ module = (0, _rewriteStackTrace.endHiddenCallStack)(require)(filepath);
59
+ } finally {
60
+ LOADING_CJS_FILES.delete(filepath);
61
+ }
62
+ {
63
+ return module != null && (module.__esModule || module[Symbol.toStringTag] === "Module") ? module.default || (arguments[1] ? module : undefined) : module;
64
+ }
65
+ }
66
+ const loadMjsFromPath = (0, _rewriteStackTrace.endHiddenCallStack)(function () {
67
+ var _loadMjsFromPath = _asyncToGenerator(function* (filepath) {
68
+ const url = (0, _url().pathToFileURL)(filepath).toString() + "?import";
69
+ {
70
+ if (!import_) {
71
+ throw new _configError.default("Internal error: Native ECMAScript modules aren't supported by this platform.\n", filepath);
72
+ }
73
+ return yield import_(url);
74
+ }
75
+ });
76
+ function loadMjsFromPath(_x) {
77
+ return _loadMjsFromPath.apply(this, arguments);
78
+ }
79
+ return loadMjsFromPath;
80
+ }());
81
+ const SUPPORTED_EXTENSIONS = new Set([".js", ".mjs", ".cjs", ".cts"]);
82
+ const asyncModules = new Set();
83
+ function* loadCodeDefault(filepath, loader, esmError, tlaError) {
84
+ var _async2;
85
+ let async;
86
+ let ext = _path().extname(filepath);
87
+ if (!SUPPORTED_EXTENSIONS.has(ext)) ext = ".js";
88
+ const pattern = `${loader} ${ext}`;
89
+ switch (pattern) {
90
+ case "require .cjs":
91
+ case "auto .cjs":
92
+ {
93
+ return loadCjsDefault(filepath, arguments[2]);
94
+ }
95
+ case "require .cts":
96
+ case "auto .cts":
97
+ return loadCtsDefault(filepath);
98
+ case "auto .js":
99
+ case "require .js":
100
+ case "require .mjs":
101
+ try {
102
+ {
103
+ return loadCjsDefault(filepath, arguments[2]);
104
+ }
105
+ } catch (e) {
106
+ if (e.code === "ERR_REQUIRE_ASYNC_MODULE" || e.code === "ERR_REQUIRE_CYCLE_MODULE" && asyncModules.has(filepath)) {
107
+ var _async;
108
+ asyncModules.add(filepath);
109
+ if (!((_async = async) != null ? _async : async = yield* (0, _async3.isAsync)())) {
110
+ throw new _configError.default(tlaError, filepath);
111
+ }
112
+ } else if (e.code === "ERR_REQUIRE_ESM" || ext === ".mjs") {} else {
113
+ throw e;
114
+ }
115
+ }
116
+ case "auto .mjs":
117
+ if ((_async2 = async) != null ? _async2 : async = yield* (0, _async3.isAsync)()) {
118
+ return (yield* (0, _async3.waitFor)(loadMjsFromPath(filepath))).default;
119
+ }
120
+ throw new _configError.default(esmError, filepath);
121
+ default:
122
+ throw new Error("Internal Babel error: unreachable code.");
123
+ }
124
+ }
125
+ function loadCtsDefault(filepath) {
126
+ const ext = ".cts";
127
+ const hasTsSupport = !!(require.extensions[".ts"] || require.extensions[".cts"] || require.extensions[".mts"]);
128
+ let handler;
129
+ if (!hasTsSupport) {
130
+ const opts = {
131
+ babelrc: false,
132
+ configFile: false,
133
+ sourceType: "unambiguous",
134
+ sourceMaps: "inline",
135
+ sourceFileName: _path().basename(filepath),
136
+ presets: [[getTSPreset(filepath), Object.assign({
137
+ onlyRemoveTypeImports: true,
138
+ optimizeConstEnums: true
139
+ }, {
140
+ allowDeclareFields: true
141
+ })]]
142
+ };
143
+ handler = function (m, filename) {
144
+ if (handler && filename.endsWith(ext)) {
145
+ try {
146
+ return m._compile((0, _transformFile.transformFileSync)(filename, Object.assign({}, opts, {
147
+ filename
148
+ })).code, filename);
149
+ } catch (error) {
150
+ if (!hasTsSupport) {
151
+ const packageJson = require("@babel/preset-typescript/package.json");
152
+ if (_semver().lt(packageJson.version, "7.21.4")) {
153
+ console.error("`.cts` configuration file failed to load, please try to update `@babel/preset-typescript`.");
154
+ }
155
+ }
156
+ throw error;
157
+ }
158
+ }
159
+ return require.extensions[".js"](m, filename);
160
+ };
161
+ require.extensions[ext] = handler;
162
+ }
163
+ try {
164
+ return loadCjsDefault(filepath);
165
+ } finally {
166
+ if (!hasTsSupport) {
167
+ if (require.extensions[ext] === handler) delete require.extensions[ext];
168
+ handler = undefined;
169
+ }
170
+ }
171
+ }
172
+ function getTSPreset(filepath) {
173
+ try {
174
+ return require("@babel/preset-typescript");
175
+ } catch (error) {
176
+ if (error.code !== "MODULE_NOT_FOUND") throw error;
177
+ let message = "You appear to be using a .cts file as Babel configuration, but the `@babel/preset-typescript` package was not found: please install it!";
178
+ {
179
+ if (process.versions.pnp) {
180
+ message += `
181
+ If you are using Yarn Plug'n'Play, you may also need to add the following configuration to your .yarnrc.yml file:
182
+
183
+ packageExtensions:
184
+ \t"@babel/core@*":
185
+ \t\tpeerDependencies:
186
+ \t\t\t"@babel/preset-typescript": "*"
187
+ `;
188
+ }
189
+ }
190
+ throw new _configError.default(message, filepath);
191
+ }
192
+ }
193
+ 0 && 0;
194
+
195
+ //# sourceMappingURL=module-types.js.map
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.findPackageData = findPackageData;
7
+ function _path() {
8
+ const data = require("path");
9
+ _path = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ var _utils = require("./utils.js");
15
+ var _configError = require("../../errors/config-error.js");
16
+ const PACKAGE_FILENAME = "package.json";
17
+ const readConfigPackage = (0, _utils.makeStaticFileCache)((filepath, content) => {
18
+ let options;
19
+ try {
20
+ options = JSON.parse(content);
21
+ } catch (err) {
22
+ throw new _configError.default(`Error while parsing JSON - ${err.message}`, filepath);
23
+ }
24
+ if (!options) throw new Error(`${filepath}: No config detected`);
25
+ if (typeof options !== "object") {
26
+ throw new _configError.default(`Config returned typeof ${typeof options}`, filepath);
27
+ }
28
+ if (Array.isArray(options)) {
29
+ throw new _configError.default(`Expected config object but found array`, filepath);
30
+ }
31
+ return {
32
+ filepath,
33
+ dirname: _path().dirname(filepath),
34
+ options
35
+ };
36
+ });
37
+ function* findPackageData(filepath) {
38
+ let pkg = null;
39
+ const directories = [];
40
+ let isPackage = true;
41
+ let dirname = _path().dirname(filepath);
42
+ while (!pkg && _path().basename(dirname) !== "node_modules") {
43
+ directories.push(dirname);
44
+ pkg = yield* readConfigPackage(_path().join(dirname, PACKAGE_FILENAME));
45
+ const nextLoc = _path().dirname(dirname);
46
+ if (dirname === nextLoc) {
47
+ isPackage = false;
48
+ break;
49
+ }
50
+ dirname = nextLoc;
51
+ }
52
+ return {
53
+ filepath,
54
+ directories,
55
+ pkg,
56
+ isPackage
57
+ };
58
+ }
59
+ 0 && 0;
60
+
61
+ //# sourceMappingURL=package.js.map