@venkateshcv1809/prosetta-sdk 0.0.0-stage → 0.4.0
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/LICENSE +21 -0
- package/README.md +38 -2
- package/dist/npm/index.cjs +1 -0
- package/dist/npm/index.d.cts +2 -0
- package/dist/npm/index.d.mts +2 -0
- package/dist/npm/index.mjs +1 -0
- package/dist/prosetta-sdk.js +1 -0
- package/package.json +49 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 VENKATESH C V
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,39 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Prosetta SDK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The JavaScript SDK wrapper for the Polyglot Rosetta project. The SDK will
|
|
4
|
+
eventually prepare the assets needed by the WebAssembly runtime. This starter
|
|
5
|
+
package currently exposes only `init()`.
|
|
6
|
+
|
|
7
|
+
## Local development
|
|
8
|
+
|
|
9
|
+
Install [mise](https://mise.jdx.dev/) and [just](https://just.systems/), then
|
|
10
|
+
activate the project tools and install dependencies:
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
mise trust
|
|
14
|
+
mise install
|
|
15
|
+
just install
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
mise enables Corepack when it installs Node 24 and installs the Yarn version
|
|
19
|
+
pinned by the `packageManager` field in `package.json`.
|
|
20
|
+
|
|
21
|
+
Run the available commands with `just` or the matching Yarn scripts:
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
just build
|
|
25
|
+
just check
|
|
26
|
+
just clean
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
```js
|
|
32
|
+
import { init } from 'prosetta-sdk';
|
|
33
|
+
|
|
34
|
+
init();
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The tsdown build produces one UMD bundle at `dist/prosetta-sdk.js` for browser
|
|
38
|
+
script loading, CommonJS `require()`, and ES module imports. TypeScript emits
|
|
39
|
+
the package declarations alongside the bundle.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=`PROSETTA_WASM_PATH`,t={[e]:void 0};function n(){let e=globalThis.process,n=typeof __PROSETTA_CONFIG__>`u`?t:__PROSETTA_CONFIG__;return Object.fromEntries(Object.keys(t).map(t=>[t,n[t]||e?.env[t]]))}const r=`Set ${e} to a local prosetta.wasm path or an HTTP(S) URL.`;let i,a,o=0;function s(){if(i)return Promise.resolve(i);if(a)return a;let e=o,t=l();return a=t,t.then(t=>(e===o&&(i=t),t)).finally(()=>{e===o&&(a=void 0)})}function c(){o+=1,i=void 0,a=void 0}async function l(){let{PROSETTA_WASM_PATH:e}=n();if(!e)throw Error(r);if(u(e)){let t=await fetch(e);if(!t.ok)throw Error(`Failed to download WASM from ${e}: ${t.status} ${t.statusText}`);return WebAssembly.compile(await t.arrayBuffer())}let t=globalThis.process?.getBuiltinModule?.(`fs`);if(!t)throw Error(`Loading a local WASM file requires Node.js with process.getBuiltinModule().`);let i=await t.promises.readFile(e);return WebAssembly.compile(i)}function u(e){return/^https?:\/\//i.test(e)}function d(){return s()}function f(){c()}exports.init=d,exports.shutdown=f;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=`PROSETTA_WASM_PATH`,t={[e]:void 0};function n(){let e=globalThis.process,n=typeof __PROSETTA_CONFIG__>`u`?t:__PROSETTA_CONFIG__;return Object.fromEntries(Object.keys(t).map(t=>[t,n[t]||e?.env[t]]))}const r=`Set ${e} to a local prosetta.wasm path or an HTTP(S) URL.`;let i,a,o=0;function s(){if(i)return Promise.resolve(i);if(a)return a;let e=o,t=l();return a=t,t.then(t=>(e===o&&(i=t),t)).finally(()=>{e===o&&(a=void 0)})}function c(){o+=1,i=void 0,a=void 0}async function l(){let{PROSETTA_WASM_PATH:e}=n();if(!e)throw Error(r);if(u(e)){let t=await fetch(e);if(!t.ok)throw Error(`Failed to download WASM from ${e}: ${t.status} ${t.statusText}`);return WebAssembly.compile(await t.arrayBuffer())}let t=globalThis.process?.getBuiltinModule?.(`fs`);if(!t)throw Error(`Loading a local WASM file requires Node.js with process.getBuiltinModule().`);let i=await t.promises.readFile(e);return WebAssembly.compile(i)}function u(e){return/^https?:\/\//i.test(e)}function d(){return s()}function f(){c()}export{d as init,f as shutdown};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var ProsettaSDK=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});let t=`PROSETTA_WASM_PATH`,n={[t]:void 0};function r(){let e=globalThis.process,t={PROSETTA_WASM_PATH:`https://github.com/venkateshcv1809/polyglot-rosetta/releases/latest/download/prosetta.wasm`};return Object.fromEntries(Object.keys(n).map(n=>[n,t[n]||e?.env[n]]))}let i=`Set ${t} to a local prosetta.wasm path or an HTTP(S) URL.`,a,o,s=0;function c(){if(a)return Promise.resolve(a);if(o)return o;let e=s,t=u();return o=t,t.then(t=>(e===s&&(a=t),t)).finally(()=>{e===s&&(o=void 0)})}function l(){s+=1,a=void 0,o=void 0}async function u(){let{PROSETTA_WASM_PATH:e}=r();if(!e)throw Error(i);if(d(e)){let t=await fetch(e);if(!t.ok)throw Error(`Failed to download WASM from ${e}: ${t.status} ${t.statusText}`);return WebAssembly.compile(await t.arrayBuffer())}let t=globalThis.process?.getBuiltinModule?.(`fs`);if(!t)throw Error(`Loading a local WASM file requires Node.js with process.getBuiltinModule().`);let n=await t.promises.readFile(e);return WebAssembly.compile(n)}function d(e){return/^https?:\/\//i.test(e)}function f(){return c()}function p(){l()}return e.init=f,e.shutdown=p,e})({});
|
package/package.json
CHANGED
|
@@ -1,6 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@venkateshcv1809/prosetta-sdk",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "JavaScript SDK wrapper for the Polyglot Rosetta WebAssembly runtime.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/venkateshcv1809/polyglot-rosetta-sdk.git"
|
|
9
|
+
},
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"access": "public"
|
|
12
|
+
},
|
|
13
|
+
"type": "commonjs",
|
|
14
|
+
"main": "./dist/npm/index.cjs",
|
|
15
|
+
"module": "./dist/npm/index.mjs",
|
|
16
|
+
"types": "./dist/npm/index.d.mts",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/npm/index.d.mts",
|
|
20
|
+
"import": {
|
|
21
|
+
"types": "./dist/npm/index.d.mts",
|
|
22
|
+
"default": "./dist/npm/index.mjs"
|
|
23
|
+
},
|
|
24
|
+
"require": {
|
|
25
|
+
"types": "./dist/npm/index.d.cts",
|
|
26
|
+
"default": "./dist/npm/index.cjs"
|
|
27
|
+
},
|
|
28
|
+
"default": "./dist/npm/index.mjs"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist/npm",
|
|
33
|
+
"dist/prosetta-sdk.js",
|
|
34
|
+
"dist/prosetta-sdk.js.map",
|
|
35
|
+
"LICENSE",
|
|
36
|
+
"README.md"
|
|
37
|
+
],
|
|
38
|
+
"sideEffects": false,
|
|
39
|
+
"packageManager": "yarn@4.18.1",
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "yarn build:dev",
|
|
42
|
+
"build:dev": "mise exec -- yarn clean && mise exec -- tsdown",
|
|
43
|
+
"build:prod": "mise exec -- yarn clean && mise exec -- tsdown --config tsdown.prod.config.mts && npm pack --cache ./.cache/npm --pack-destination dist && node -e \"require('node:fs').rmSync('dist/npm', { recursive: true, force: true })\"",
|
|
44
|
+
"clean": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"",
|
|
45
|
+
"check": "tsc --noEmit --project tsconfig.json"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"tsdown": "^0.23.5",
|
|
49
|
+
"typescript": "^5.9.3"
|
|
50
|
+
}
|
|
51
|
+
}
|