@unyt/datex 0.0.1
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.
- package/README.md +28 -0
- package/esm/_dnt.shims.d.ts +29 -0
- package/esm/_dnt.shims.d.ts.map +1 -0
- package/esm/_dnt.shims.js +87 -0
- package/esm/_dnt.test_shims.d.ts.map +1 -0
- package/esm/deno.json +24 -0
- package/esm/deps/jsr.io/@std/assert/1.0.6/almost_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.6/array_includes.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.6/assert.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.6/assertion_error.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.6/equal.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.6/equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.6/exists.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.6/fail.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.6/false.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.6/greater.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.6/greater_or_equal.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.6/instance_of.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.6/is_error.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.6/less.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.6/less_or_equal.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.6/match.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.6/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.6/not_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.6/not_instance_of.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.6/not_match.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.6/not_strict_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.6/object_match.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.6/rejects.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.6/strict_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.6/string_includes.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.6/throws.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.6/unimplemented.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.6/unreachable.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/build_message.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/diff.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/diff_str.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/format.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/styles.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.5/types.d.ts.map +1 -0
- package/esm/package.json +3 -0
- package/esm/rs-lib/datex-core/Cargo.toml +34 -0
- package/esm/src/datex-core/datex_core_js.generated.d.ts +78 -0
- package/esm/src/datex-core/datex_core_js.generated.d.ts.map +1 -0
- package/esm/src/datex-core/datex_core_js.generated.js +611 -0
- package/esm/src/datex-core/datex_core_js_bg.wasm +0 -0
- package/esm/src/datex-core.d.ts +2 -0
- package/esm/src/datex-core.d.ts.map +1 -0
- package/esm/src/datex-core.js +3 -0
- package/esm/src/mod.d.ts +11 -0
- package/esm/src/mod.d.ts.map +1 -0
- package/esm/src/mod.js +10 -0
- package/esm/src/runtime/runtime.d.ts +16 -0
- package/esm/src/runtime/runtime.d.ts.map +1 -0
- package/esm/src/runtime/runtime.js +49 -0
- package/esm/src/utils/js-runtime-compat/js-runtime-interface.d.ts +7 -0
- package/esm/src/utils/js-runtime-compat/js-runtime-interface.d.ts.map +1 -0
- package/esm/src/utils/js-runtime-compat/js-runtime-interface.js +1 -0
- package/esm/src/utils/js-runtime-compat/runtime.d.ts +3 -0
- package/esm/src/utils/js-runtime-compat/runtime.d.ts.map +1 -0
- package/esm/src/utils/js-runtime-compat/runtime.js +34 -0
- package/esm/src/utils/js-runtime-compat/runtimes/browser.d.ts +7 -0
- package/esm/src/utils/js-runtime-compat/runtimes/browser.d.ts.map +1 -0
- package/esm/src/utils/js-runtime-compat/runtimes/browser.js +20 -0
- package/esm/src/utils/js-runtime-compat/runtimes/deno.d.ts +7 -0
- package/esm/src/utils/js-runtime-compat/runtimes/deno.d.ts.map +1 -0
- package/esm/src/utils/js-runtime-compat/runtimes/deno.js +17 -0
- package/esm/test/init.test.d.ts.map +1 -0
- package/package.json +36 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
+
};
|
|
6
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
7
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
10
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
|
+
};
|
|
12
|
+
var _Runtime_runtime, _Runtime_memory;
|
|
13
|
+
import { init_runtime } from "../datex-core.js";
|
|
14
|
+
import { runtimeInterface } from "../utils/js-runtime-compat/runtime.js";
|
|
15
|
+
// get version from deno.json
|
|
16
|
+
const VERSION = await runtimeInterface
|
|
17
|
+
.readTextFile(new URL("../../deno.json", import.meta.url))
|
|
18
|
+
.then(JSON.parse)
|
|
19
|
+
.then((data) => data.version);
|
|
20
|
+
export class Runtime {
|
|
21
|
+
/**
|
|
22
|
+
* properties from #runtime
|
|
23
|
+
*/
|
|
24
|
+
get version() {
|
|
25
|
+
return __classPrivateFieldGet(this, _Runtime_runtime, "f").version;
|
|
26
|
+
}
|
|
27
|
+
get memory() {
|
|
28
|
+
return __classPrivateFieldGet(this, _Runtime_memory, "f");
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* @internal only used for debugging
|
|
32
|
+
*/
|
|
33
|
+
get _runtime() {
|
|
34
|
+
return __classPrivateFieldGet(this, _Runtime_runtime, "f");
|
|
35
|
+
}
|
|
36
|
+
constructor() {
|
|
37
|
+
Object.defineProperty(this, "js_version", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
configurable: true,
|
|
40
|
+
writable: true,
|
|
41
|
+
value: VERSION
|
|
42
|
+
});
|
|
43
|
+
_Runtime_runtime.set(this, void 0);
|
|
44
|
+
_Runtime_memory.set(this, void 0);
|
|
45
|
+
__classPrivateFieldSet(this, _Runtime_runtime, init_runtime(), "f");
|
|
46
|
+
__classPrivateFieldSet(this, _Runtime_memory, __classPrivateFieldGet(this, _Runtime_runtime, "f").memory, "f");
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
_Runtime_runtime = new WeakMap(), _Runtime_memory = new WeakMap();
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type JSRuntimeType = "deno" | "node" | "bun" | "browser";
|
|
2
|
+
export interface JsRuntimeInterface {
|
|
3
|
+
type: JSRuntimeType;
|
|
4
|
+
readTextFile(path: string | URL): Promise<string>;
|
|
5
|
+
readFile(path: string | URL): Promise<Uint8Array>;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=js-runtime-interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"js-runtime-interface.d.ts","sourceRoot":"","sources":["../../../../src/src/utils/js-runtime-compat/js-runtime-interface.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,SAAS,CAAC;AAEhE,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,aAAa,CAAC;IACpB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAClD,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CACrD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/src/utils/js-runtime-compat/runtime.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACR,kBAAkB,EAErB,MAAM,2BAA2B,CAAC;AAgCnC,eAAO,MAAM,gBAAgB,EAAE,kBAE9B,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module runtime
|
|
3
|
+
* @description
|
|
4
|
+
* The runtime module provides a runtimeInterface object that contains common
|
|
5
|
+
* runtime-specific functions for reading files, etc.
|
|
6
|
+
* It automatically detects the runtime environment and provides the correct
|
|
7
|
+
* runtime interface.
|
|
8
|
+
* Supported runtimes are:
|
|
9
|
+
* - Deno
|
|
10
|
+
* - Node.js
|
|
11
|
+
* - Bun
|
|
12
|
+
* - Browser
|
|
13
|
+
*/
|
|
14
|
+
import * as dntShim from "../../../_dnt.shims.js";
|
|
15
|
+
function detectRuntime() {
|
|
16
|
+
const global = dntShim.dntGlobalThis;
|
|
17
|
+
if (global.Deno && !global.Deno.isPolyfill) {
|
|
18
|
+
return "deno";
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
return "browser";
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
async function getRuntimeInterface(type) {
|
|
25
|
+
if (type === "deno" || type === "node" || type === "bun") {
|
|
26
|
+
const { DenoRuntimeInterface } = await import("./runtimes/deno.js");
|
|
27
|
+
return new DenoRuntimeInterface();
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
const { BrowserRuntimeInterface } = await import("./runtimes/browser.js");
|
|
31
|
+
return new BrowserRuntimeInterface();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export const runtimeInterface = await getRuntimeInterface(detectRuntime());
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { JsRuntimeInterface } from "../js-runtime-interface.js";
|
|
2
|
+
export declare class BrowserRuntimeInterface implements JsRuntimeInterface {
|
|
3
|
+
readonly type = "browser";
|
|
4
|
+
readTextFile(path: string | URL): Promise<string>;
|
|
5
|
+
readFile(path: string | URL): Promise<Uint8Array>;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../../../../../src/src/utils/js-runtime-compat/runtimes/browser.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAErE,qBAAa,uBAAwB,YAAW,kBAAkB;IAC9D,QAAQ,CAAC,IAAI,aAAa;IAEpB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC;IAKjD,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC;CAK1D"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as dntShim from "../../../../_dnt.shims.js";
|
|
2
|
+
export class BrowserRuntimeInterface {
|
|
3
|
+
constructor() {
|
|
4
|
+
Object.defineProperty(this, "type", {
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true,
|
|
8
|
+
value: "browser"
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
async readTextFile(path) {
|
|
12
|
+
const response = await dntShim.fetch(path.toString());
|
|
13
|
+
return await response.text();
|
|
14
|
+
}
|
|
15
|
+
async readFile(path) {
|
|
16
|
+
const response = await dntShim.fetch(path.toString());
|
|
17
|
+
const buffer = await response.arrayBuffer();
|
|
18
|
+
return new Uint8Array(buffer);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { JsRuntimeInterface } from "../js-runtime-interface.js";
|
|
2
|
+
export declare class DenoRuntimeInterface implements JsRuntimeInterface {
|
|
3
|
+
readonly type = "deno";
|
|
4
|
+
readTextFile(path: string | URL): Promise<string>;
|
|
5
|
+
readFile(path: string | URL): Promise<Uint8Array>;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=deno.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deno.d.ts","sourceRoot":"","sources":["../../../../../src/src/utils/js-runtime-compat/runtimes/deno.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAErE,qBAAa,oBAAqB,YAAW,kBAAkB;IAC3D,QAAQ,CAAC,IAAI,UAAU;IAEvB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC;IAIjD,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC;CAGpD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as dntShim from "../../../../_dnt.shims.js";
|
|
2
|
+
export class DenoRuntimeInterface {
|
|
3
|
+
constructor() {
|
|
4
|
+
Object.defineProperty(this, "type", {
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true,
|
|
8
|
+
value: "deno"
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
readTextFile(path) {
|
|
12
|
+
return dntShim.Deno.readTextFile(path);
|
|
13
|
+
}
|
|
14
|
+
readFile(path) {
|
|
15
|
+
return dntShim.Deno.readFile(path);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.test.d.ts","sourceRoot":"","sources":["../../src/test/init.test.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@unyt/datex",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "git+https://github.com/unyt-org/datex-core-js.git"
|
|
7
|
+
},
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"bugs": {
|
|
10
|
+
"url": "https://github.com/unyt-org/datex-core-js/issues"
|
|
11
|
+
},
|
|
12
|
+
"module": "./esm/src/mod.js",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"import": "./esm/src/mod.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"test": "node test_runner.js"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@deno/shim-deno": "~0.18.0",
|
|
23
|
+
"@deno/shim-crypto": "~0.3.1",
|
|
24
|
+
"@deno/shim-prompts": "~0.1.0",
|
|
25
|
+
"@deno/shim-timers": "~0.1.0",
|
|
26
|
+
"undici": "^6.0.0",
|
|
27
|
+
"@deno/sham-weakref": "~0.1.0",
|
|
28
|
+
"ws": "^8.13.0"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@types/node": "^20.9.0",
|
|
32
|
+
"picocolors": "^1.0.0",
|
|
33
|
+
"@types/ws": "^8.5.4"
|
|
34
|
+
},
|
|
35
|
+
"_generatedBy": "dnt@dev"
|
|
36
|
+
}
|