From 103ba2c268ced3051d6f1a2bbee30432e77527de Mon Sep 17 00:00:00 2001 From: fz6m <59400654+fz6m@users.noreply.github.com> Date: Fri, 10 Nov 2023 16:15:31 +0800 Subject: [PATCH] test: add wasm example case --- example-wasm/.npmrc | 2 + example-wasm/index.js | 18 +++++ example-wasm/package.json | 17 ++++ example-wasm/pnpm-lock.yaml | 132 +++++++++++++++++++++++++++++++ example-wasm/pnpm-workspace.yaml | 2 + pnpm-workspace.yaml | 2 +- 6 files changed, 172 insertions(+), 1 deletion(-) create mode 100644 example-wasm/.npmrc create mode 100644 example-wasm/index.js create mode 100644 example-wasm/package.json create mode 100644 example-wasm/pnpm-lock.yaml create mode 100644 example-wasm/pnpm-workspace.yaml diff --git a/example-wasm/.npmrc b/example-wasm/.npmrc new file mode 100644 index 0000000..b281ec0 --- /dev/null +++ b/example-wasm/.npmrc @@ -0,0 +1,2 @@ +side-effects-cache=false +reporter=append-only diff --git a/example-wasm/index.js b/example-wasm/index.js new file mode 100644 index 0000000..065ab9e --- /dev/null +++ b/example-wasm/index.js @@ -0,0 +1,18 @@ +const assert = require('assert') +const { existsSync } = require('fs') +const { parseAsync } = require('rs-module-lexer') + +const r = async () => { + assert(existsSync(require.resolve('@xn-sakina/rml-wasm'))) + const result = await parseAsync({ + input: [ + { + filename: 'index.ts', + code: `import a from 'ss'`, + }, + ], + }) + console.log('result: ', result) +} + +r() diff --git a/example-wasm/package.json b/example-wasm/package.json new file mode 100644 index 0000000..d5f3283 --- /dev/null +++ b/example-wasm/package.json @@ -0,0 +1,17 @@ +{ + "name": "wasm-demo", + "version": "1.0.0", + "private": true, + "scripts": { + "test": "node ./index.js" + }, + "pnpm": { + "supportedArchitectures": { + "os": ["unknown"], + "cpu": ["x64"] + } + }, + "devDependencies": { + "rs-module-lexer": "^2.1.1" + } +} diff --git a/example-wasm/pnpm-lock.yaml b/example-wasm/pnpm-lock.yaml new file mode 100644 index 0000000..666879b --- /dev/null +++ b/example-wasm/pnpm-lock.yaml @@ -0,0 +1,132 @@ +lockfileVersion: '6.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +importers: + + .: + devDependencies: + rs-module-lexer: + specifier: ^2.1.1 + version: registry.npmjs.org/rs-module-lexer@2.1.1 + +packages: + + registry.npmjs.org/@xn-sakina/rml-darwin-arm64@2.1.1: + resolution: {integrity: sha512-Ljog63oD8+riz/3zLN0pAgvJSaFTpJY4KxrH+TJnfEbUoRb7ZhmGEpYGl5imi43/9yNkGyAoF41ysIHxg0yEAw==, registry: https://registry.npmjs.com/, tarball: https://registry.npmjs.org/@xn-sakina/rml-darwin-arm64/-/rml-darwin-arm64-2.1.1.tgz} + name: '@xn-sakina/rml-darwin-arm64' + version: 2.1.1 + engines: {node: '>=14'} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + registry.npmjs.org/@xn-sakina/rml-darwin-x64@2.1.1: + resolution: {integrity: sha512-uLeZKZFiygZntppOjbfGzU3YsFmx4joW/6UlKfCKwelrTrtKa3bYMz55NuFc2RW7IuuNrGEILwz+ZPUdfv3ykA==, registry: https://registry.npmjs.com/, tarball: https://registry.npmjs.org/@xn-sakina/rml-darwin-x64/-/rml-darwin-x64-2.1.1.tgz} + name: '@xn-sakina/rml-darwin-x64' + version: 2.1.1 + engines: {node: '>=14'} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + registry.npmjs.org/@xn-sakina/rml-linux-arm-gnueabihf@2.1.1: + resolution: {integrity: sha512-Ou/h5ma/jsbgcWS//BdRh4bb/5RFRjebc1Yrlm6iyqSRNJqnY58hEl8pc9feOSkrjorvc8aAe5CWZPf7sZrzrA==, registry: https://registry.npmjs.com/, tarball: https://registry.npmjs.org/@xn-sakina/rml-linux-arm-gnueabihf/-/rml-linux-arm-gnueabihf-2.1.1.tgz} + name: '@xn-sakina/rml-linux-arm-gnueabihf' + version: 2.1.1 + engines: {node: '>=14'} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + + registry.npmjs.org/@xn-sakina/rml-linux-arm64-gnu@2.1.1: + resolution: {integrity: sha512-hmNtRDxxNc9LVEr/tlzgHOG2wKM0w1rPdIu2zvIVpVi8JUFcenEcHGLrezFlQg8NK/BMQiAmMmMpxhB9Mr4wpA==, registry: https://registry.npmjs.com/, tarball: https://registry.npmjs.org/@xn-sakina/rml-linux-arm64-gnu/-/rml-linux-arm64-gnu-2.1.1.tgz} + name: '@xn-sakina/rml-linux-arm64-gnu' + version: 2.1.1 + engines: {node: '>=14'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + registry.npmjs.org/@xn-sakina/rml-linux-arm64-musl@2.1.1: + resolution: {integrity: sha512-sYY5m7fK1VhLodt4IDB+XSTmvu2g0D5VbT30RpBhXlL3CI37fgLyNvO+NSn9J6b4xrGqzdkIv677JfkhM9hHGw==, registry: https://registry.npmjs.com/, tarball: https://registry.npmjs.org/@xn-sakina/rml-linux-arm64-musl/-/rml-linux-arm64-musl-2.1.1.tgz} + name: '@xn-sakina/rml-linux-arm64-musl' + version: 2.1.1 + engines: {node: '>=14'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + registry.npmjs.org/@xn-sakina/rml-linux-x64-gnu@2.1.1: + resolution: {integrity: sha512-n9Q6DOUgc6U05YqgnwKmpMdrKk3K4JtUpB6Wee3kyxrQr1FKT6E5FXqzzO2q62AxXqWsc1WVNE6IWldURUI2Bg==, registry: https://registry.npmjs.com/, tarball: https://registry.npmjs.org/@xn-sakina/rml-linux-x64-gnu/-/rml-linux-x64-gnu-2.1.1.tgz} + name: '@xn-sakina/rml-linux-x64-gnu' + version: 2.1.1 + engines: {node: '>=14'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + registry.npmjs.org/@xn-sakina/rml-linux-x64-musl@2.1.1: + resolution: {integrity: sha512-4qq3jw6jqrL0L1A3Q1zIIl1392uamXycb6gws+RsWnNnaogVHa/QD47w9xTsVRVYqEfsroV+84OOvNSpaoBrQQ==, registry: https://registry.npmjs.com/, tarball: https://registry.npmjs.org/@xn-sakina/rml-linux-x64-musl/-/rml-linux-x64-musl-2.1.1.tgz} + name: '@xn-sakina/rml-linux-x64-musl' + version: 2.1.1 + engines: {node: '>=14'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + registry.npmjs.org/@xn-sakina/rml-win32-arm64-msvc@2.1.1: + resolution: {integrity: sha512-QnsttcVOMvetJ0xZOsUSZ38hpAbydDGl4MwY4yGvKK0/6XbirKEq/bn3Zl9ABLX3elLaE/pghGSlxB9fsk70Qw==, registry: https://registry.npmjs.com/, tarball: https://registry.npmjs.org/@xn-sakina/rml-win32-arm64-msvc/-/rml-win32-arm64-msvc-2.1.1.tgz} + name: '@xn-sakina/rml-win32-arm64-msvc' + version: 2.1.1 + engines: {node: '>=14'} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + registry.npmjs.org/@xn-sakina/rml-win32-x64-msvc@2.1.1: + resolution: {integrity: sha512-AnNynVvyfp3mBUA0fQFqBth13pFcRjOhCDieF73UYYH3xDc/mowtjDO+kUWW9EtZH94CPDkT1Ei9WWESruOg6w==, registry: https://registry.npmjs.com/, tarball: https://registry.npmjs.org/@xn-sakina/rml-win32-x64-msvc/-/rml-win32-x64-msvc-2.1.1.tgz} + name: '@xn-sakina/rml-win32-x64-msvc' + version: 2.1.1 + engines: {node: '>=14'} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + registry.npmjs.org/rs-module-lexer@2.1.1: + resolution: {integrity: sha512-6F5a6PS3PJ/qZ0o+FKFcqABFBVsaMIOEMA4yBFyAwJnCpQ6a8CIk+ln3pRPrl0N2k6HgAupzXpQq4NuTVg5haQ==, registry: https://registry.npmjs.com/, tarball: https://registry.npmjs.org/rs-module-lexer/-/rs-module-lexer-2.1.1.tgz} + name: rs-module-lexer + version: 2.1.1 + engines: {node: '>=14'} + requiresBuild: true + optionalDependencies: + '@xn-sakina/rml-darwin-arm64': registry.npmjs.org/@xn-sakina/rml-darwin-arm64@2.1.1 + '@xn-sakina/rml-darwin-x64': registry.npmjs.org/@xn-sakina/rml-darwin-x64@2.1.1 + '@xn-sakina/rml-linux-arm-gnueabihf': registry.npmjs.org/@xn-sakina/rml-linux-arm-gnueabihf@2.1.1 + '@xn-sakina/rml-linux-arm64-gnu': registry.npmjs.org/@xn-sakina/rml-linux-arm64-gnu@2.1.1 + '@xn-sakina/rml-linux-arm64-musl': registry.npmjs.org/@xn-sakina/rml-linux-arm64-musl@2.1.1 + '@xn-sakina/rml-linux-x64-gnu': registry.npmjs.org/@xn-sakina/rml-linux-x64-gnu@2.1.1 + '@xn-sakina/rml-linux-x64-musl': registry.npmjs.org/@xn-sakina/rml-linux-x64-musl@2.1.1 + '@xn-sakina/rml-win32-arm64-msvc': registry.npmjs.org/@xn-sakina/rml-win32-arm64-msvc@2.1.1 + '@xn-sakina/rml-win32-x64-msvc': registry.npmjs.org/@xn-sakina/rml-win32-x64-msvc@2.1.1 + dev: true diff --git a/example-wasm/pnpm-workspace.yaml b/example-wasm/pnpm-workspace.yaml new file mode 100644 index 0000000..f490a2c --- /dev/null +++ b/example-wasm/pnpm-workspace.yaml @@ -0,0 +1,2 @@ +packages: + - ./ \ No newline at end of file diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index a289927..970a0b2 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,3 +1,3 @@ packages: - ./ - - ./example + - ./example \ No newline at end of file