rolldown 1.0.0-beta.1-commit.35fb1f8 → 1.0.0-beta.10

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 (153) hide show
  1. package/bin/cli.mjs +2 -0
  2. package/dist/cli.cjs +1748 -0
  3. package/dist/cli.d.cts +1 -0
  4. package/dist/cli.d.mts +1 -0
  5. package/dist/cli.mjs +1745 -0
  6. package/dist/config.cjs +12 -0
  7. package/dist/config.d.cts +12 -0
  8. package/dist/config.d.mts +12 -0
  9. package/dist/config.mjs +10 -0
  10. package/dist/experimental-index.cjs +132 -0
  11. package/dist/experimental-index.d.cts +96 -0
  12. package/dist/experimental-index.d.mts +96 -0
  13. package/dist/experimental-index.mjs +91 -0
  14. package/dist/filter-index.cjs +105 -0
  15. package/dist/filter-index.d.cts +5 -0
  16. package/dist/filter-index.d.mts +5 -0
  17. package/dist/filter-index.mjs +44 -0
  18. package/dist/index.cjs +9 -0
  19. package/dist/index.d.cts +4 -0
  20. package/dist/index.d.mts +4 -0
  21. package/dist/index.mjs +5 -0
  22. package/dist/{cjs/parallel-plugin-worker.cjs → parallel-plugin-worker.cjs} +7 -14
  23. package/dist/parallel-plugin-worker.d.cts +1 -0
  24. package/dist/parallel-plugin-worker.d.mts +1 -0
  25. package/dist/{esm/parallel-plugin-worker.mjs → parallel-plugin-worker.mjs} +5 -11
  26. package/dist/{cjs/parallel-plugin.cjs → parallel-plugin.cjs} +1 -2
  27. package/dist/parallel-plugin.d.cts +15 -0
  28. package/dist/parallel-plugin.d.mts +15 -0
  29. package/dist/{esm/parallel-plugin.mjs → parallel-plugin.mjs} +0 -1
  30. package/dist/parse-ast-index.cjs +4 -0
  31. package/dist/parse-ast-index.d.cts +9 -0
  32. package/dist/parse-ast-index.d.mts +9 -0
  33. package/dist/parse-ast-index.mjs +3 -0
  34. package/dist/shared/binding.d-Bl5Vi4GH.d.mts +1702 -0
  35. package/dist/shared/binding.d-DcFBMcjI.d.cts +1702 -0
  36. package/dist/shared/{chunk-qZFfknuJ.cjs → chunk-DDkG_k5U.cjs} +0 -1
  37. package/dist/shared/define-config.d-B2xOSmbM.d.cts +1082 -0
  38. package/dist/shared/define-config.d-USfUuKiR.d.mts +1082 -0
  39. package/dist/shared/load-config-D6gW8FDa.cjs +125 -0
  40. package/dist/shared/load-config-eyuttVHY.mjs +119 -0
  41. package/dist/shared/misc-BKp5iIef.cjs +67 -0
  42. package/dist/shared/misc-BN0nse6C.mjs +25 -0
  43. package/dist/shared/{binding-fhgdIkpS.cjs → parse-ast-index-BvK1MT-L.cjs} +347 -309
  44. package/dist/shared/{binding-Bl7VQy7c.mjs → parse-ast-index-PSQWLeSo.mjs} +334 -277
  45. package/dist/shared/prompt-8EeOGx1_.cjs +854 -0
  46. package/dist/shared/prompt-C3zHEaSG.mjs +852 -0
  47. package/dist/shared/src-C2v46mL8.cjs +4654 -0
  48. package/dist/shared/src-D-VRn8rI.mjs +4456 -0
  49. package/package.json +62 -61
  50. package/bin/cli.js +0 -2
  51. package/dist/cjs/cli.cjs +0 -769
  52. package/dist/cjs/experimental-index.cjs +0 -79
  53. package/dist/cjs/index.cjs +0 -8
  54. package/dist/cjs/parse-ast-index.cjs +0 -57
  55. package/dist/esm/cli.mjs +0 -766
  56. package/dist/esm/experimental-index.mjs +0 -56
  57. package/dist/esm/index.mjs +0 -4
  58. package/dist/esm/parse-ast-index.mjs +0 -55
  59. package/dist/shared/consola_36c0034f-Cx52UqEq.mjs +0 -832
  60. package/dist/shared/consola_36c0034f-CynBWXXO.cjs +0 -859
  61. package/dist/shared/prompt-B58MxVuU.cjs +0 -762
  62. package/dist/shared/prompt-DjjlOckE.mjs +0 -758
  63. package/dist/shared/src-Busnx6mE.cjs +0 -2812
  64. package/dist/shared/src-DNOXsZr0.mjs +0 -2631
  65. package/dist/tsconfig.dts.tsbuildinfo +0 -1
  66. package/dist/types/api/build.d.ts +0 -18
  67. package/dist/types/api/experimental.d.ts +0 -7
  68. package/dist/types/api/rolldown/index.d.ts +0 -3
  69. package/dist/types/api/rolldown/rolldown-build.d.ts +0 -12
  70. package/dist/types/api/watch/index.d.ts +0 -3
  71. package/dist/types/api/watch/watch-emitter.d.ts +0 -31
  72. package/dist/types/api/watch/watcher.d.ts +0 -13
  73. package/dist/types/binding.d.ts +0 -1287
  74. package/dist/types/builtin-plugin/alias-plugin.d.ts +0 -10
  75. package/dist/types/builtin-plugin/constructors.d.ts +0 -20
  76. package/dist/types/builtin-plugin/replace-plugin.d.ts +0 -28
  77. package/dist/types/builtin-plugin/transform-plugin.d.ts +0 -9
  78. package/dist/types/builtin-plugin/utils.d.ts +0 -8
  79. package/dist/types/cli/arguments/alias.d.ts +0 -16
  80. package/dist/types/cli/arguments/index.d.ts +0 -15
  81. package/dist/types/cli/arguments/normalize.d.ts +0 -12
  82. package/dist/types/cli/arguments/utils.d.ts +0 -8
  83. package/dist/types/cli/colors.d.ts +0 -11
  84. package/dist/types/cli/commands/bundle.d.ts +0 -3
  85. package/dist/types/cli/commands/help.d.ts +0 -1
  86. package/dist/types/cli/index.d.ts +0 -1
  87. package/dist/types/cli/load-config.d.ts +0 -3
  88. package/dist/types/cli/logger.d.ts +0 -5
  89. package/dist/types/constants/plugin-context.d.ts +0 -7
  90. package/dist/types/constants/plugin.d.ts +0 -45
  91. package/dist/types/experimental-index.d.ts +0 -9
  92. package/dist/types/index.d.ts +0 -28
  93. package/dist/types/log/logHandler.d.ts +0 -4
  94. package/dist/types/log/logger.d.ts +0 -6
  95. package/dist/types/log/logging.d.ts +0 -11
  96. package/dist/types/log/logs.d.ts +0 -18
  97. package/dist/types/options/input-options.d.ts +0 -125
  98. package/dist/types/options/normalized-input-options.d.ts +0 -18
  99. package/dist/types/options/normalized-output-options.d.ts +0 -67
  100. package/dist/types/options/output-options.d.ts +0 -80
  101. package/dist/types/options/watch-options.d.ts +0 -5
  102. package/dist/types/parallel-plugin-worker.d.ts +0 -1
  103. package/dist/types/parallel-plugin.d.ts +0 -1
  104. package/dist/types/parse-ast-index.d.ts +0 -4
  105. package/dist/types/plugin/bindingify-build-hooks.d.ts +0 -10
  106. package/dist/types/plugin/bindingify-hook-filter.d.ts +0 -7
  107. package/dist/types/plugin/bindingify-output-hooks.d.ts +0 -14
  108. package/dist/types/plugin/bindingify-plugin-hook-meta.d.ts +0 -8
  109. package/dist/types/plugin/bindingify-plugin.d.ts +0 -15
  110. package/dist/types/plugin/bindingify-watch-hooks.d.ts +0 -5
  111. package/dist/types/plugin/hook-filter.d.ts +0 -48
  112. package/dist/types/plugin/index.d.ts +0 -126
  113. package/dist/types/plugin/minimal-plugin-context.d.ts +0 -15
  114. package/dist/types/plugin/parallel-plugin-implementation.d.ts +0 -10
  115. package/dist/types/plugin/parallel-plugin.d.ts +0 -9
  116. package/dist/types/plugin/plugin-context-data.d.ts +0 -16
  117. package/dist/types/plugin/plugin-context.d.ts +0 -52
  118. package/dist/types/plugin/plugin-driver.d.ts +0 -8
  119. package/dist/types/plugin/transform-plugin-context.d.ts +0 -17
  120. package/dist/types/types/assert.d.ts +0 -13
  121. package/dist/types/types/config-export.d.ts +0 -5
  122. package/dist/types/types/misc.d.ts +0 -40
  123. package/dist/types/types/module-info.d.ts +0 -15
  124. package/dist/types/types/module-side-effects.d.ts +0 -10
  125. package/dist/types/types/output-bundle.d.ts +0 -4
  126. package/dist/types/types/rolldown-options.d.ts +0 -5
  127. package/dist/types/types/rolldown-output.d.ts +0 -63
  128. package/dist/types/types/schema.d.ts +0 -33
  129. package/dist/types/types/sourcemap.d.ts +0 -13
  130. package/dist/types/types/utils.d.ts +0 -13
  131. package/dist/types/utils/asset-source.d.ts +0 -4
  132. package/dist/types/utils/async-flatten.d.ts +0 -1
  133. package/dist/types/utils/bindingify-input-options.d.ts +0 -7
  134. package/dist/types/utils/bindingify-output-options.d.ts +0 -3
  135. package/dist/types/utils/code-frame.d.ts +0 -1
  136. package/dist/types/utils/compose-js-plugins.d.ts +0 -2
  137. package/dist/types/utils/create-bundler-option.d.ts +0 -11
  138. package/dist/types/utils/create-bundler.d.ts +0 -8
  139. package/dist/types/utils/define-config.d.ts +0 -5
  140. package/dist/types/utils/error.d.ts +0 -2
  141. package/dist/types/utils/initialize-parallel-plugins.d.ts +0 -19
  142. package/dist/types/utils/misc.d.ts +0 -6
  143. package/dist/types/utils/normalize-hook.d.ts +0 -7
  144. package/dist/types/utils/normalize-plugin-option.d.ts +0 -13
  145. package/dist/types/utils/normalize-string-or-regex.d.ts +0 -2
  146. package/dist/types/utils/plugin/index.d.ts +0 -2
  147. package/dist/types/utils/transform-module-info.d.ts +0 -4
  148. package/dist/types/utils/transform-rendered-chunk.d.ts +0 -4
  149. package/dist/types/utils/transform-rendered-module.d.ts +0 -3
  150. package/dist/types/utils/transform-side-effects.d.ts +0 -3
  151. package/dist/types/utils/transform-sourcemap.d.ts +0 -3
  152. package/dist/types/utils/transform-to-rollup-output.d.ts +0 -11
  153. package/dist/types/utils/validator.d.ts +0 -7
@@ -0,0 +1,125 @@
1
+ const require_chunk = require('./chunk-DDkG_k5U.cjs');
2
+ const require_src = require('./src-C2v46mL8.cjs');
3
+ const node_fs = require_chunk.__toESM(require("node:fs"));
4
+ const node_path = require_chunk.__toESM(require("node:path"));
5
+ const node_url = require_chunk.__toESM(require("node:url"));
6
+ const node_process = require_chunk.__toESM(require("node:process"));
7
+ const node_fs_promises = require_chunk.__toESM(require("node:fs/promises"));
8
+
9
+ //#region src/utils/load-config.ts
10
+ async function bundleTsConfig(configFile, isEsm) {
11
+ const dirnameVarName = "injected_original_dirname";
12
+ const filenameVarName = "injected_original_filename";
13
+ const importMetaUrlVarName = "injected_original_import_meta_url";
14
+ const bundle = await require_src.rolldown({
15
+ input: configFile,
16
+ platform: "node",
17
+ resolve: { mainFields: ["main"] },
18
+ define: {
19
+ __dirname: dirnameVarName,
20
+ __filename: filenameVarName,
21
+ "import.meta.url": importMetaUrlVarName,
22
+ "import.meta.dirname": dirnameVarName,
23
+ "import.meta.filename": filenameVarName
24
+ },
25
+ treeshake: false,
26
+ external: [/^[\w@][^:]/],
27
+ plugins: [{
28
+ name: "inject-file-scope-variables",
29
+ transform: {
30
+ filter: { id: /\.[cm]?[jt]s$/ },
31
+ async handler(code, id) {
32
+ const injectValues = `const ${dirnameVarName} = ${JSON.stringify(node_path.default.dirname(id))};const ${filenameVarName} = ${JSON.stringify(id)};const ${importMetaUrlVarName} = ${JSON.stringify((0, node_url.pathToFileURL)(id).href)};`;
33
+ return {
34
+ code: injectValues + code,
35
+ map: null
36
+ };
37
+ }
38
+ }
39
+ }]
40
+ });
41
+ const outputDir = node_path.default.dirname(configFile);
42
+ const result = await bundle.write({
43
+ dir: outputDir,
44
+ format: isEsm ? "esm" : "cjs",
45
+ sourcemap: "inline",
46
+ entryFileNames: `rolldown.config.[hash]${node_path.default.extname(configFile).replace("ts", "js")}`
47
+ });
48
+ const fileName = result.output.find((chunk) => chunk.type === "chunk" && chunk.isEntry).fileName;
49
+ return node_path.default.join(outputDir, fileName);
50
+ }
51
+ const SUPPORTED_JS_CONFIG_FORMATS = [
52
+ ".js",
53
+ ".mjs",
54
+ ".cjs"
55
+ ];
56
+ const SUPPORTED_TS_CONFIG_FORMATS = [
57
+ ".ts",
58
+ ".mts",
59
+ ".cts"
60
+ ];
61
+ const SUPPORTED_CONFIG_FORMATS = [...SUPPORTED_JS_CONFIG_FORMATS, ...SUPPORTED_TS_CONFIG_FORMATS];
62
+ const DEFAULT_CONFIG_BASE = "rolldown.config";
63
+ async function findConfigFileNameInCwd() {
64
+ const filesInWorkingDirectory = new Set(await (0, node_fs_promises.readdir)((0, node_process.cwd)()));
65
+ for (const extension of SUPPORTED_CONFIG_FORMATS) {
66
+ const fileName = `${DEFAULT_CONFIG_BASE}${extension}`;
67
+ if (filesInWorkingDirectory.has(fileName)) return fileName;
68
+ }
69
+ throw new Error("No `rolldown.config` configuration file found.");
70
+ }
71
+ async function loadTsConfig(configFile) {
72
+ const isEsm = isFilePathESM(configFile);
73
+ const file = await bundleTsConfig(configFile, isEsm);
74
+ try {
75
+ return (await import((0, node_url.pathToFileURL)(file).href)).default;
76
+ } finally {
77
+ node_fs.default.unlink(file, () => {});
78
+ }
79
+ }
80
+ function isFilePathESM(filePath) {
81
+ if (/\.m[jt]s$/.test(filePath)) return true;
82
+ else if (/\.c[jt]s$/.test(filePath)) return false;
83
+ else {
84
+ const pkg = findNearestPackageData(node_path.default.dirname(filePath));
85
+ if (pkg) return pkg.type === "module";
86
+ return false;
87
+ }
88
+ }
89
+ function findNearestPackageData(basedir) {
90
+ while (basedir) {
91
+ const pkgPath = node_path.default.join(basedir, "package.json");
92
+ if (tryStatSync(pkgPath)?.isFile()) try {
93
+ return JSON.parse(node_fs.default.readFileSync(pkgPath, "utf-8"));
94
+ } catch {}
95
+ const nextBasedir = node_path.default.dirname(basedir);
96
+ if (nextBasedir === basedir) break;
97
+ basedir = nextBasedir;
98
+ }
99
+ return null;
100
+ }
101
+ function tryStatSync(file) {
102
+ try {
103
+ return node_fs.default.statSync(file, { throwIfNoEntry: false });
104
+ } catch {}
105
+ }
106
+ async function loadConfig(configPath) {
107
+ const ext = node_path.default.extname(configPath = configPath || await findConfigFileNameInCwd());
108
+ try {
109
+ if (SUPPORTED_JS_CONFIG_FORMATS.includes(ext) || process.env.NODE_OPTIONS?.includes("--import=tsx") && SUPPORTED_TS_CONFIG_FORMATS.includes(ext)) return (await import((0, node_url.pathToFileURL)(configPath).href)).default;
110
+ else if (SUPPORTED_TS_CONFIG_FORMATS.includes(ext)) {
111
+ const rawConfigPath = node_path.default.resolve(configPath);
112
+ return await loadTsConfig(rawConfigPath);
113
+ } else throw new Error(`Unsupported config format. Expected: \`${SUPPORTED_CONFIG_FORMATS.join(",")}\` but got \`${ext}\``);
114
+ } catch (err) {
115
+ throw new Error("Error happened while loading config.", { cause: err });
116
+ }
117
+ }
118
+
119
+ //#endregion
120
+ Object.defineProperty(exports, 'loadConfig', {
121
+ enumerable: true,
122
+ get: function () {
123
+ return loadConfig;
124
+ }
125
+ });
@@ -0,0 +1,119 @@
1
+ import { rolldown } from "./src-D-VRn8rI.mjs";
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import { pathToFileURL } from "node:url";
5
+ import { cwd } from "node:process";
6
+ import { readdir } from "node:fs/promises";
7
+
8
+ //#region src/utils/load-config.ts
9
+ async function bundleTsConfig(configFile, isEsm) {
10
+ const dirnameVarName = "injected_original_dirname";
11
+ const filenameVarName = "injected_original_filename";
12
+ const importMetaUrlVarName = "injected_original_import_meta_url";
13
+ const bundle = await rolldown({
14
+ input: configFile,
15
+ platform: "node",
16
+ resolve: { mainFields: ["main"] },
17
+ define: {
18
+ __dirname: dirnameVarName,
19
+ __filename: filenameVarName,
20
+ "import.meta.url": importMetaUrlVarName,
21
+ "import.meta.dirname": dirnameVarName,
22
+ "import.meta.filename": filenameVarName
23
+ },
24
+ treeshake: false,
25
+ external: [/^[\w@][^:]/],
26
+ plugins: [{
27
+ name: "inject-file-scope-variables",
28
+ transform: {
29
+ filter: { id: /\.[cm]?[jt]s$/ },
30
+ async handler(code, id) {
31
+ const injectValues = `const ${dirnameVarName} = ${JSON.stringify(path.dirname(id))};const ${filenameVarName} = ${JSON.stringify(id)};const ${importMetaUrlVarName} = ${JSON.stringify(pathToFileURL(id).href)};`;
32
+ return {
33
+ code: injectValues + code,
34
+ map: null
35
+ };
36
+ }
37
+ }
38
+ }]
39
+ });
40
+ const outputDir = path.dirname(configFile);
41
+ const result = await bundle.write({
42
+ dir: outputDir,
43
+ format: isEsm ? "esm" : "cjs",
44
+ sourcemap: "inline",
45
+ entryFileNames: `rolldown.config.[hash]${path.extname(configFile).replace("ts", "js")}`
46
+ });
47
+ const fileName = result.output.find((chunk) => chunk.type === "chunk" && chunk.isEntry).fileName;
48
+ return path.join(outputDir, fileName);
49
+ }
50
+ const SUPPORTED_JS_CONFIG_FORMATS = [
51
+ ".js",
52
+ ".mjs",
53
+ ".cjs"
54
+ ];
55
+ const SUPPORTED_TS_CONFIG_FORMATS = [
56
+ ".ts",
57
+ ".mts",
58
+ ".cts"
59
+ ];
60
+ const SUPPORTED_CONFIG_FORMATS = [...SUPPORTED_JS_CONFIG_FORMATS, ...SUPPORTED_TS_CONFIG_FORMATS];
61
+ const DEFAULT_CONFIG_BASE = "rolldown.config";
62
+ async function findConfigFileNameInCwd() {
63
+ const filesInWorkingDirectory = new Set(await readdir(cwd()));
64
+ for (const extension of SUPPORTED_CONFIG_FORMATS) {
65
+ const fileName = `${DEFAULT_CONFIG_BASE}${extension}`;
66
+ if (filesInWorkingDirectory.has(fileName)) return fileName;
67
+ }
68
+ throw new Error("No `rolldown.config` configuration file found.");
69
+ }
70
+ async function loadTsConfig(configFile) {
71
+ const isEsm = isFilePathESM(configFile);
72
+ const file = await bundleTsConfig(configFile, isEsm);
73
+ try {
74
+ return (await import(pathToFileURL(file).href)).default;
75
+ } finally {
76
+ fs.unlink(file, () => {});
77
+ }
78
+ }
79
+ function isFilePathESM(filePath) {
80
+ if (/\.m[jt]s$/.test(filePath)) return true;
81
+ else if (/\.c[jt]s$/.test(filePath)) return false;
82
+ else {
83
+ const pkg = findNearestPackageData(path.dirname(filePath));
84
+ if (pkg) return pkg.type === "module";
85
+ return false;
86
+ }
87
+ }
88
+ function findNearestPackageData(basedir) {
89
+ while (basedir) {
90
+ const pkgPath = path.join(basedir, "package.json");
91
+ if (tryStatSync(pkgPath)?.isFile()) try {
92
+ return JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
93
+ } catch {}
94
+ const nextBasedir = path.dirname(basedir);
95
+ if (nextBasedir === basedir) break;
96
+ basedir = nextBasedir;
97
+ }
98
+ return null;
99
+ }
100
+ function tryStatSync(file) {
101
+ try {
102
+ return fs.statSync(file, { throwIfNoEntry: false });
103
+ } catch {}
104
+ }
105
+ async function loadConfig(configPath) {
106
+ const ext = path.extname(configPath = configPath || await findConfigFileNameInCwd());
107
+ try {
108
+ if (SUPPORTED_JS_CONFIG_FORMATS.includes(ext) || process.env.NODE_OPTIONS?.includes("--import=tsx") && SUPPORTED_TS_CONFIG_FORMATS.includes(ext)) return (await import(pathToFileURL(configPath).href)).default;
109
+ else if (SUPPORTED_TS_CONFIG_FORMATS.includes(ext)) {
110
+ const rawConfigPath = path.resolve(configPath);
111
+ return await loadTsConfig(rawConfigPath);
112
+ } else throw new Error(`Unsupported config format. Expected: \`${SUPPORTED_CONFIG_FORMATS.join(",")}\` but got \`${ext}\``);
113
+ } catch (err) {
114
+ throw new Error("Error happened while loading config.", { cause: err });
115
+ }
116
+ }
117
+
118
+ //#endregion
119
+ export { loadConfig };
@@ -0,0 +1,67 @@
1
+
2
+ //#region src/utils/misc.ts
3
+ function arraify(value) {
4
+ return Array.isArray(value) ? value : [value];
5
+ }
6
+ function isNullish(value) {
7
+ return value === null || value === void 0;
8
+ }
9
+ function isPromiseLike(value) {
10
+ return value && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
11
+ }
12
+ function unimplemented(info) {
13
+ if (info) throw new Error(`unimplemented: ${info}`);
14
+ throw new Error("unimplemented");
15
+ }
16
+ function unreachable(info) {
17
+ if (info) throw new Error(`unreachable: ${info}`);
18
+ throw new Error("unreachable");
19
+ }
20
+ function unsupported(info) {
21
+ throw new Error(`UNSUPPORTED: ${info}`);
22
+ }
23
+ function noop(..._args) {}
24
+
25
+ //#endregion
26
+ Object.defineProperty(exports, 'arraify', {
27
+ enumerable: true,
28
+ get: function () {
29
+ return arraify;
30
+ }
31
+ });
32
+ Object.defineProperty(exports, 'isNullish', {
33
+ enumerable: true,
34
+ get: function () {
35
+ return isNullish;
36
+ }
37
+ });
38
+ Object.defineProperty(exports, 'isPromiseLike', {
39
+ enumerable: true,
40
+ get: function () {
41
+ return isPromiseLike;
42
+ }
43
+ });
44
+ Object.defineProperty(exports, 'noop', {
45
+ enumerable: true,
46
+ get: function () {
47
+ return noop;
48
+ }
49
+ });
50
+ Object.defineProperty(exports, 'unimplemented', {
51
+ enumerable: true,
52
+ get: function () {
53
+ return unimplemented;
54
+ }
55
+ });
56
+ Object.defineProperty(exports, 'unreachable', {
57
+ enumerable: true,
58
+ get: function () {
59
+ return unreachable;
60
+ }
61
+ });
62
+ Object.defineProperty(exports, 'unsupported', {
63
+ enumerable: true,
64
+ get: function () {
65
+ return unsupported;
66
+ }
67
+ });
@@ -0,0 +1,25 @@
1
+ //#region src/utils/misc.ts
2
+ function arraify(value) {
3
+ return Array.isArray(value) ? value : [value];
4
+ }
5
+ function isNullish(value) {
6
+ return value === null || value === void 0;
7
+ }
8
+ function isPromiseLike(value) {
9
+ return value && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
10
+ }
11
+ function unimplemented(info) {
12
+ if (info) throw new Error(`unimplemented: ${info}`);
13
+ throw new Error("unimplemented");
14
+ }
15
+ function unreachable(info) {
16
+ if (info) throw new Error(`unreachable: ${info}`);
17
+ throw new Error("unreachable");
18
+ }
19
+ function unsupported(info) {
20
+ throw new Error(`UNSUPPORTED: ${info}`);
21
+ }
22
+ function noop(..._args) {}
23
+
24
+ //#endregion
25
+ export { arraify, isNullish, isPromiseLike, noop, unimplemented, unreachable, unsupported };