import { deno2node } from "https://deno.land/x/deno2node@v1.14.0/src/deno2node.ts";
Attempts to transform arbitrary ctx.project
into a valid Node.js project:
-
Changes import specifiers to be Node-friendly:
- changes extension in relative specifiers to
.js
, - replaces some
https://
imports with bare specifiers.
- changes extension in relative specifiers to
-
Changes
*.deno.js
imports specifiers to*.node.js
(import './deps.deno.ts'
->import './deps.node.js'
). This can be used for re-exporting dependencies and other runtime-specific code. -
Rewrites remaining https: imports to point into
vendorDir
, if specified:// @filename: tsconfig.json { "deno2node": { "vendorDir": "src/.deno2node/vendor/" } }
-
Imports Node.js shims for Deno globals from shim file, if specified:
// @filename: tsconfig.json { "deno2node": { "shim": "src/shim.node.ts" } }
Parameters
ctx: Context