@opentui/core 0.2.1 → 0.2.3

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.
@@ -1,10 +1,10 @@
1
1
  // @bun
2
2
  import {
3
3
  exports_src
4
- } from "./index-hxymw48q.js";
4
+ } from "./index-4w8751xf.js";
5
5
  import {
6
6
  __require
7
- } from "./index-b9g14b8c.js";
7
+ } from "./index-hmk8xzt3.js";
8
8
 
9
9
  // src/runtime-plugin.ts
10
10
  import { existsSync, readFileSync, realpathSync } from "fs";
@@ -408,4 +408,4 @@ function createRuntimePlugin(input = {}) {
408
408
  export { isCoreRuntimeModuleSpecifier, runtimeModuleIdForSpecifier, createRuntimePlugin };
409
409
 
410
410
  //# debugId=5D58E30F1E057B9664756E2164756E21
411
- //# sourceMappingURL=index-htg1x5tj.js.map
411
+ //# sourceMappingURL=index-8csdw3z7.js.map
@@ -0,0 +1,44 @@
1
+ // @bun
2
+ import {
3
+ createRuntimePlugin
4
+ } from "./index-8csdw3z7.js";
5
+
6
+ // src/runtime-plugin-support-configure.ts
7
+ var {plugin: registerBunPlugin } = globalThis.Bun;
8
+ var runtimePluginSupportInstalledKey = "__opentuiCoreRuntimePluginSupportInstalled__";
9
+ function normalizeRewriteKey(rewrite) {
10
+ return `${rewrite?.nodeModulesRuntimeSpecifiers ?? true}:${rewrite?.nodeModulesBareSpecifiers ?? false}`;
11
+ }
12
+ function assertCompatibleInstall(install, options) {
13
+ for (const specifier of Object.keys(options.additional ?? {})) {
14
+ if (!install.additionalSpecifiers.has(specifier)) {
15
+ throw new Error(`OpenTUI Core runtime plugin support is already installed without ${specifier}. Call ensureRuntimePluginSupport({ additional }) from @opentui/core/runtime-plugin-support/configure before importing @opentui/core/runtime-plugin-support.`);
16
+ }
17
+ }
18
+ if (options.core && options.core !== install.core) {
19
+ throw new Error("OpenTUI Core runtime plugin support is already installed with a different core runtime module.");
20
+ }
21
+ if (options.rewrite && normalizeRewriteKey(options.rewrite) !== install.rewriteKey) {
22
+ throw new Error("OpenTUI Core runtime plugin support is already installed with different rewrite options.");
23
+ }
24
+ }
25
+ function ensureRuntimePluginSupport(options = {}) {
26
+ const state = globalThis;
27
+ const install = state[runtimePluginSupportInstalledKey];
28
+ if (install) {
29
+ assertCompatibleInstall(install, options);
30
+ return false;
31
+ }
32
+ registerBunPlugin(createRuntimePlugin(options));
33
+ state[runtimePluginSupportInstalledKey] = {
34
+ additionalSpecifiers: new Set(Object.keys(options.additional ?? {})),
35
+ core: options.core,
36
+ rewriteKey: normalizeRewriteKey(options.rewrite)
37
+ };
38
+ return true;
39
+ }
40
+
41
+ export { ensureRuntimePluginSupport };
42
+
43
+ //# debugId=09C0597CB92E654F64756E2164756E21
44
+ //# sourceMappingURL=index-gdtdtsgp.js.map
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/runtime-plugin-support-configure.ts"],
4
+ "sourcesContent": [
5
+ "import { plugin as registerBunPlugin } from \"bun\"\nimport { createRuntimePlugin, type CreateRuntimePluginOptions, type RuntimeModuleEntry } from \"./runtime-plugin.js\"\n\nconst runtimePluginSupportInstalledKey = \"__opentuiCoreRuntimePluginSupportInstalled__\"\n\ninterface RuntimePluginSupportInstall {\n additionalSpecifiers: ReadonlySet<string>\n core?: RuntimeModuleEntry\n rewriteKey: string\n}\n\ntype RuntimePluginSupportState = typeof globalThis & {\n [runtimePluginSupportInstalledKey]?: RuntimePluginSupportInstall\n}\n\nfunction normalizeRewriteKey(rewrite: CreateRuntimePluginOptions[\"rewrite\"] | undefined): string {\n return `${rewrite?.nodeModulesRuntimeSpecifiers ?? true}:${rewrite?.nodeModulesBareSpecifiers ?? false}`\n}\n\nfunction assertCompatibleInstall(install: RuntimePluginSupportInstall, options: CreateRuntimePluginOptions): void {\n for (const specifier of Object.keys(options.additional ?? {})) {\n if (!install.additionalSpecifiers.has(specifier)) {\n throw new Error(\n `OpenTUI Core runtime plugin support is already installed without ${specifier}. Call ensureRuntimePluginSupport({ additional }) from @opentui/core/runtime-plugin-support/configure before importing @opentui/core/runtime-plugin-support.`,\n )\n }\n }\n\n if (options.core && options.core !== install.core) {\n throw new Error(\"OpenTUI Core runtime plugin support is already installed with a different core runtime module.\")\n }\n\n if (options.rewrite && normalizeRewriteKey(options.rewrite) !== install.rewriteKey) {\n throw new Error(\"OpenTUI Core runtime plugin support is already installed with different rewrite options.\")\n }\n}\n\nexport function ensureRuntimePluginSupport(options: CreateRuntimePluginOptions = {}): boolean {\n const state = globalThis as RuntimePluginSupportState\n const install = state[runtimePluginSupportInstalledKey]\n\n if (install) {\n assertCompatibleInstall(install, options)\n return false\n }\n\n registerBunPlugin(createRuntimePlugin(options))\n\n state[runtimePluginSupportInstalledKey] = {\n additionalSpecifiers: new Set(Object.keys(options.additional ?? {})),\n core: options.core,\n rewriteKey: normalizeRewriteKey(options.rewrite),\n }\n return true\n}\n\nexport { createRuntimePlugin, runtimeModuleIdForSpecifier } from \"./runtime-plugin.js\"\nexport type {\n CreateRuntimePluginOptions,\n RuntimeModuleEntry,\n RuntimeModuleExports,\n RuntimeModuleLoader,\n} from \"./runtime-plugin.js\"\n"
6
+ ],
7
+ "mappings": ";;;;;;AAAA;AAGA,IAAM,mCAAmC;AAYzC,SAAS,mBAAmB,CAAC,SAAoE;AAAA,EAC/F,OAAO,GAAG,SAAS,gCAAgC,QAAQ,SAAS,6BAA6B;AAAA;AAGnG,SAAS,uBAAuB,CAAC,SAAsC,SAA2C;AAAA,EAChH,WAAW,aAAa,OAAO,KAAK,QAAQ,cAAc,CAAC,CAAC,GAAG;AAAA,IAC7D,IAAI,CAAC,QAAQ,qBAAqB,IAAI,SAAS,GAAG;AAAA,MAChD,MAAM,IAAI,MACR,oEAAoE,uKACtE;AAAA,IACF;AAAA,EACF;AAAA,EAEA,IAAI,QAAQ,QAAQ,QAAQ,SAAS,QAAQ,MAAM;AAAA,IACjD,MAAM,IAAI,MAAM,gGAAgG;AAAA,EAClH;AAAA,EAEA,IAAI,QAAQ,WAAW,oBAAoB,QAAQ,OAAO,MAAM,QAAQ,YAAY;AAAA,IAClF,MAAM,IAAI,MAAM,0FAA0F;AAAA,EAC5G;AAAA;AAGK,SAAS,0BAA0B,CAAC,UAAsC,CAAC,GAAY;AAAA,EAC5F,MAAM,QAAQ;AAAA,EACd,MAAM,UAAU,MAAM;AAAA,EAEtB,IAAI,SAAS;AAAA,IACX,wBAAwB,SAAS,OAAO;AAAA,IACxC,OAAO;AAAA,EACT;AAAA,EAEA,kBAAkB,oBAAoB,OAAO,CAAC;AAAA,EAE9C,MAAM,oCAAoC;AAAA,IACxC,sBAAsB,IAAI,IAAI,OAAO,KAAK,QAAQ,cAAc,CAAC,CAAC,CAAC;AAAA,IACnE,MAAM,QAAQ;AAAA,IACd,YAAY,oBAAoB,QAAQ,OAAO;AAAA,EACjD;AAAA,EACA,OAAO;AAAA;",
8
+ "debugId": "09C0597CB92E654F64756E2164756E21",
9
+ "names": []
10
+ }