diff --git a/.gitattributes b/.gitattributes index 009a9c7..3fab650 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1 @@ -lib/deno.ns.lib.d.ts linguist-generated=true +packages/deno.ns/lib/deno.ns.lib.d.ts linguist-generated=true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 503a4f4..80c6bfe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: - uses: actions/checkout@v2 with: submodules: true - - run: (cd thirdparty/deno; git submodule update --init --depth=1 test_util/std) + - run: (cd packages/deno.ns/third_party/deno; git submodule update --init --depth=1 test_util/std) shell: bash - uses: actions/setup-node@v2 with: @@ -33,14 +33,14 @@ jobs: - run: deno fmt --config deno.json --check if: matrix.os == 'ubuntu-latest' - run: npm ci --ignore-scripts - - run: npm run --silent test - - run: npm run --silent prepare - - run: tools/missing.ts || echo "Some items are missing" + - run: npm run --silent test --workspaces + - run: npm run --silent prepare --workspaces + - run: cd packages/deno.ns && tools/missing.ts || echo "Some items are missing" if: matrix.os == 'ubuntu-latest' - - run: tools/untested.sh + - run: cd packages/deno.ns && tools/untested.sh if: matrix.os == 'ubuntu-latest' - name: npm publish if: matrix.os == 'ubuntu-latest' && startsWith(github.ref, 'refs/tags/') && github.repository == 'denoland/deno.ns' env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - run: npm publish + run: cd packages/deno.ns && npm publish diff --git a/.gitignore b/.gitignore index ad931d5..1fc5dc8 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,3 @@ node_modules dist lib.deno.d.ts lib.deno.unstable.d.ts -unit diff --git a/.gitmodules b/.gitmodules index 53c0190..e35ab19 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "thirdparty/deno"] - path = thirdparty/deno +[submodule "packages/deno.ns/third_party/deno"] + path = packages/deno.ns/third_party/deno url = https://github.com/denoland/deno diff --git a/.vscode/project.code-workspace b/.vscode/project.code-workspace index 2afc987..e5615b1 100644 --- a/.vscode/project.code-workspace +++ b/.vscode/project.code-workspace @@ -5,16 +5,16 @@ "path": "../" }, { - "name": "src", - "path": "../src/" + "name": "deno.ns", + "path": "../packages/deno.ns/src/" }, { - "name": "tools", - "path": "../tools" + "name": "deno.ns-tools", + "path": "../packages/deno.ns/tools" }, { - "name": "thirdparty", - "path": "../thirdparty" + "name": "third_party", + "path": "../packages/deno.ns/third_party" } ], "settings": { @@ -24,9 +24,9 @@ "**/.hg": true, "**/CVS": true, "**/.DS_Store": true, - "src/": true, - "tools/": true, - "thirdparty/": true + "packages/deno.ns/src/": true, + "packages/deno.ns/tools/": true, + "packages/deno.ns/third_party/": true } } } \ No newline at end of file diff --git a/README.md b/README.md index 7cea48e..ebcd227 100644 --- a/README.md +++ b/README.md @@ -1,47 +1,7 @@ # `deno.ns` -[`Deno` namespace](https://doc.deno.land/builtin/stable) shim for Node.js. +Deno shims for Node.js -See [PROGRESS.md](PROGRESS.md) +## Packages -## Usage - -```js -const { - alert, - Blob, - confirm, - crypto, - Deno, - fetch, - File, - FormData, - Headers, - prompt, - Request, - Response, -} = require("deno.ns"); -``` - -or `node --require=deno.ns/global `, - -or https://github.com/wojpawlik/deno2node#shimming. - -## Contributing - -Right now, you can help by [enabling a test file](tools/working_test_files.txt), -making tests pass, and [skipping unsatisfiable tests](tools/skip_tests.cjs). - -Please set up [pre-commit hook](tools/hooks/pre-commit): - -```sh -$ git config core.hooksPath tools/hooks -``` - -## Acknowledgements - -Special thanks to the [@fromdeno](https://github.com/fromdeno) organization for -starting this project and for their contributions—specifically -[@wojpawlik](https://github.com/wojpawlik), -[@MKRhere](https://github.com/MKRhere), and -[@trgwii](https://github.com/trgwii). +- [deno.ns](packages/deno.ns) - Deno namespace shim. diff --git a/deno.json b/deno.json index 0b0a3ae..5156f8d 100644 --- a/deno.json +++ b/deno.json @@ -3,12 +3,12 @@ "files": { "exclude": [ "node_modules", - "dist", - "thirdparty", - "unit", - "src/deno/stable/lib.deno.d.ts", - "src/deno/unstable/lib.deno.unstable.d.ts", - "lib" + "packages/deno.ns/node_modules", + "packages/deno.ns/dist", + "packages/deno.ns/src/deno/stable/lib.deno.d.ts", + "packages/deno.ns/src/deno/unstable/lib.deno.unstable.d.ts", + "packages/deno.ns/lib", + "packages/deno.ns/third_party" ] }, "rules": { @@ -19,12 +19,12 @@ "files": { "exclude": [ "node_modules", - "dist", - "thirdparty", - "unit", - "src/deno/stable/lib.deno.d.ts", - "src/deno/unstable/lib.deno.unstable.d.ts", - "lib" + "packages/deno.ns/node_modules", + "packages/deno.ns/dist", + "packages/deno.ns/src/deno/stable/lib.deno.d.ts", + "packages/deno.ns/src/deno/unstable/lib.deno.unstable.d.ts", + "packages/deno.ns/lib", + "packages/deno.ns/third_party" ] } } diff --git a/package-lock.json b/package-lock.json index b532ee0..277b7d4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,26 +1,13 @@ { - "name": "deno.ns", - "version": "0.8.0", + "name": "deno.ns-workspace", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "deno.ns", - "version": "0.8.0", - "license": "MIT", - "dependencies": { - "undici": "^4.5.1", - "which": "^2.0.2" - }, - "devDependencies": { - "@types/node": "^16.4.13", - "@types/which": "^2.0.1", - "ts-node": "^10.4.0", - "typescript": "^4.5.2" - }, - "engines": { - "node": ">=16.7.0" - } + "name": "deno.ns-workspace", + "workspaces": [ + "packages/deno.ns" + ] }, "node_modules/@cspotcode/source-map-consumer": { "version": "0.8.0", @@ -68,9 +55,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "16.11.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.6.tgz", - "integrity": "sha512-ua7PgUoeQFjmWPcoo9khiPum3Pd60k4/2ZGXt18sm2Slk0W0xZTqt5Y0Ny1NyBiN1EVQ/+FaF9NcY4Qe6rwk5w==", + "version": "16.11.15", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.15.tgz", + "integrity": "sha512-LMGR7iUjwZRxoYnfc9+YELxwqkaLmkJlo4/HUvOMyGvw9DaHO0gtAbH2FUdoFE6PXBTYZIT7x610r7kdo8o1fQ==", "dev": true }, "node_modules/@types/which": { @@ -80,9 +67,9 @@ "dev": true }, "node_modules/acorn": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.5.0.tgz", - "integrity": "sha512-yXbYeFy+jUuYd3/CDcg2NkIYE991XYX/bje7LmjJigUciaeO1JR4XxXgCIV1/Zc/dRuFEyw1L0pbA+qynJkW5Q==", + "version": "8.6.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.6.0.tgz", + "integrity": "sha512-U1riIR+lBSNi3IbxtaHOIKdH8sLFv3NYfNv8sg7ZsNhcfl4HF2++BfqqrNAxoCLQW1iiylOj76ecnaUxz+z9yw==", "dev": true, "bin": { "acorn": "bin/acorn" @@ -112,6 +99,10 @@ "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", "dev": true }, + "node_modules/deno.ns": { + "resolved": "packages/deno.ns", + "link": true + }, "node_modules/diff": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", @@ -174,9 +165,9 @@ } }, "node_modules/typescript": { - "version": "4.5.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.2.tgz", - "integrity": "sha512-5BlMof9H1yGt0P8/WF+wPNw6GfctgGjXp5hkblpyT+8rkASSmkUKMXrxR0Xg8ThVCi/JnHQiKXeBaEwCeQwMFw==", + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.4.tgz", + "integrity": "sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -187,9 +178,9 @@ } }, "node_modules/undici": { - "version": "4.8.1", - "resolved": "https://registry.npmjs.org/undici/-/undici-4.8.1.tgz", - "integrity": "sha512-0HYfUmepa5euTv3ewj9OqJDiBrZrBEr4o8HPdNHeWOsPCLLXZSBVovW+D3D1LoFeGXhe5Bm2V/e7YJatUjeWfQ==", + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/undici/-/undici-4.12.1.tgz", + "integrity": "sha512-MSfap7YiQJqTPP12C11PFRs9raZuVicDbwsZHTjB0a8+SsCqt7KdUis54f373yf7ZFhJzAkGJLaKm0202OIxHg==", "engines": { "node": ">=12.18" } @@ -216,6 +207,23 @@ "engines": { "node": ">=6" } + }, + "packages/deno.ns": { + "version": "0.8.0", + "license": "MIT", + "dependencies": { + "undici": "^4.5.1", + "which": "^2.0.2" + }, + "devDependencies": { + "@types/node": "^16.4.13", + "@types/which": "^2.0.1", + "ts-node": "^10.4.0", + "typescript": "^4.5.2" + }, + "engines": { + "node": ">=16.7.0" + } } }, "dependencies": { @@ -259,9 +267,9 @@ "dev": true }, "@types/node": { - "version": "16.11.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.6.tgz", - "integrity": "sha512-ua7PgUoeQFjmWPcoo9khiPum3Pd60k4/2ZGXt18sm2Slk0W0xZTqt5Y0Ny1NyBiN1EVQ/+FaF9NcY4Qe6rwk5w==", + "version": "16.11.15", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.15.tgz", + "integrity": "sha512-LMGR7iUjwZRxoYnfc9+YELxwqkaLmkJlo4/HUvOMyGvw9DaHO0gtAbH2FUdoFE6PXBTYZIT7x610r7kdo8o1fQ==", "dev": true }, "@types/which": { @@ -271,9 +279,9 @@ "dev": true }, "acorn": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.5.0.tgz", - "integrity": "sha512-yXbYeFy+jUuYd3/CDcg2NkIYE991XYX/bje7LmjJigUciaeO1JR4XxXgCIV1/Zc/dRuFEyw1L0pbA+qynJkW5Q==", + "version": "8.6.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.6.0.tgz", + "integrity": "sha512-U1riIR+lBSNi3IbxtaHOIKdH8sLFv3NYfNv8sg7ZsNhcfl4HF2++BfqqrNAxoCLQW1iiylOj76ecnaUxz+z9yw==", "dev": true }, "acorn-walk": { @@ -294,6 +302,17 @@ "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", "dev": true }, + "deno.ns": { + "version": "file:packages/deno.ns", + "requires": { + "@types/node": "^16.4.13", + "@types/which": "^2.0.1", + "ts-node": "^10.4.0", + "typescript": "^4.5.2", + "undici": "^4.5.1", + "which": "^2.0.2" + } + }, "diff": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", @@ -332,15 +351,15 @@ } }, "typescript": { - "version": "4.5.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.2.tgz", - "integrity": "sha512-5BlMof9H1yGt0P8/WF+wPNw6GfctgGjXp5hkblpyT+8rkASSmkUKMXrxR0Xg8ThVCi/JnHQiKXeBaEwCeQwMFw==", + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.4.tgz", + "integrity": "sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==", "dev": true }, "undici": { - "version": "4.8.1", - "resolved": "https://registry.npmjs.org/undici/-/undici-4.8.1.tgz", - "integrity": "sha512-0HYfUmepa5euTv3ewj9OqJDiBrZrBEr4o8HPdNHeWOsPCLLXZSBVovW+D3D1LoFeGXhe5Bm2V/e7YJatUjeWfQ==" + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/undici/-/undici-4.12.1.tgz", + "integrity": "sha512-MSfap7YiQJqTPP12C11PFRs9raZuVicDbwsZHTjB0a8+SsCqt7KdUis54f373yf7ZFhJzAkGJLaKm0202OIxHg==" }, "which": { "version": "2.0.2", diff --git a/package.json b/package.json index 10f8350..4abd032 100644 --- a/package.json +++ b/package.json @@ -1,58 +1,10 @@ { - "name": "deno.ns", - "version": "0.8.0", - "description": "Deno namespace shim for Node.js", - "keywords": [ - "deno namespace", - "deno", - "polyfill", - "ponyfill", - "shim" - ], - "main": "./dist/index.js", - "types": "./lib/deno.ns.lib.d.ts", - "author": "Thomas Rory Gummerson (https://trgwii.no/)", - "contributors": [ - "Wojciech Pawlik ", - "Muthu Kumar (https://mkr.pw)" - ], - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/denoland/deno.ns.git" - }, - "exports": { - ".": "./dist/index.js", - "./global": "./dist/global.js", - "./deno": "./dist/deno.js", - "./test-internals": "./dist/deno/internal/test.js" - }, - "files": [ - "dist", - "lib/deno.ns.lib.d.ts" + "name": "deno.ns-workspace", + "workspaces": [ + "packages/deno.ns" ], "scripts": { - "denolib": "deno run --allow-run --allow-write=src/deno/ tools/denolib.ts", - "build": "tsc && npm run --silent generate-declaration-file", - "prepare": "npm run --silent denolib && npm run --silent build", - "generate-declaration-file": "deno run --allow-write=lib --allow-read=. tools/generateDeclarationFile.ts", "lint": "deno lint --config deno.json", - "fmt": "deno fmt --config deno.json", - "clean": "git clean -fXde !node_modules/", - "test": "node --loader=ts-node/esm tools/run_tests.mjs", - "update-progress": "deno run --allow-read tools/missing.ts > PROGRESS.md" - }, - "engines": { - "node": ">=16.7.0" - }, - "dependencies": { - "undici": "^4.5.1", - "which": "^2.0.2" - }, - "devDependencies": { - "@types/node": "^16.4.13", - "@types/which": "^2.0.1", - "ts-node": "^10.4.0", - "typescript": "^4.5.2" + "fmt": "deno fmt --config deno.json" } } diff --git a/packages/deno.ns/LICENSE b/packages/deno.ns/LICENSE new file mode 100644 index 0000000..310d4c6 --- /dev/null +++ b/packages/deno.ns/LICENSE @@ -0,0 +1,20 @@ +MIT License + +Copyright 2021 the Deno authors + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/PROGRESS.md b/packages/deno.ns/PROGRESS.md similarity index 100% rename from PROGRESS.md rename to packages/deno.ns/PROGRESS.md diff --git a/packages/deno.ns/README.md b/packages/deno.ns/README.md new file mode 100644 index 0000000..35c3cea --- /dev/null +++ b/packages/deno.ns/README.md @@ -0,0 +1,37 @@ +# `deno.ns` + +[`Deno` namespace](https://doc.deno.land/builtin/stable) shim for Node.js. + +See +[PROGRESS.md](https://github.com/denoland/deno.ns/blob/main/packages/deno.ns/PROGRESS.md) + +## Usage + +```js +const { + alert, + Blob, + confirm, + crypto, + Deno, + fetch, + File, + FormData, + Headers, + prompt, + Request, + Response, +} = require("deno.ns"); +``` + +or `node --require=deno.ns/global `, + +or https://github.com/wojpawlik/deno2node#shimming + +## Acknowledgements + +Special thanks to the [@fromdeno](https://github.com/fromdeno) organization for +starting this project and for their contributions—specifically +[@wojpawlik](https://github.com/wojpawlik), +[@MKRhere](https://github.com/MKRhere), and +[@trgwii](https://github.com/trgwii). diff --git a/lib/deno.ns.lib.d.ts b/packages/deno.ns/lib/deno.ns.lib.d.ts similarity index 100% rename from lib/deno.ns.lib.d.ts rename to packages/deno.ns/lib/deno.ns.lib.d.ts diff --git a/packages/deno.ns/package-lock.json b/packages/deno.ns/package-lock.json new file mode 100644 index 0000000..b532ee0 --- /dev/null +++ b/packages/deno.ns/package-lock.json @@ -0,0 +1,360 @@ +{ + "name": "deno.ns", + "version": "0.8.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "deno.ns", + "version": "0.8.0", + "license": "MIT", + "dependencies": { + "undici": "^4.5.1", + "which": "^2.0.2" + }, + "devDependencies": { + "@types/node": "^16.4.13", + "@types/which": "^2.0.1", + "ts-node": "^10.4.0", + "typescript": "^4.5.2" + }, + "engines": { + "node": ">=16.7.0" + } + }, + "node_modules/@cspotcode/source-map-consumer": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", + "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", + "dev": true, + "engines": { + "node": ">= 12" + } + }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", + "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", + "dev": true, + "dependencies": { + "@cspotcode/source-map-consumer": "0.8.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@tsconfig/node10": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", + "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==", + "dev": true + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz", + "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==", + "dev": true + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz", + "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==", + "dev": true + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz", + "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==", + "dev": true + }, + "node_modules/@types/node": { + "version": "16.11.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.6.tgz", + "integrity": "sha512-ua7PgUoeQFjmWPcoo9khiPum3Pd60k4/2ZGXt18sm2Slk0W0xZTqt5Y0Ny1NyBiN1EVQ/+FaF9NcY4Qe6rwk5w==", + "dev": true + }, + "node_modules/@types/which": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@types/which/-/which-2.0.1.tgz", + "integrity": "sha512-Jjakcv8Roqtio6w1gr0D7y6twbhx6gGgFGF5BLwajPpnOIOxFkakFhCq+LmyyeAz7BX6ULrjBOxdKaCDy+4+dQ==", + "dev": true + }, + "node_modules/acorn": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.5.0.tgz", + "integrity": "sha512-yXbYeFy+jUuYd3/CDcg2NkIYE991XYX/bje7LmjJigUciaeO1JR4XxXgCIV1/Zc/dRuFEyw1L0pbA+qynJkW5Q==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, + "node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + }, + "node_modules/make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, + "node_modules/ts-node": { + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.4.0.tgz", + "integrity": "sha512-g0FlPvvCXSIO1JDF6S232P5jPYqBkRL9qly81ZgAOSU7rwI0stphCgd2kLiCrU9DjQCrJMWEqcNSjQL02s6d8A==", + "dev": true, + "dependencies": { + "@cspotcode/source-map-support": "0.7.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, + "node_modules/typescript": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.2.tgz", + "integrity": "sha512-5BlMof9H1yGt0P8/WF+wPNw6GfctgGjXp5hkblpyT+8rkASSmkUKMXrxR0Xg8ThVCi/JnHQiKXeBaEwCeQwMFw==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/undici": { + "version": "4.8.1", + "resolved": "https://registry.npmjs.org/undici/-/undici-4.8.1.tgz", + "integrity": "sha512-0HYfUmepa5euTv3ewj9OqJDiBrZrBEr4o8HPdNHeWOsPCLLXZSBVovW+D3D1LoFeGXhe5Bm2V/e7YJatUjeWfQ==", + "engines": { + "node": ">=12.18" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, + "engines": { + "node": ">=6" + } + } + }, + "dependencies": { + "@cspotcode/source-map-consumer": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", + "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", + "dev": true + }, + "@cspotcode/source-map-support": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", + "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", + "dev": true, + "requires": { + "@cspotcode/source-map-consumer": "0.8.0" + } + }, + "@tsconfig/node10": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", + "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==", + "dev": true + }, + "@tsconfig/node12": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz", + "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==", + "dev": true + }, + "@tsconfig/node14": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz", + "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==", + "dev": true + }, + "@tsconfig/node16": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz", + "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==", + "dev": true + }, + "@types/node": { + "version": "16.11.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.6.tgz", + "integrity": "sha512-ua7PgUoeQFjmWPcoo9khiPum3Pd60k4/2ZGXt18sm2Slk0W0xZTqt5Y0Ny1NyBiN1EVQ/+FaF9NcY4Qe6rwk5w==", + "dev": true + }, + "@types/which": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@types/which/-/which-2.0.1.tgz", + "integrity": "sha512-Jjakcv8Roqtio6w1gr0D7y6twbhx6gGgFGF5BLwajPpnOIOxFkakFhCq+LmyyeAz7BX6ULrjBOxdKaCDy+4+dQ==", + "dev": true + }, + "acorn": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.5.0.tgz", + "integrity": "sha512-yXbYeFy+jUuYd3/CDcg2NkIYE991XYX/bje7LmjJigUciaeO1JR4XxXgCIV1/Zc/dRuFEyw1L0pbA+qynJkW5Q==", + "dev": true + }, + "acorn-walk": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", + "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "dev": true + }, + "arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, + "create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=" + }, + "make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, + "ts-node": { + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.4.0.tgz", + "integrity": "sha512-g0FlPvvCXSIO1JDF6S232P5jPYqBkRL9qly81ZgAOSU7rwI0stphCgd2kLiCrU9DjQCrJMWEqcNSjQL02s6d8A==", + "dev": true, + "requires": { + "@cspotcode/source-map-support": "0.7.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "yn": "3.1.1" + } + }, + "typescript": { + "version": "4.5.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.2.tgz", + "integrity": "sha512-5BlMof9H1yGt0P8/WF+wPNw6GfctgGjXp5hkblpyT+8rkASSmkUKMXrxR0Xg8ThVCi/JnHQiKXeBaEwCeQwMFw==", + "dev": true + }, + "undici": { + "version": "4.8.1", + "resolved": "https://registry.npmjs.org/undici/-/undici-4.8.1.tgz", + "integrity": "sha512-0HYfUmepa5euTv3ewj9OqJDiBrZrBEr4o8HPdNHeWOsPCLLXZSBVovW+D3D1LoFeGXhe5Bm2V/e7YJatUjeWfQ==" + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "requires": { + "isexe": "^2.0.0" + } + }, + "yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true + } + } +} diff --git a/packages/deno.ns/package.json b/packages/deno.ns/package.json new file mode 100644 index 0000000..2371339 --- /dev/null +++ b/packages/deno.ns/package.json @@ -0,0 +1,56 @@ +{ + "name": "deno.ns", + "version": "0.8.0", + "description": "Deno namespace shim for Node.js", + "keywords": [ + "deno namespace", + "deno", + "polyfill", + "ponyfill", + "shim" + ], + "main": "./dist/index.js", + "types": "./lib/deno.ns.lib.d.ts", + "author": "Thomas Rory Gummerson (https://trgwii.no/)", + "contributors": [ + "Wojciech Pawlik ", + "Muthu Kumar (https://mkr.pw)" + ], + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/denoland/deno.ns.git" + }, + "exports": { + ".": "./dist/index.js", + "./global": "./dist/global.js", + "./deno": "./dist/deno.js", + "./test-internals": "./dist/deno/internal/test.js" + }, + "files": [ + "dist", + "lib/deno.ns.lib.d.ts" + ], + "scripts": { + "build": "tsc", + "prepare": "npm run denolib && npm run --silent build", + "clean": "git clean -fXde !node_modules/", + "test": "node --loader=ts-node/esm tools/run_tests.mjs", + "denolib": "deno run --allow-run --allow-write=src/deno tools/denolib.ts", + "generate-declaration-file": "deno run --allow-write=lib --allow-read=. ctools/generateDeclarationFile.ts", + "update-progress": "deno run --allow-read tools/missing.ts > PROGRESS.md" + }, + "engines": { + "node": ">=16.7.0" + }, + "dependencies": { + "undici": "^4.5.1", + "which": "^2.0.2" + }, + "devDependencies": { + "@types/node": "^16.4.13", + "@types/which": "^2.0.1", + "ts-node": "^10.4.0", + "typescript": "^4.5.2" + } +} diff --git a/src/deno.ts b/packages/deno.ns/src/deno.ts similarity index 100% rename from src/deno.ts rename to packages/deno.ns/src/deno.ts diff --git a/src/deno/internal/Conn.ts b/packages/deno.ns/src/deno/internal/Conn.ts similarity index 100% rename from src/deno/internal/Conn.ts rename to packages/deno.ns/src/deno/internal/Conn.ts diff --git a/src/deno/internal/Listener.ts b/packages/deno.ns/src/deno/internal/Listener.ts similarity index 100% rename from src/deno/internal/Listener.ts rename to packages/deno.ns/src/deno/internal/Listener.ts diff --git a/src/deno/internal/consts.ts b/packages/deno.ns/src/deno/internal/consts.ts similarity index 100% rename from src/deno/internal/consts.ts rename to packages/deno.ns/src/deno/internal/consts.ts diff --git a/src/deno/internal/errorMap.ts b/packages/deno.ns/src/deno/internal/errorMap.ts similarity index 100% rename from src/deno/internal/errorMap.ts rename to packages/deno.ns/src/deno/internal/errorMap.ts diff --git a/src/deno/internal/fs_flags.ts b/packages/deno.ns/src/deno/internal/fs_flags.ts similarity index 100% rename from src/deno/internal/fs_flags.ts rename to packages/deno.ns/src/deno/internal/fs_flags.ts diff --git a/src/deno/internal/iterutil.ts b/packages/deno.ns/src/deno/internal/iterutil.ts similarity index 100% rename from src/deno/internal/iterutil.ts rename to packages/deno.ns/src/deno/internal/iterutil.ts diff --git a/src/deno/internal/random_id.ts b/packages/deno.ns/src/deno/internal/random_id.ts similarity index 100% rename from src/deno/internal/random_id.ts rename to packages/deno.ns/src/deno/internal/random_id.ts diff --git a/src/deno/internal/streams.test.ts b/packages/deno.ns/src/deno/internal/streams.test.ts similarity index 100% rename from src/deno/internal/streams.test.ts rename to packages/deno.ns/src/deno/internal/streams.test.ts diff --git a/src/deno/internal/streams.ts b/packages/deno.ns/src/deno/internal/streams.ts similarity index 100% rename from src/deno/internal/streams.ts rename to packages/deno.ns/src/deno/internal/streams.ts diff --git a/src/deno/internal/test.ts b/packages/deno.ns/src/deno/internal/test.ts similarity index 100% rename from src/deno/internal/test.ts rename to packages/deno.ns/src/deno/internal/test.ts diff --git a/src/deno/internal/version.ts b/packages/deno.ns/src/deno/internal/version.ts similarity index 100% rename from src/deno/internal/version.ts rename to packages/deno.ns/src/deno/internal/version.ts diff --git a/src/deno/stable/classes.ts b/packages/deno.ns/src/deno/stable/classes.ts similarity index 100% rename from src/deno/stable/classes.ts rename to packages/deno.ns/src/deno/stable/classes.ts diff --git a/src/deno/stable/classes/File.ts b/packages/deno.ns/src/deno/stable/classes/File.ts similarity index 100% rename from src/deno/stable/classes/File.ts rename to packages/deno.ns/src/deno/stable/classes/File.ts diff --git a/src/deno/stable/classes/PermissionStatus.ts b/packages/deno.ns/src/deno/stable/classes/PermissionStatus.ts similarity index 100% rename from src/deno/stable/classes/PermissionStatus.ts rename to packages/deno.ns/src/deno/stable/classes/PermissionStatus.ts diff --git a/src/deno/stable/classes/Permissions.ts b/packages/deno.ns/src/deno/stable/classes/Permissions.ts similarity index 100% rename from src/deno/stable/classes/Permissions.ts rename to packages/deno.ns/src/deno/stable/classes/Permissions.ts diff --git a/src/deno/stable/enums.ts b/packages/deno.ns/src/deno/stable/enums.ts similarity index 100% rename from src/deno/stable/enums.ts rename to packages/deno.ns/src/deno/stable/enums.ts diff --git a/src/deno/stable/enums/SeekMode.ts b/packages/deno.ns/src/deno/stable/enums/SeekMode.ts similarity index 100% rename from src/deno/stable/enums/SeekMode.ts rename to packages/deno.ns/src/deno/stable/enums/SeekMode.ts diff --git a/src/deno/stable/functions.ts b/packages/deno.ns/src/deno/stable/functions.ts similarity index 100% rename from src/deno/stable/functions.ts rename to packages/deno.ns/src/deno/stable/functions.ts diff --git a/src/deno/stable/functions/chdir.ts b/packages/deno.ns/src/deno/stable/functions/chdir.ts similarity index 100% rename from src/deno/stable/functions/chdir.ts rename to packages/deno.ns/src/deno/stable/functions/chdir.ts diff --git a/src/deno/stable/functions/chmod.ts b/packages/deno.ns/src/deno/stable/functions/chmod.ts similarity index 100% rename from src/deno/stable/functions/chmod.ts rename to packages/deno.ns/src/deno/stable/functions/chmod.ts diff --git a/src/deno/stable/functions/chmodSync.ts b/packages/deno.ns/src/deno/stable/functions/chmodSync.ts similarity index 100% rename from src/deno/stable/functions/chmodSync.ts rename to packages/deno.ns/src/deno/stable/functions/chmodSync.ts diff --git a/src/deno/stable/functions/chown.ts b/packages/deno.ns/src/deno/stable/functions/chown.ts similarity index 100% rename from src/deno/stable/functions/chown.ts rename to packages/deno.ns/src/deno/stable/functions/chown.ts diff --git a/src/deno/stable/functions/chownSync.ts b/packages/deno.ns/src/deno/stable/functions/chownSync.ts similarity index 100% rename from src/deno/stable/functions/chownSync.ts rename to packages/deno.ns/src/deno/stable/functions/chownSync.ts diff --git a/src/deno/stable/functions/close.ts b/packages/deno.ns/src/deno/stable/functions/close.ts similarity index 100% rename from src/deno/stable/functions/close.ts rename to packages/deno.ns/src/deno/stable/functions/close.ts diff --git a/src/deno/stable/functions/connect.ts b/packages/deno.ns/src/deno/stable/functions/connect.ts similarity index 100% rename from src/deno/stable/functions/connect.ts rename to packages/deno.ns/src/deno/stable/functions/connect.ts diff --git a/src/deno/stable/functions/connectTls.ts b/packages/deno.ns/src/deno/stable/functions/connectTls.ts similarity index 100% rename from src/deno/stable/functions/connectTls.ts rename to packages/deno.ns/src/deno/stable/functions/connectTls.ts diff --git a/src/deno/stable/functions/copy.ts b/packages/deno.ns/src/deno/stable/functions/copy.ts similarity index 100% rename from src/deno/stable/functions/copy.ts rename to packages/deno.ns/src/deno/stable/functions/copy.ts diff --git a/src/deno/stable/functions/copyFile.ts b/packages/deno.ns/src/deno/stable/functions/copyFile.ts similarity index 100% rename from src/deno/stable/functions/copyFile.ts rename to packages/deno.ns/src/deno/stable/functions/copyFile.ts diff --git a/src/deno/stable/functions/copyFileSync.ts b/packages/deno.ns/src/deno/stable/functions/copyFileSync.ts similarity index 100% rename from src/deno/stable/functions/copyFileSync.ts rename to packages/deno.ns/src/deno/stable/functions/copyFileSync.ts diff --git a/src/deno/stable/functions/create.ts b/packages/deno.ns/src/deno/stable/functions/create.ts similarity index 100% rename from src/deno/stable/functions/create.ts rename to packages/deno.ns/src/deno/stable/functions/create.ts diff --git a/src/deno/stable/functions/createSync.ts b/packages/deno.ns/src/deno/stable/functions/createSync.ts similarity index 100% rename from src/deno/stable/functions/createSync.ts rename to packages/deno.ns/src/deno/stable/functions/createSync.ts diff --git a/src/deno/stable/functions/cwd.ts b/packages/deno.ns/src/deno/stable/functions/cwd.ts similarity index 100% rename from src/deno/stable/functions/cwd.ts rename to packages/deno.ns/src/deno/stable/functions/cwd.ts diff --git a/src/deno/stable/functions/execPath.ts b/packages/deno.ns/src/deno/stable/functions/execPath.ts similarity index 100% rename from src/deno/stable/functions/execPath.ts rename to packages/deno.ns/src/deno/stable/functions/execPath.ts diff --git a/src/deno/stable/functions/exit.ts b/packages/deno.ns/src/deno/stable/functions/exit.ts similarity index 100% rename from src/deno/stable/functions/exit.ts rename to packages/deno.ns/src/deno/stable/functions/exit.ts diff --git a/src/deno/stable/functions/fdatasync.ts b/packages/deno.ns/src/deno/stable/functions/fdatasync.ts similarity index 100% rename from src/deno/stable/functions/fdatasync.ts rename to packages/deno.ns/src/deno/stable/functions/fdatasync.ts diff --git a/src/deno/stable/functions/fdatasyncSync.ts b/packages/deno.ns/src/deno/stable/functions/fdatasyncSync.ts similarity index 100% rename from src/deno/stable/functions/fdatasyncSync.ts rename to packages/deno.ns/src/deno/stable/functions/fdatasyncSync.ts diff --git a/src/deno/stable/functions/fstat.ts b/packages/deno.ns/src/deno/stable/functions/fstat.ts similarity index 100% rename from src/deno/stable/functions/fstat.ts rename to packages/deno.ns/src/deno/stable/functions/fstat.ts diff --git a/src/deno/stable/functions/fstatSync.ts b/packages/deno.ns/src/deno/stable/functions/fstatSync.ts similarity index 100% rename from src/deno/stable/functions/fstatSync.ts rename to packages/deno.ns/src/deno/stable/functions/fstatSync.ts diff --git a/src/deno/stable/functions/fsync.ts b/packages/deno.ns/src/deno/stable/functions/fsync.ts similarity index 100% rename from src/deno/stable/functions/fsync.ts rename to packages/deno.ns/src/deno/stable/functions/fsync.ts diff --git a/src/deno/stable/functions/fsyncSync.ts b/packages/deno.ns/src/deno/stable/functions/fsyncSync.ts similarity index 100% rename from src/deno/stable/functions/fsyncSync.ts rename to packages/deno.ns/src/deno/stable/functions/fsyncSync.ts diff --git a/src/deno/stable/functions/ftruncate.ts b/packages/deno.ns/src/deno/stable/functions/ftruncate.ts similarity index 100% rename from src/deno/stable/functions/ftruncate.ts rename to packages/deno.ns/src/deno/stable/functions/ftruncate.ts diff --git a/src/deno/stable/functions/ftruncateSync.ts b/packages/deno.ns/src/deno/stable/functions/ftruncateSync.ts similarity index 100% rename from src/deno/stable/functions/ftruncateSync.ts rename to packages/deno.ns/src/deno/stable/functions/ftruncateSync.ts diff --git a/src/deno/stable/functions/inspect.ts b/packages/deno.ns/src/deno/stable/functions/inspect.ts similarity index 100% rename from src/deno/stable/functions/inspect.ts rename to packages/deno.ns/src/deno/stable/functions/inspect.ts diff --git a/src/deno/stable/functions/kill.ts b/packages/deno.ns/src/deno/stable/functions/kill.ts similarity index 100% rename from src/deno/stable/functions/kill.ts rename to packages/deno.ns/src/deno/stable/functions/kill.ts diff --git a/src/deno/stable/functions/link.ts b/packages/deno.ns/src/deno/stable/functions/link.ts similarity index 100% rename from src/deno/stable/functions/link.ts rename to packages/deno.ns/src/deno/stable/functions/link.ts diff --git a/src/deno/stable/functions/linkSync.ts b/packages/deno.ns/src/deno/stable/functions/linkSync.ts similarity index 100% rename from src/deno/stable/functions/linkSync.ts rename to packages/deno.ns/src/deno/stable/functions/linkSync.ts diff --git a/src/deno/stable/functions/listen.ts b/packages/deno.ns/src/deno/stable/functions/listen.ts similarity index 100% rename from src/deno/stable/functions/listen.ts rename to packages/deno.ns/src/deno/stable/functions/listen.ts diff --git a/src/deno/stable/functions/listenTls.ts b/packages/deno.ns/src/deno/stable/functions/listenTls.ts similarity index 100% rename from src/deno/stable/functions/listenTls.ts rename to packages/deno.ns/src/deno/stable/functions/listenTls.ts diff --git a/src/deno/stable/functions/lstat.ts b/packages/deno.ns/src/deno/stable/functions/lstat.ts similarity index 100% rename from src/deno/stable/functions/lstat.ts rename to packages/deno.ns/src/deno/stable/functions/lstat.ts diff --git a/src/deno/stable/functions/lstatSync.ts b/packages/deno.ns/src/deno/stable/functions/lstatSync.ts similarity index 100% rename from src/deno/stable/functions/lstatSync.ts rename to packages/deno.ns/src/deno/stable/functions/lstatSync.ts diff --git a/src/deno/stable/functions/makeTempDir.ts b/packages/deno.ns/src/deno/stable/functions/makeTempDir.ts similarity index 100% rename from src/deno/stable/functions/makeTempDir.ts rename to packages/deno.ns/src/deno/stable/functions/makeTempDir.ts diff --git a/src/deno/stable/functions/makeTempDirSync.ts b/packages/deno.ns/src/deno/stable/functions/makeTempDirSync.ts similarity index 100% rename from src/deno/stable/functions/makeTempDirSync.ts rename to packages/deno.ns/src/deno/stable/functions/makeTempDirSync.ts diff --git a/src/deno/stable/functions/makeTempFile.ts b/packages/deno.ns/src/deno/stable/functions/makeTempFile.ts similarity index 100% rename from src/deno/stable/functions/makeTempFile.ts rename to packages/deno.ns/src/deno/stable/functions/makeTempFile.ts diff --git a/src/deno/stable/functions/makeTempFileSync.ts b/packages/deno.ns/src/deno/stable/functions/makeTempFileSync.ts similarity index 100% rename from src/deno/stable/functions/makeTempFileSync.ts rename to packages/deno.ns/src/deno/stable/functions/makeTempFileSync.ts diff --git a/src/deno/stable/functions/memoryUsage.ts b/packages/deno.ns/src/deno/stable/functions/memoryUsage.ts similarity index 100% rename from src/deno/stable/functions/memoryUsage.ts rename to packages/deno.ns/src/deno/stable/functions/memoryUsage.ts diff --git a/src/deno/stable/functions/mkdir.ts b/packages/deno.ns/src/deno/stable/functions/mkdir.ts similarity index 100% rename from src/deno/stable/functions/mkdir.ts rename to packages/deno.ns/src/deno/stable/functions/mkdir.ts diff --git a/src/deno/stable/functions/mkdirSync.ts b/packages/deno.ns/src/deno/stable/functions/mkdirSync.ts similarity index 100% rename from src/deno/stable/functions/mkdirSync.ts rename to packages/deno.ns/src/deno/stable/functions/mkdirSync.ts diff --git a/src/deno/stable/functions/open.ts b/packages/deno.ns/src/deno/stable/functions/open.ts similarity index 100% rename from src/deno/stable/functions/open.ts rename to packages/deno.ns/src/deno/stable/functions/open.ts diff --git a/src/deno/stable/functions/openSync.ts b/packages/deno.ns/src/deno/stable/functions/openSync.ts similarity index 100% rename from src/deno/stable/functions/openSync.ts rename to packages/deno.ns/src/deno/stable/functions/openSync.ts diff --git a/src/deno/stable/functions/read.ts b/packages/deno.ns/src/deno/stable/functions/read.ts similarity index 100% rename from src/deno/stable/functions/read.ts rename to packages/deno.ns/src/deno/stable/functions/read.ts diff --git a/src/deno/stable/functions/readDir.ts b/packages/deno.ns/src/deno/stable/functions/readDir.ts similarity index 100% rename from src/deno/stable/functions/readDir.ts rename to packages/deno.ns/src/deno/stable/functions/readDir.ts diff --git a/src/deno/stable/functions/readDirSync.ts b/packages/deno.ns/src/deno/stable/functions/readDirSync.ts similarity index 100% rename from src/deno/stable/functions/readDirSync.ts rename to packages/deno.ns/src/deno/stable/functions/readDirSync.ts diff --git a/src/deno/stable/functions/readFile.ts b/packages/deno.ns/src/deno/stable/functions/readFile.ts similarity index 100% rename from src/deno/stable/functions/readFile.ts rename to packages/deno.ns/src/deno/stable/functions/readFile.ts diff --git a/src/deno/stable/functions/readFileSync.ts b/packages/deno.ns/src/deno/stable/functions/readFileSync.ts similarity index 100% rename from src/deno/stable/functions/readFileSync.ts rename to packages/deno.ns/src/deno/stable/functions/readFileSync.ts diff --git a/src/deno/stable/functions/readLink.ts b/packages/deno.ns/src/deno/stable/functions/readLink.ts similarity index 100% rename from src/deno/stable/functions/readLink.ts rename to packages/deno.ns/src/deno/stable/functions/readLink.ts diff --git a/src/deno/stable/functions/readLinkSync.ts b/packages/deno.ns/src/deno/stable/functions/readLinkSync.ts similarity index 100% rename from src/deno/stable/functions/readLinkSync.ts rename to packages/deno.ns/src/deno/stable/functions/readLinkSync.ts diff --git a/src/deno/stable/functions/readSync.ts b/packages/deno.ns/src/deno/stable/functions/readSync.ts similarity index 100% rename from src/deno/stable/functions/readSync.ts rename to packages/deno.ns/src/deno/stable/functions/readSync.ts diff --git a/src/deno/stable/functions/readTextFile.ts b/packages/deno.ns/src/deno/stable/functions/readTextFile.ts similarity index 100% rename from src/deno/stable/functions/readTextFile.ts rename to packages/deno.ns/src/deno/stable/functions/readTextFile.ts diff --git a/src/deno/stable/functions/readTextFileSync.ts b/packages/deno.ns/src/deno/stable/functions/readTextFileSync.ts similarity index 100% rename from src/deno/stable/functions/readTextFileSync.ts rename to packages/deno.ns/src/deno/stable/functions/readTextFileSync.ts diff --git a/src/deno/stable/functions/realPath.ts b/packages/deno.ns/src/deno/stable/functions/realPath.ts similarity index 100% rename from src/deno/stable/functions/realPath.ts rename to packages/deno.ns/src/deno/stable/functions/realPath.ts diff --git a/src/deno/stable/functions/realPathSync.ts b/packages/deno.ns/src/deno/stable/functions/realPathSync.ts similarity index 100% rename from src/deno/stable/functions/realPathSync.ts rename to packages/deno.ns/src/deno/stable/functions/realPathSync.ts diff --git a/src/deno/stable/functions/remove.ts b/packages/deno.ns/src/deno/stable/functions/remove.ts similarity index 100% rename from src/deno/stable/functions/remove.ts rename to packages/deno.ns/src/deno/stable/functions/remove.ts diff --git a/src/deno/stable/functions/removeSync.ts b/packages/deno.ns/src/deno/stable/functions/removeSync.ts similarity index 100% rename from src/deno/stable/functions/removeSync.ts rename to packages/deno.ns/src/deno/stable/functions/removeSync.ts diff --git a/src/deno/stable/functions/rename.ts b/packages/deno.ns/src/deno/stable/functions/rename.ts similarity index 100% rename from src/deno/stable/functions/rename.ts rename to packages/deno.ns/src/deno/stable/functions/rename.ts diff --git a/src/deno/stable/functions/renameSync.ts b/packages/deno.ns/src/deno/stable/functions/renameSync.ts similarity index 100% rename from src/deno/stable/functions/renameSync.ts rename to packages/deno.ns/src/deno/stable/functions/renameSync.ts diff --git a/src/deno/stable/functions/run.test.ts b/packages/deno.ns/src/deno/stable/functions/run.test.ts similarity index 100% rename from src/deno/stable/functions/run.test.ts rename to packages/deno.ns/src/deno/stable/functions/run.test.ts diff --git a/src/deno/stable/functions/run.ts b/packages/deno.ns/src/deno/stable/functions/run.ts similarity index 100% rename from src/deno/stable/functions/run.ts rename to packages/deno.ns/src/deno/stable/functions/run.ts diff --git a/src/deno/stable/functions/shutdown.ts b/packages/deno.ns/src/deno/stable/functions/shutdown.ts similarity index 100% rename from src/deno/stable/functions/shutdown.ts rename to packages/deno.ns/src/deno/stable/functions/shutdown.ts diff --git a/src/deno/stable/functions/sleepSync.ts b/packages/deno.ns/src/deno/stable/functions/sleepSync.ts similarity index 100% rename from src/deno/stable/functions/sleepSync.ts rename to packages/deno.ns/src/deno/stable/functions/sleepSync.ts diff --git a/src/deno/stable/functions/stat.ts b/packages/deno.ns/src/deno/stable/functions/stat.ts similarity index 100% rename from src/deno/stable/functions/stat.ts rename to packages/deno.ns/src/deno/stable/functions/stat.ts diff --git a/src/deno/stable/functions/statSync.ts b/packages/deno.ns/src/deno/stable/functions/statSync.ts similarity index 100% rename from src/deno/stable/functions/statSync.ts rename to packages/deno.ns/src/deno/stable/functions/statSync.ts diff --git a/src/deno/stable/functions/symlink.ts b/packages/deno.ns/src/deno/stable/functions/symlink.ts similarity index 100% rename from src/deno/stable/functions/symlink.ts rename to packages/deno.ns/src/deno/stable/functions/symlink.ts diff --git a/src/deno/stable/functions/symlinkSync.ts b/packages/deno.ns/src/deno/stable/functions/symlinkSync.ts similarity index 100% rename from src/deno/stable/functions/symlinkSync.ts rename to packages/deno.ns/src/deno/stable/functions/symlinkSync.ts diff --git a/packages/deno.ns/src/deno/stable/functions/test.ts b/packages/deno.ns/src/deno/stable/functions/test.ts new file mode 100644 index 0000000..c2c3935 --- /dev/null +++ b/packages/deno.ns/src/deno/stable/functions/test.ts @@ -0,0 +1,78 @@ +/// + +import { testDefinitions } from "../../internal/test.js"; + +export const test: typeof Deno.test = function test() { + let testDef: Deno.TestDefinition; + const firstArg = arguments[0]; + const secondArg = arguments[1]; + const thirdArg = arguments[2]; + + if (typeof firstArg === "string") { + if (typeof secondArg === "object") { + if (typeof thirdArg === "function") { + if (secondArg.fn != null) { + throw new TypeError( + "Unexpected 'fn' field in options, test function is already provided as the third argument.", + ); + } + } + if (secondArg.name != null) { + throw new TypeError( + "Unexpected 'name' field in options, test name is already provided as the first argument.", + ); + } + // name, options, fn + testDef = { name: firstArg, fn: thirdArg, ...secondArg }; + } else { + // name, fn + testDef = { name: firstArg, fn: secondArg }; + } + } else if (firstArg instanceof Function) { + // function only + if (firstArg.name.length === 0) { + throw new TypeError("The test function must have a name"); + } + testDef = { fn: firstArg, name: firstArg.name }; + + if (secondArg != null) { + throw new TypeError("Unexpected second argument to Deno.test()"); + } + } else if (typeof firstArg === "object") { + testDef = { ...firstArg }; + if (typeof secondArg === "function") { + // options, fn + testDef.fn = secondArg; + if (firstArg.fn != null) { + throw new TypeError( + "Unexpected 'fn' field in options, test function is already provided as the second argument.", + ); + } + if (testDef.name == null) { + if (secondArg.name.length === 0) { + throw new TypeError("The test function must have a name"); + } + // options without name, fn + testDef.name = secondArg.name; + } + } else { + if (typeof firstArg.fn !== "function") { + throw new TypeError( + "Expected 'fn' field in the first argument to be a test function.", + ); + } + } + } else { + throw new TypeError("Unknown test overload"); + } + + if (typeof testDef.fn !== "function") { + throw new TypeError("Missing test function"); + } + + if ((testDef.name?.length ?? 0) === 0) { + throw new TypeError("The test name can't be empty"); + } + + testDefinitions.push(testDef); +}; diff --git a/src/deno/stable/functions/truncate.ts b/packages/deno.ns/src/deno/stable/functions/truncate.ts similarity index 100% rename from src/deno/stable/functions/truncate.ts rename to packages/deno.ns/src/deno/stable/functions/truncate.ts diff --git a/src/deno/stable/functions/truncateSync.ts b/packages/deno.ns/src/deno/stable/functions/truncateSync.ts similarity index 100% rename from src/deno/stable/functions/truncateSync.ts rename to packages/deno.ns/src/deno/stable/functions/truncateSync.ts diff --git a/src/deno/stable/functions/watchFs.ts b/packages/deno.ns/src/deno/stable/functions/watchFs.ts similarity index 100% rename from src/deno/stable/functions/watchFs.ts rename to packages/deno.ns/src/deno/stable/functions/watchFs.ts diff --git a/src/deno/stable/functions/write.ts b/packages/deno.ns/src/deno/stable/functions/write.ts similarity index 100% rename from src/deno/stable/functions/write.ts rename to packages/deno.ns/src/deno/stable/functions/write.ts diff --git a/src/deno/stable/functions/writeFile.ts b/packages/deno.ns/src/deno/stable/functions/writeFile.ts similarity index 100% rename from src/deno/stable/functions/writeFile.ts rename to packages/deno.ns/src/deno/stable/functions/writeFile.ts diff --git a/src/deno/stable/functions/writeFileSync.ts b/packages/deno.ns/src/deno/stable/functions/writeFileSync.ts similarity index 100% rename from src/deno/stable/functions/writeFileSync.ts rename to packages/deno.ns/src/deno/stable/functions/writeFileSync.ts diff --git a/src/deno/stable/functions/writeSync.ts b/packages/deno.ns/src/deno/stable/functions/writeSync.ts similarity index 100% rename from src/deno/stable/functions/writeSync.ts rename to packages/deno.ns/src/deno/stable/functions/writeSync.ts diff --git a/src/deno/stable/functions/writeTextFile.ts b/packages/deno.ns/src/deno/stable/functions/writeTextFile.ts similarity index 100% rename from src/deno/stable/functions/writeTextFile.ts rename to packages/deno.ns/src/deno/stable/functions/writeTextFile.ts diff --git a/src/deno/stable/functions/writeTextFileSync.ts b/packages/deno.ns/src/deno/stable/functions/writeTextFileSync.ts similarity index 100% rename from src/deno/stable/functions/writeTextFileSync.ts rename to packages/deno.ns/src/deno/stable/functions/writeTextFileSync.ts diff --git a/src/deno/stable/main.ts b/packages/deno.ns/src/deno/stable/main.ts similarity index 100% rename from src/deno/stable/main.ts rename to packages/deno.ns/src/deno/stable/main.ts diff --git a/src/deno/stable/types.js b/packages/deno.ns/src/deno/stable/types.js similarity index 100% rename from src/deno/stable/types.js rename to packages/deno.ns/src/deno/stable/types.js diff --git a/src/deno/stable/types.ts b/packages/deno.ns/src/deno/stable/types.ts similarity index 100% rename from src/deno/stable/types.ts rename to packages/deno.ns/src/deno/stable/types.ts diff --git a/src/deno/stable/variables.ts b/packages/deno.ns/src/deno/stable/variables.ts similarity index 100% rename from src/deno/stable/variables.ts rename to packages/deno.ns/src/deno/stable/variables.ts diff --git a/src/deno/stable/variables/args.ts b/packages/deno.ns/src/deno/stable/variables/args.ts similarity index 100% rename from src/deno/stable/variables/args.ts rename to packages/deno.ns/src/deno/stable/variables/args.ts diff --git a/src/deno/stable/variables/build.ts b/packages/deno.ns/src/deno/stable/variables/build.ts similarity index 100% rename from src/deno/stable/variables/build.ts rename to packages/deno.ns/src/deno/stable/variables/build.ts diff --git a/src/deno/stable/variables/customInspect.ts b/packages/deno.ns/src/deno/stable/variables/customInspect.ts similarity index 100% rename from src/deno/stable/variables/customInspect.ts rename to packages/deno.ns/src/deno/stable/variables/customInspect.ts diff --git a/src/deno/stable/variables/env.ts b/packages/deno.ns/src/deno/stable/variables/env.ts similarity index 100% rename from src/deno/stable/variables/env.ts rename to packages/deno.ns/src/deno/stable/variables/env.ts diff --git a/src/deno/stable/variables/errors.ts b/packages/deno.ns/src/deno/stable/variables/errors.ts similarity index 100% rename from src/deno/stable/variables/errors.ts rename to packages/deno.ns/src/deno/stable/variables/errors.ts diff --git a/src/deno/stable/variables/mainModule.ts b/packages/deno.ns/src/deno/stable/variables/mainModule.ts similarity index 100% rename from src/deno/stable/variables/mainModule.ts rename to packages/deno.ns/src/deno/stable/variables/mainModule.ts diff --git a/src/deno/stable/variables/metrics.ts b/packages/deno.ns/src/deno/stable/variables/metrics.ts similarity index 100% rename from src/deno/stable/variables/metrics.ts rename to packages/deno.ns/src/deno/stable/variables/metrics.ts diff --git a/src/deno/stable/variables/noColor.ts b/packages/deno.ns/src/deno/stable/variables/noColor.ts similarity index 100% rename from src/deno/stable/variables/noColor.ts rename to packages/deno.ns/src/deno/stable/variables/noColor.ts diff --git a/src/deno/stable/variables/permissions.ts b/packages/deno.ns/src/deno/stable/variables/permissions.ts similarity index 100% rename from src/deno/stable/variables/permissions.ts rename to packages/deno.ns/src/deno/stable/variables/permissions.ts diff --git a/src/deno/stable/variables/pid.ts b/packages/deno.ns/src/deno/stable/variables/pid.ts similarity index 100% rename from src/deno/stable/variables/pid.ts rename to packages/deno.ns/src/deno/stable/variables/pid.ts diff --git a/src/deno/stable/variables/ppid.ts b/packages/deno.ns/src/deno/stable/variables/ppid.ts similarity index 100% rename from src/deno/stable/variables/ppid.ts rename to packages/deno.ns/src/deno/stable/variables/ppid.ts diff --git a/src/deno/stable/variables/resources.ts b/packages/deno.ns/src/deno/stable/variables/resources.ts similarity index 100% rename from src/deno/stable/variables/resources.ts rename to packages/deno.ns/src/deno/stable/variables/resources.ts diff --git a/src/deno/stable/variables/std.ts b/packages/deno.ns/src/deno/stable/variables/std.ts similarity index 100% rename from src/deno/stable/variables/std.ts rename to packages/deno.ns/src/deno/stable/variables/std.ts diff --git a/src/deno/stable/variables/version.ts b/packages/deno.ns/src/deno/stable/variables/version.ts similarity index 100% rename from src/deno/stable/variables/version.ts rename to packages/deno.ns/src/deno/stable/variables/version.ts diff --git a/src/deno/unstable/main.ts b/packages/deno.ns/src/deno/unstable/main.ts similarity index 87% rename from src/deno/unstable/main.ts rename to packages/deno.ns/src/deno/unstable/main.ts index c45570d..d919c5d 100644 --- a/src/deno/unstable/main.ts +++ b/packages/deno.ns/src/deno/unstable/main.ts @@ -60,3 +60,10 @@ export const utimeSync: typeof Deno.utimeSync = function (path, atime, mtime) { throw mapError(error); } }; + +export const sleepSync: typeof Deno.sleepSync = function ( + milliseconds: number, +) { + // https://github.com/sindresorhus/sleep-synchronously/blob/main/index.js + Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, milliseconds); +}; diff --git a/src/global.ts b/packages/deno.ns/src/global.ts similarity index 100% rename from src/global.ts rename to packages/deno.ns/src/global.ts diff --git a/src/hacks/web-streams.ts b/packages/deno.ns/src/hacks/web-streams.ts similarity index 100% rename from src/hacks/web-streams.ts rename to packages/deno.ns/src/hacks/web-streams.ts diff --git a/src/index.ts b/packages/deno.ns/src/index.ts similarity index 100% rename from src/index.ts rename to packages/deno.ns/src/index.ts diff --git a/src/package.json b/packages/deno.ns/src/package.json similarity index 100% rename from src/package.json rename to packages/deno.ns/src/package.json diff --git a/src/util/mod.test.ts b/packages/deno.ns/src/util/mod.test.ts similarity index 100% rename from src/util/mod.test.ts rename to packages/deno.ns/src/util/mod.test.ts diff --git a/src/util/mod.ts b/packages/deno.ns/src/util/mod.ts similarity index 100% rename from src/util/mod.ts rename to packages/deno.ns/src/util/mod.ts diff --git a/src/util/readlineSync.ts b/packages/deno.ns/src/util/readlineSync.ts similarity index 100% rename from src/util/readlineSync.ts rename to packages/deno.ns/src/util/readlineSync.ts diff --git a/packages/deno.ns/third_party/deno b/packages/deno.ns/third_party/deno new file mode 160000 index 0000000..ded7791 --- /dev/null +++ b/packages/deno.ns/third_party/deno @@ -0,0 +1 @@ +Subproject commit ded77918fbd324c6d4038127bfce60380d56397d diff --git a/thirdparty/package.json b/packages/deno.ns/third_party/package.json similarity index 95% rename from thirdparty/package.json rename to packages/deno.ns/third_party/package.json index 5ffd980..2ad7e5b 100644 --- a/thirdparty/package.json +++ b/packages/deno.ns/third_party/package.json @@ -1 +1 @@ -{ "type": "module" } +{ "type": "module" } diff --git a/tools/.vscode/settings.json b/packages/deno.ns/tools/.vscode/settings.json similarity index 100% rename from tools/.vscode/settings.json rename to packages/deno.ns/tools/.vscode/settings.json diff --git a/tools/denolib.ts b/packages/deno.ns/tools/denolib.ts similarity index 93% rename from tools/denolib.ts rename to packages/deno.ns/tools/denolib.ts index 74ebbe6..23d1b00 100644 --- a/tools/denolib.ts +++ b/packages/deno.ns/tools/denolib.ts @@ -17,7 +17,7 @@ const version = (await run("deno --version")).trim().split("\n").map((line) => ); await Deno.writeTextFile( - "src/deno/internal/version.ts", + `./src/deno/internal/version.ts`, [ `export const deno = "${version.deno}";\n`, `export const typescript = "${version.typescript}";\n`, @@ -25,11 +25,11 @@ await Deno.writeTextFile( ); await Deno.writeTextFile( - "src/deno/stable/lib.deno.d.ts", + `./src/deno/stable/lib.deno.d.ts`, removeDeclsFromStable(processDeclarationFileText(stableTypes)), ); await Deno.writeTextFile( - "src/deno/unstable/lib.deno.unstable.d.ts", + `./src/deno/unstable/lib.deno.unstable.d.ts`, processDeclarationFileText(unstableTypes), ); diff --git a/tools/deps.ts b/packages/deno.ns/tools/deps.ts similarity index 100% rename from tools/deps.ts rename to packages/deno.ns/tools/deps.ts diff --git a/tools/generateDeclarationFile.ts b/packages/deno.ns/tools/generateDeclarationFile.ts similarity index 92% rename from tools/generateDeclarationFile.ts rename to packages/deno.ns/tools/generateDeclarationFile.ts index 6e3b2fa..0de7387 100644 --- a/tools/generateDeclarationFile.ts +++ b/packages/deno.ns/tools/generateDeclarationFile.ts @@ -18,9 +18,7 @@ console.log("Generating declaration file..."); const statements: (StatementStructures | WriterFunction)[] = []; const declarationProject = getDeclarationProject(); -const indexFile = declarationProject.getSourceFileOrThrow( - "./dist/index.d.ts", -); +const indexFile = declarationProject.getSourceFileOrThrow(`./dist/index.d.ts`); // header statements.push((writer) => { @@ -57,9 +55,11 @@ statements.push({ name: `"deno.ns/test-internals"`, statements: [ ...Array.from( - fileExportsToStructures(declarationProject.getSourceFileOrThrow( - "./dist/deno/internal/test.d.ts", - )), + fileExportsToStructures( + declarationProject.getSourceFileOrThrow( + `./dist/deno/internal/test.d.ts`, + ), + ), ).map((s) => exportAndStripAmbient(s)), ], }); @@ -71,14 +71,14 @@ const newProject = new Project({ // limit to only node types types: ["node"], }, - tsConfigFilePath: "./tsconfig.json", + tsConfigFilePath: `./tsconfig.json`, skipAddingFilesFromTsConfig: true, manipulationSettings: { indentationText: IndentationText.TwoSpaces, }, }); const sourceFile = newProject.createSourceFile( - "./lib/deno.ns.lib.d.ts", + `./lib/deno.ns.lib.d.ts`, { statements }, { overwrite: true }, ); @@ -92,7 +92,7 @@ function getMainStatements() { // add some types from lib.deno.d.ts to make compiling happy const denoStableDeclFile = declarationProject.getSourceFileOrThrow( - "./src/deno/stable/lib.deno.d.ts", + `./src/deno/stable/lib.deno.d.ts`, ); statements.push(...[ "EventTarget", @@ -146,12 +146,12 @@ function getDenoNamespace(): ModuleDeclarationStructure { statements: [ ...Array.from( fileExportsToStructures(declarationProject.getSourceFileOrThrow( - "./dist/deno/stable/main.d.ts", + `./dist/deno/stable/main.d.ts`, )), ), ...Array.from( fileExportsToStructures(declarationProject.getSourceFileOrThrow( - "./dist/deno/unstable/main.d.ts", + `./dist/deno/unstable/main.d.ts`, )), ), ].map((s) => exportAndStripAmbient(s)), @@ -280,7 +280,7 @@ function getDeclarationProject() { compilerOptions: { declaration: true, }, - tsConfigFilePath: "./tsconfig.json", + tsConfigFilePath: `./tsconfig.json`, }); // exitIfDiagnostics(project, project.getPreEmitDiagnostics()); @@ -290,7 +290,7 @@ function getDeclarationProject() { }); const declarationProject = new Project({ - tsConfigFilePath: "./tsconfig.json", + tsConfigFilePath: `./tsconfig.json`, skipAddingFilesFromTsConfig: true, }); for (const item of dtsEmitResult.getFiles()) { @@ -298,9 +298,11 @@ function getDeclarationProject() { overwrite: true, }); } - declarationProject.addSourceFileAtPath("./src/deno/stable/lib.deno.d.ts"); declarationProject.addSourceFileAtPath( - "./src/deno/unstable/lib.deno.unstable.d.ts", + `./src/deno/stable/lib.deno.d.ts`, + ); + declarationProject.addSourceFileAtPath( + `./src/deno/unstable/lib.deno.unstable.d.ts`, ); return declarationProject; diff --git a/tools/missing.ts b/packages/deno.ns/tools/missing.ts old mode 100755 new mode 100644 similarity index 92% rename from tools/missing.ts rename to packages/deno.ns/tools/missing.ts index ff8120b..807bdf6 --- a/tools/missing.ts +++ b/packages/deno.ns/tools/missing.ts @@ -9,16 +9,16 @@ const ExitCodes = { } as const; const project = new Project({ - tsConfigFilePath: "./tsconfig.json", + tsConfigFilePath: `./tsconfig.json`, }); const typeChecker = project.getTypeChecker().compilerObject; -const entryPoint = project.addSourceFileAtPath("./src/deno.ts"); +const entryPoint = project.addSourceFileAtPath(`./src/deno.ts`); const implemented = new Set(entryPoint.getExportedDeclarations().keys()); -const stableMembers = getDenoMembersFromFile("./src/deno/stable/lib.deno.d.ts"); +const stableMembers = getDenoMembersFromFile(`./src/deno/stable/lib.deno.d.ts`); const unstableMembers = getDenoMembersFromFile( - "./src/deno/unstable/lib.deno.unstable.d.ts", + `./src/deno/unstable/lib.deno.unstable.d.ts`, ); outputInfo({ diff --git a/tools/run_tests.mjs b/packages/deno.ns/tools/run_tests.mjs similarity index 73% rename from tools/run_tests.mjs rename to packages/deno.ns/tools/run_tests.mjs index ce1e82e..97bae87 100644 --- a/tools/run_tests.mjs +++ b/packages/deno.ns/tools/run_tests.mjs @@ -1,4 +1,4 @@ -// This script runs the unit tests under thirdparty/deno directory +// This script runs the unit tests under third_party/deno directory import fs from "fs"; import { createRequire } from "module"; @@ -46,12 +46,18 @@ const testsToSkip = new Set([ "readFilePerm", // permissions "readFileDoesNotLeakResources", //TODO, rq: Deno.resources "readFileSyncDoesNotLeakResources", //TODO, rq: Deno.resources + "readFileWithAbortSignal", //TODO, rq: issue #64 + "readFileWithAbortSignalReason", //TODO, rq: issue #64 + "readFileWithAbortSignalPrimitiveReason", //TODO, rq: issue #64 // read_text_file_test "readTextFileSyncPerm", // permissions "readTextFilePerm", // permissions "readTextFileDoesNotLeakResources", //TODO, rq: Deno.resources "readTextFileSyncDoesNotLeakResources", //TODO, rq: Deno.resources + "readTextFileWithAbortSignal", //TODO, rq: issue #64 + "readTextFileWithAbortSignalReason", //TODO, rq: issue #64 + "readTextFileWithAbortSignalPrimitiveReason", //TODO, rq: issue #64 // read_dir_test "readDirSyncPerm", // permissions @@ -63,9 +69,16 @@ const testsToSkip = new Set([ // timers_test "clearTimeoutShouldConvertToNumber", // Timeout is an object, not a number "clearTimeoutShouldThrowWithBigint", // Timeout is an object, not a number - "sleepSync", // unstable - "sleepSyncLongerPromise", // unstable - "sleepSyncShorterPromise", // unstable + "callbackTakesLongerThanInterval", // Deno.sleepSync works differently than Atomics.wait unfortunately + "sleepSyncShorterPromise", // Deno.sleepSync works differently than Atomics.wait unfortunately + "sleepSyncLongerPromise", // Deno.sleepSync works differently than Atomics.wait unfortunately + "unrefTimer", // can't use execCode + "unrefTimer - mix ref and unref 1", // can't use execCode + "unrefTimer - mix ref and unref 2", // can't use execCode + "unrefTimer - unref interval", // can't use execCode + "unrefTimer - unref then ref 1", // can't use execCode + "unrefTimer - unref then ref", // can't use execCode + "unrefTimer - invalid calls do nothing", // todo: add unrefTimer "stringifyAndEvalNonFunctions", "testFunctionParamsLength", "timeoutBindThis", @@ -85,6 +98,10 @@ const testsToSkip = new Set([ "writeFileAbortSignalPreAborted", // implementation detail "writeFileSyncPerm", // permissions "writeFilePerm", // permissions + "writeFileAbortSignalReason", // TODO, rq: issue #65 + "writeFileAbortSignalPrimitiveReason", // TODO, rq: issue #65 + "writeFileAbortSignalReasonPreAborted", // TODO, rq: issue #65 + "writeFileAbortSignalPrimitiveReasonPreAborted", // TODO, rq: issue #65 // write_text_file_test "writeTextFileSyncPerm", // permissions @@ -149,8 +166,8 @@ async function setupTests() { globalThis.require = createRequire(import.meta.url); globalThis.__dirname = ""; - // let Deno tests access thirdparty/deno/cli/tests/fixture.json - process.chdir("thirdparty/deno/"); + // let Deno tests access third_party/deno/cli/tests/fixture.json + process.chdir("third_party/deno/"); await import("../src/global.ts"); } diff --git a/packages/deno.ns/tools/untested.sh b/packages/deno.ns/tools/untested.sh new file mode 100755 index 0000000..288c74c --- /dev/null +++ b/packages/deno.ns/tools/untested.sh @@ -0,0 +1,4 @@ +#!/bin/sh +set -eu + +ls third_party/deno/cli/tests/unit/*_test.ts | comm -3 - tools/working_test_files.txt diff --git a/packages/deno.ns/tools/working_test_files.txt b/packages/deno.ns/tools/working_test_files.txt new file mode 100644 index 0000000..9453f3a --- /dev/null +++ b/packages/deno.ns/tools/working_test_files.txt @@ -0,0 +1,26 @@ +src/deno/internal/streams.test.ts +src/deno/stable/functions/run.test.ts +third_party/deno/cli/tests/unit/abort_controller_test.ts +third_party/deno/cli/tests/unit/blob_test.ts +third_party/deno/cli/tests/unit/build_test.ts +third_party/deno/cli/tests/unit/copy_file_test.ts +third_party/deno/cli/tests/unit/dir_test.ts +third_party/deno/cli/tests/unit/error_stack_test.ts +third_party/deno/cli/tests/unit/event_target_test.ts +third_party/deno/cli/tests/unit/get_random_values_test.ts +third_party/deno/cli/tests/unit/io_test.ts +third_party/deno/cli/tests/unit/message_channel_test.ts +third_party/deno/cli/tests/unit/mkdir_test.ts +third_party/deno/cli/tests/unit/process_test.ts +third_party/deno/cli/tests/unit/read_file_test.ts +third_party/deno/cli/tests/unit/read_text_file_test.ts +third_party/deno/cli/tests/unit/sync_test.ts +third_party/deno/cli/tests/unit/testing_test.ts +third_party/deno/cli/tests/unit/timers_test.ts +third_party/deno/cli/tests/unit/truncate_test.ts +third_party/deno/cli/tests/unit/url_search_params_test.ts +third_party/deno/cli/tests/unit/url_test.ts +third_party/deno/cli/tests/unit/utime_test.ts +third_party/deno/cli/tests/unit/version_test.ts +third_party/deno/cli/tests/unit/write_file_test.ts +third_party/deno/cli/tests/unit/write_text_file_test.ts diff --git a/tsconfig.json b/packages/deno.ns/tsconfig.json similarity index 100% rename from tsconfig.json rename to packages/deno.ns/tsconfig.json diff --git a/src/deno/stable/functions/test.ts b/src/deno/stable/functions/test.ts deleted file mode 100644 index 48e625a..0000000 --- a/src/deno/stable/functions/test.ts +++ /dev/null @@ -1,27 +0,0 @@ -/// - -import { testDefinitions } from "../../internal/test.js"; - -export const test: typeof Deno.test = function test() { - let testDef: Deno.TestDefinition; - const firstArg = arguments[0]; - const secondArg = arguments[1]; - - if (typeof firstArg === "string") { - if (typeof secondArg !== "function") { - throw new TypeError("Missing test function"); - } - testDef = { name: firstArg, fn: secondArg }; - } else { - if (!firstArg?.fn) { - throw new TypeError("Missing test function"); - } - testDef = { ...firstArg }; - } - - if ((testDef.name?.length ?? 0) === 0) { - throw new TypeError("The test name can't be empty"); - } - - testDefinitions.push(testDef); -}; diff --git a/thirdparty/.vscode/settings.json b/thirdparty/.vscode/settings.json deleted file mode 100644 index e40716f..0000000 --- a/thirdparty/.vscode/settings.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "deno.enable": true, - "deno.lint": true, - "deno.unstable": true -} diff --git a/thirdparty/deno b/thirdparty/deno deleted file mode 160000 index fdf890a..0000000 --- a/thirdparty/deno +++ /dev/null @@ -1 +0,0 @@ -Subproject commit fdf890a68d3d54d40c766fd78faeccb20bd2e2c6 diff --git a/tools/hooks/pre-commit b/tools/hooks/pre-commit deleted file mode 100644 index 8737124..0000000 --- a/tools/hooks/pre-commit +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -set -eu - -git diff --diff-filter=d --cached --name-only -z -- '*.ts' \ - | xargs --null --no-run-if-empty deno lint -tools/missing.ts > PROGRESS.md -git add PROGRESS.md diff --git a/tools/untested.sh b/tools/untested.sh deleted file mode 100755 index 64dc24d..0000000 --- a/tools/untested.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -set -eu - -ls thirdparty/deno/cli/tests/unit/*_test.ts | comm -3 - tools/working_test_files.txt diff --git a/tools/working_test_files.txt b/tools/working_test_files.txt deleted file mode 100644 index cacd410..0000000 --- a/tools/working_test_files.txt +++ /dev/null @@ -1,26 +0,0 @@ -src/deno/internal/streams.test.ts -src/deno/stable/functions/run.test.ts -thirdparty/deno/cli/tests/unit/abort_controller_test.ts -thirdparty/deno/cli/tests/unit/blob_test.ts -thirdparty/deno/cli/tests/unit/build_test.ts -thirdparty/deno/cli/tests/unit/copy_file_test.ts -thirdparty/deno/cli/tests/unit/dir_test.ts -thirdparty/deno/cli/tests/unit/error_stack_test.ts -thirdparty/deno/cli/tests/unit/event_target_test.ts -thirdparty/deno/cli/tests/unit/get_random_values_test.ts -thirdparty/deno/cli/tests/unit/io_test.ts -thirdparty/deno/cli/tests/unit/message_channel_test.ts -thirdparty/deno/cli/tests/unit/mkdir_test.ts -thirdparty/deno/cli/tests/unit/process_test.ts -thirdparty/deno/cli/tests/unit/read_file_test.ts -thirdparty/deno/cli/tests/unit/read_text_file_test.ts -thirdparty/deno/cli/tests/unit/sync_test.ts -thirdparty/deno/cli/tests/unit/testing_test.ts -thirdparty/deno/cli/tests/unit/timers_test.ts -thirdparty/deno/cli/tests/unit/truncate_test.ts -thirdparty/deno/cli/tests/unit/url_search_params_test.ts -thirdparty/deno/cli/tests/unit/url_test.ts -thirdparty/deno/cli/tests/unit/utime_test.ts -thirdparty/deno/cli/tests/unit/version_test.ts -thirdparty/deno/cli/tests/unit/write_file_test.ts -thirdparty/deno/cli/tests/unit/write_text_file_test.ts