Giter Club home page Giter Club logo

denoify's Introduction

🦕 Release on NPM and on deno.land/x with a single codebase🦕

Home - Documentation - Demo repo

What it is

A build tool that takes as input a TypeScript codebase that was meant to target node and/or the web and spits out a modified version of the source files ready to be deployed as a Deno module.

what_denoify_does

NOTE: Denoify is capable of recursively resolving dependencies!
It works out of the box with dependencies that uses denoify and there are many option for dealing with dependencies that won't transpile automatically. See specific documentation

This tool is mainly for NPM module publisher, to enable them to bring first-class citizen Deno support to their modules and do so without introducing breaking changes.

Deno's Support for NPM Modules: What It Means and the Continued Relevance of Denoify

Deno now supports NPM modules.
This development significantly benefits NPM module authors as it simplifies the process of integrating their modules into Deno.
You simply instruct your users to import your module using the format: import {...} from "npm:your-module@5";.

However, even with this development, there are still compelling reasons to consider using Denoify for your module:

  1. Publishing on deno.land/x: If you aspire to have your module incorporated into other Deno modules, it is crucial to release a Deno-specific distribution. Without it, your chances of significant inclusion are considerably diminished.

  2. Ensuring Retro Compatibility: Denoify ensures your module remains compatible with earlier Deno versions lacking NPM support. This retro-compatibility broadens your module's user base and applicability.

  3. Tailoring Module Adaptations: Not all NPM modules (approximately 10%) will work seamlessly with Deno out of the box. In these cases, Denoify can aid in creating Deno-specific implementations for particular files within your module (xxx.deno.ts).

Therefore, despite Deno's new NPM support, Denoify continues to offer value in ensuring wider compatibility, adaptability, and visibility for your module.

Example of modules using Denoify

Some modules that have been made cross-runtime using Denoify:

Limitations

  • If your module is vanilla JS it needs to be ported to TypeScript first1.
  • require() is not supported.
  • You can't fs.readFile() files that are part of the module ( files inside a res/ directory for example ). 2

Get started

🚀 Quick start 🚀

Doing without Denoify

If your project doesn't have any dependencies and isn't utilizing Node built-ins (e.g., fs, https, process), you have an alternative to Denoify. You can make use of the TypeScript compiler options moduleResolution: bundler and allowImportingTsExtensions: true. For more information, see this comment.

Please note that this technique requires the addition of .ts extension to your source file imports. This could lead to potential compatibility issues with certain tools, and require an adjustment period.

What's new

NEW IN v1.6.0

  • Support for Deno environnement variable (Deno.env('XYZ')). Thank you to @dancrumb for this feature. See issue

NEW IN v1.3.1

NEW IN v1.3

  • Support for // @denoify-line-ignore special comment.

NEW IN v1

  • import express from "express"; automatically converted into:
    import express from "npm:express@5";
    (See this update)
    Most project will now transpile successfully out of the box.

NEW IN v0.10

  • Mitigate the risk of comment being accidentally modified.
  • Possibility to specify output directory in the package.json's denoify field. See doc.
  • Support module augmentation: declare module .... Example
  • Possibility to explicitly tell where the index.ts is located in the source. Doc

NEW IN v0.9

  • tsconfig.json can be absent if outputDir is specified. See @zxch3n's PR
  • Enable to configure the name of the output dir. It no longer has to be deno_dist. See @zxch3n's PR

NEW IN v0.7

  • Support for esm modules. See issue. Thanks to yandeu.

NEW IN v0.7

  • Support for workspaces where node_modules are located in a parent directory.
    Thx @hayes See issue
  • Add basic support for child_process.spawn (#785)

NEW IN v0.6

NEW IN v0.5 Breaking changes

  • All Denoify parameters are now gathered under a uniq "denoify" field.
  • Possibility to specify which files should be copied to the deno_dist directory (Previously only README.md was copied).
    Valid config example

Introduction video

NOTE: New features have been introduced since this meeting was hold

Watch the video

Footnotes

  1. Don't be afraid, renaming your source with .ts and dropping some any here and there will do the trick. You will be able to pull it off even if you aren't familiar with typescript. Ref

  2. In Deno the files that forms your module won’t be pre-fetched and placed in node_module like in node so you won’t be able to access files that are not on the disk.

denoify's People

Contributors

andreswebs avatar dancrumb avatar dependabot[bot] avatar domtheporcupine avatar garronej avatar geopic avatar gervinfung avatar gillkyle avatar hayes avatar ksxgithub avatar littledivy avatar marcushultman avatar renovate[bot] avatar yandeu avatar yusukebe avatar zxch3n avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

denoify's Issues

Change to deno.land/x subfolder

Currently, I'm using v0.3.8.

In >0.4.0, mod.ts will be placed inside deno_lib.

I guess I only have to append ?subdir=deno_lib%2F to the github hook in order to publish deno_lib/ to deno.land/x?

So instead of https://api.deno.land/webhook/gh/nano_jsx, it will be https://api.deno.land/webhook/gh/nano_jsx?subdir=deno_lib%2F?


Does deno_lib/ need to contain a README.md file? Will the README.md file inside deno_lib/ be visible on deno.land/x or the main readme file of the repository?

feat(config-file): provide support for config file

Hi sir, I thought that it might be a good idea to provide a config file as an alternative to specify the configs in package.json. We can specify .prettierrc or jest.config.js in addition to specify the configs through package.json. So we can have .denoify or .denoify.js etc. The main purpose is to not cloud package.json with a lot of stuffs

import process from "node:node:process";

So, it looks like there was an unexpected interaction between the new process handling code and the denoifyImportExportStatement code.

I denoified some code and got this line of code:

import process from "node:node:process";

I think part of the issue is that the test cases are mocking denoifyImportExportStatement, so this type of error slipped through.

How to denoify a ECMAScript modules package?

Hi

I'm trying to denoify a package that outputs only ESM code. But when I denoify it, the output is:

import { hello } from './feature.js/index.ts'

instead of

import { hello } from './feature.ts'

Any idea what I should change? Here is my repsitory.

Thanks a lot!

Does not work with yarn workspaces

Currently denoify does not work well with packages inside yarn workspaces because modules are mostly hoisted into the root node_modules directory.

getInstalledVersionPackageJsonFactory can't find these packages when they are hoisted.

One way to fix this would be to use require.resolve instead by doing something like:

return require.resolve(nodeModuleName, {paths: [projectPath]}).replace(/^(.*\/node_modules\/[^/]*).*/, '$1');

insttead of

return st.find_module_path(nodeModuleName, projectPath);

TODO

TODO LIST / Things that need to change

  • Improve documentation. (New website incoming)
  • Gather all imports in a /deps.ts oscarotero/nodedeno does.
  • Support baseUrl tsConfig option. (Import non relative path relative to baseUrl)
  • Support myModule.deno.ts alongside myModule.ts for deno specific implementation of part of the code. (Like in React Native)
  • Support custom import/export statements replacer.
  • 🔥 Leverage CDNs like Skypack (ex Pika) or jspm to support more NPM modules out of the box, feature side loading of type definitions.
  • Support .tsx

feature request: `--verbose` mode

it would be great to have a --verbose debug output so it would be possible to profile bottlenecks when denoifying node projects. for example, it took 17~25 seconds to convert this 800 loc program with 2 dependencies, which i believe to be bottlenecked by my configuration.

Details
$ tokei src/*
===============================================================================
 Language            Files        Lines         Code     Comments       Blanks
===============================================================================
 TypeScript              5          789          684           19           86
===============================================================================
 Total                   5          789          684           19           86
===============================================================================
$ time pnpm denoify
> [email protected] denoify /home/scarf/repo/etc/one-time-contribution/ts-rest-hono
> rimraf deno_dist && denoify && rimraf --glob 'deno_dist/**/*.test.ts'

Denoify is reading sources files from src
Configurations from /home/scarf/repo/etc/one-time-contribution/ts-rest-hono/denoify.config.js are used
Deno distribution will be generated at deno_dist

________________________________________________________
Executed in   17.93 secs    fish           external
   usr time    1.74 secs  260.00 micros    1.74 secs
   sys time    0.34 secs   96.00 micros    0.34 secs
$ cat denoify.config.js
// @ts-check

/** @type { import('denoify/lib/config/parseParams').DenoifyParams } */
const config = {
  out: 'deno_dist',
  index: './src/index.ts',
  ports: {
    zod: 'https://deno.land/x/zod/mod.ts',
    hono: 'https://deno.land/x/hono/mod.ts',
  },
}

module.exports = config

`export type * ` causing issues

I have some places where I'm re-exporting all types like this:

export type * from 'folderName'

The transformation leaves it untouched, and Deno doesn't like it.
When I manually transform it to the following it works:

export * from 'folderName/index.ts'

Now, in my case, it's not an issue to change this code to not use type, but AFAIK, TS will only export types when you do export type * from ... which can have a different result.

Add support for `Deno.env`

Calls to process.env should be relatively straightforward to transpile... at the very least, a process.env.XYZ => Deno.env('XYZ') mapping would help.

I'm happy to attempt a PR, once I get to know the codebase better

Node builtin modules with partial support can't be overridden with replacer or ports options

It looks like I'm getting node modules being replaced with DENOIFY: DEPENDENCY UNMET (BUILTIN), is there a config I'm missing to be able to set those to use the incomplete deno_std compat shims?
The README says these were supported in v0.11, but if I add an import dns from 'dns' to the demo repo with the updated denoify, with or without a manual port/replacement, it always generates import dns from 'dns DENOIFY: DEPENDENCY UNMET (BUILTIN)'.

My last update to my fork of the example repo contains an reproduction of this as well: https://github.com/josh-hemphill/my_dummy_npm_and_deno_module

`'C:\Program' is not recognized as an internal or external command`

$ npx denoify
C:\Users\Wojciech\AppData\Roaming\npm-cache\_npx\3560\node_modules\denoify\bin\denoify.js:6
process.once("unhandledRejection", error => { throw error; });
                                              ^

Error: Command failed: C:\Program Files\nodejs\node.exe C:\Users\Wojciech\AppData\Roaming\npm-cache\_npx\3560\node_modules\denoify\bin\replacer\index.js "import { Buffer } from \"buffer\"" 0.0.0 "deno_lib\\core\\network"
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.

    at ChildProcess.exithandler (child_process.js:303:12)
    at ChildProcess.emit (events.js:315:20)
    at maybeClose (internal/child_process.js:1051:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5) {
  killed: false,
  code: 1,
  signal: null,
  cmd: 'C:\\Program Files\\nodejs\\node.exe C:\\Users\\Wojciech\\AppData\\Roaming\\npm-cache\\_npx\\3560\\node_modules\\denoify\\bin\\replacer\\index.js "import { Buffer } from \\"buffer\\"" 0.0.0 "deno_lib\\\\core\\\\network"',
  stderr: "'C:\\Program' is not recognized as an internal or external command,\r\n" +
    'operable program or batch file.\r\n'
}

I believe the reason is creating a shell command by naive string concatenation:

denoify/src/lib/replacer.ts

Lines 103 to 106 in a81800d

return await st.exec(
`${
process.argv[0]
} ${

chore(format): setup prettier for more consistent formatting

Hey sir, the last time I cloned this repository I have to open vim to edit instead of neovim to edit it because my neovim was setup to auto format on save, which caused a lot of unnecessary changes as my formatting is setup differently. I believe that you have this feature enabled in your vscode as well as I see that you added .vscode to gitignore.

I think this project should have a .prettierrc file to provide a consistent formatting for all contributors to reduce unnecessary changes due to inconsistent formatting. If you are ok with it, I will make a PR for it and maybe we can discuss about the formatting, like which style do you prefer, etc.

Allow to ignore only one line

One of the packages I use, use polyfill for fetch, in Deno this is not necessary.
A perfect solution for that could be

// @denoify-line-ignore
import 'isomorphic-fetch';

This will make the work of the package more simple than create a Deno entry just to remove polyfill.
I believe that could benefit for more than one package.

The other solution found is to use a replacer and make it empty, that look less clean than allow ignoring one line.

Import from @/deepmerge DENOIFY: DEPENDENCY UNMET (BUILTIN)

See RebeccaStevens/deepmerge-ts#84 for the details.

The denoify output code is:

https://github.com/RebeccaStevens/deepmerge-ts/blob/0075d00a5fb8b905b390c8f91162760379dc41c5/dist/deno/types/options.ts#L1

Somehow the string "@/deepmerge DENOIFY: DEPENDENCY UNMET (BUILTIN)" ends up as the import file name, even though it should be ../deepmerge.ts which also exists. I tried upgrading denoify to the latest version but I see the same issue.

Sorry I can't provide more detail, I'm not very familiar with deno and have just discovered denoify, which is awesome by the way, thanks for making this!

Support paths?

TypeScript path mappings don't seem to be supported.

Config:

{
  "baseUrl": "./src",
  "paths": {
    "@/app": ["./index"],
  }
}

Source file:

import type { Foo } from "@/app";

Denoified file:

import type { Foo } from "@/app DENOIFY: DEPENDENCY UNMET (BUILTIN)";

Which files are copied to `deno_dist`?

This is a really cool project!

Just wondering which files are copied to deno_dist when the user runs denoify. It looks like README.md is... I would also love it if LICENSE and egg.json or egg.yml were copied.

Also, does running denoify merge output with the files in deno_dist or does it overwrite the whole directory?

Ideally, there would be some option where users could specify which files they wanted copied over.

does reflect-metadata work

Hey nice project!
Just tried to use it with one of my own: https://github.com/ovesco/diosaur
But it fails miserably with the following error:

C:\Users\Guillaume Hochet\Desktop\jshare\ddi\node_modules\denoify\bin\denoify.js:6
process.once("unhandledRejection", error => { throw error; });
                                              ^

TypeError [ERR_INVALID_ARG_TYPE]: The "to" argument must be of type string. Received type undefined
    at validateString (internal/validators.js:113:11)
    at Object.relative (path.js:438:5)
    at Object.isInsideOrIsDir (C:\Users\Guillaume Hochet\Desktop\jshare\ddi\node_modules\denoify\tools\isInsideOrIsDir.js:7:27)
    at Object.denoify (C:\Users\Guillaume Hochet\Desktop\jshare\ddi\node_modules\denoify\lib\denoify.js:29:28)
    at Object.<anonymous> (C:\Users\Guillaume Hochet\Desktop\jshare\ddi\node_modules\denoify\bin\denoify.js:15:11)
    at Module._compile (internal/modules/cjs/loader.js:1121:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1160:10)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:67:12) {
  code: 'ERR_INVALID_ARG_TYPE'
}

I believe it might be related to the use of reflect-metadata but didn't find any note about this in the readme, is it supported? Asking because I'm not sure if I should consider it a package to denoify before

Thanks!

Scoped packages not being passed to custom resolver

I was trying to work with the custom resolver to add all the polyfills/forks for packages, and realized it never resolved any of the namespaced packages.
I've been trying to see if I can get Tedious working in deno (since having mssql support in deno would be huge) and most of the dependencies work grabbing them from esm.sh, but the ones under @azure/ and @js-joda never come through the custom resolver for me to be able to replace.

Combined (`default` + `named`) imports not transformed

I've run into imports that try to import both the default and named imports at the same time, and they do not get transformed, resulting in extentionless imports in the deno code.
e.g. (from the Tedious package I'm trying to convert)

import metadataParse, { Metadata } from '../metadata-parser';
import Parser, { ParserOptions } from './stream-parser';
import { ColMetadataToken } from './token';

results in

import metadataParse, { Metadata } from '../metadata-parser';
import Parser, { ParserOptions } from './stream-parser';
import { ColMetadataToken } from './token.ts';

Here's the modifications to the example repo so you can observe: https://github.com/josh-hemphill/my_dummy_npm_and_deno_module

Ran up against GitHub api limits quickly

Is there a way to cache and/or disable the automated package resolution?
I was running denoify several times to see where I needed to add some more stuff, and really all I needed when testing was to check the data passing through the custom resolver, the rest had already been resolved.

Increase node fetch timeout

In Vietnam (slow to resolve links hosted in the US or Europe) I had many of theses:

 ✗ joseph @ MacBook-Pro ~/github/tsafe $ yarn build
yarn run v1.22.19
$ tsc && denoify
Denoify is reading sources files from src
Deno distribution will be generated at deno_dist

/Users/joseph/github/tsafe/node_modules/denoify/bin/denoify.js:7
    throw error;
    ^
FetchError: network timeout at: https://deno.land/[email protected]/node/fs.ts
    at Timeout.<anonymous> (/Users/joseph/github/tsafe/node_modules/node-fetch/lib/index.js:1484:13)
    at listOnTimeout (internal/timers.js:557:17)
    at processTimers (internal/timers.js:500:7) {
  type: 'request-timeout'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

is there a usecase for nodeify ?

Considering writing a package which does the other way around, thing is, I don't have a use case for that. Would it make sense to take a deno module and do what ever is needed to run in node ?

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

npm
package.json
  • @octokit/rest ^18.0.0
  • @types/comment-json ^1.1.1
  • commander ^4.1.1
  • comment-json ^3.0.2
  • tsafe ^0.10.1
  • get-github-default-branch-name ^0.0.4
  • gitignore-parser 0.0.2
  • glob ^7.1.6
  • node-fetch ^2.6.0
  • path-depth ^1.0.0
  • scripting-tools ^0.19.13
  • url-join ^4.0.1
  • evt ^2.3.1
  • @types/glob ^7.1.1
  • @types/js-yaml ^3.12.3
  • @types/node ^10.0.0
  • @types/node-fetch ^2.5.6
  • @types/url-join ^4.0.0
  • js-yaml ^3.13.1
  • typescript ^4.7.3

  • Check this box to trigger a request for Renovate to run again on this repository

Can this be used in Windows?

Hi 👋 ,
I am one of the maintainers of eta which uses denoify to create deno builds. When I try to attempt a build, it seems like denoify is running mkdir -p which then fails, because I believe on windows it doesn't recursively create the parent directories, it simply creates a directory called -p. I am wondering if you are going to use some alternatives to creating processes for these various actions.

Custom replacers should be passed the file path of the file the import was in

There doesn't seem to be any way to get the path of the file being worked on with in a custom replacer. Thus it makes it impossible to return a relative path for the import.

await makeThisModuleAnExecutableReplacer(
  ({ importExportStatement, parsedImportExportStatement, destDirPath }) => {
    const absolutePath = customAbsolutePathResolver(parsedImportExportStatement);
    const relativePath = path.relative("???????", absolutePath);
    const relativeImport = createImportString(parsedImportExportStatement, relativePath);
    return Promise.resolve(relativeImport);
  }
);

Open Source Software Stack for 3G

Hello, I am a student at Kocaeli University. I am looking for open source software stack for 3G like OpenAirInterface for 5G or Osmocom for 2G for my work. (Osmocom has partial support for 3G)

I request you to direct me to the right resource that may know.

Thanks for your time and interest.

Kind regards,

Ways to automatically discover Deno ports

It's not something that affects me directly yet, but I find it a curious and underexplored problem.

The situation may get exponentially better as more packages expose their Deno port in some way suitable for automation. Much better than trying to keep a hand-filled dictionary of ports.

I was considering make-deno-edition along with Denoify, and their attempts to address this problem is what made me aware and curious about this problem. Although their solutions don't fill me with confidence:

  • "deno" field in package.json pointing to an entry module takes the very basic and lucrative name and uses it for something very limited. I have a package with multiple exports and I wouldn't be able to describe it properly. Extended spec would be needed.

    Somehow I feel extending the "exports" section to accept "deno" key besides "import", "require", etc. would make much more sense. Although that may have compatibility issues.

    Much simpler use for "deno" field (if ever needed) would be just to serve in the same way as "denoify.out" does - to point at the folder where Deno-targeted code resides, without specifying an entry point (that can potentially be recovered from "exports" section). Or it could be an url to the port.

  • "editions" section seems descriptive for humans but not very actionable for automation. Extra layer of conventions would require on top of what already feels taking much more cognitive load compared to what it offers. (Maybe I just don't work with frontend to fully appreciate it though.)

Things that I think Denoify could do on it's own with package.json of dependency packages:

  • Check the presence of "denoify" section and "repository" section;
  • If https://deno.land/x can be searched by a repository name then you've got the port;
  • Or https://deno.land/x can be checked for the package name and then validated by the repository name to make sure it's the same package;
  • If "denoify.out" is available then it might be possible to check the repo for the presence of that folder and make use of it.

Cannot transform `import x, * as xs from "..."`

It's not a big deal, but Denoify currently fails to detect/transform imports with the following structure:

import x, * as xs from "..."

This is easily fixed by doing:

import { default as x } from "..."
import * as xs from "..."

But I think it should be considered a bug anyway.

denoify creates imports from comments

Denoifying a TypeScript file with a comment containing the word "Buffer" led to an output file importing the Buffer package, subsequently breaking our backend build.

See this commit for context.

Observed behaviour:

The word "Buffer" in a comment makes denoify create an import statement for Buffer.

Desired behaviour:

Denoify will not treat comments as code.

Cannot find a dependency in node_modules which is there

While running npx denoify on my project, I received the following error:
@noble/bls12-381 could not be found in the node_module directory seems like you needs to re-install your project dependency ( npm install )

@noble/bls12-381 is both in the package.json and the node_modules dir and I tried both npx and installing denoify locally.

MacOS 12.5.1, Node 16.15.1

Built-in module auto porting

I have a scenario. So, lets say your using node-fetch for your NodeJS version of your library, but you want to use the built-in fetch module in deno. Or lets say you use ws for nodejs and the built-in websocket module in deno. I currently have a very hacky solution

const isDeno = () => {
    // @ts-ignore
    try {
        window.fetch; 
        return true
    } catch { return false }
}
// @ts-ignore
const WebSocket = isDeno() ? window.WebSocket : require('ws')


...

Cons of this method is... I no longer get intellisense for the WebSocket variable.

I think something like this would be nice in ports

{
    "ports": {
        "ws": "builtins://WebSocket"
    }
}

IF this is possible this would be a huge help to me and my team.

Thanks!

README.md moved to deno_dist as subdirectory

I had been using v0.2.22 just fine on a project that I started a few months ago. I just upgraded to v0.5.5 and now when I run denoify I get an error that a subdirectory could not be removed.

Turns out denoify is copying my readme.md file as a directory within the deno_dist folder, rather than a file.

I'm running this on Windows 10.

Error: Cannot find module evt/tools/reducers/partition

I tried running [email protected] and got the following error:

> npx denoify@latest --help
node:internal/modules/cjs/loader:998
  throw err;
  ^

Error: Cannot find module 'evt/tools/reducers/partition'
Require stack:
- /home/jake/.npm/_npx/95a2b854abc4409b/node_modules/denoify/lib/denoify.js
- /home/jake/.npm/_npx/95a2b854abc4409b/node_modules/denoify/bin/denoify.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
    at Module._load (node:internal/modules/cjs/loader:841:27)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (/home/jake/.npm/_npx/95a2b854abc4409b/node_modules/denoify/lib/denoify.js:16:21)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Module._load (node:internal/modules/cjs/loader:878:12)
    at Module.require (node:internal/modules/cjs/loader:1061:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/jake/.npm/_npx/95a2b854abc4409b/node_modules/denoify/lib/denoify.js',
    '/home/jake/.npm/_npx/95a2b854abc4409b/node_modules/denoify/bin/denoify.js'
  ]
}

Node.js v18.11.0

Seems like const partition_1 = require("evt/tools/reducers/partition"); is failing in denoify.js. Is this a dependency we need to add somewhere?

For context I'm trying to use denoify against a package built with https://tsup.egoist.dev/

Accept URL imports

I may not be using denoify as intended because I had already replaced soms imports with URLs, so I got this:

import ipaddr from "https://jspm.dev/ipaddr.js DENOIFY: DEPENDENCY UNMET (BUILTIN)";

Error: Can't locate lib/adapters/http from {"type":"DENO.LAND URL","isStd":false,"baseUrlWithoutBranch":"https://deno.land/x/axiod","branch":"0.26.2","pathToIndex":"mod.ts"}

Can't lookup version 1.3.6 for module {"type":"DENO.LAND URL","isStd":false,"baseUrlWithoutBranch":"https://deno.land/x/axiod","branch":"0.26.2","pathToIndex":"mod.ts"}, falling back to 0.26.2
/Users/mashiro/Code/lib/megalodon/node_modules/denoify/bin/denoify.js:7
    throw error;
    ^

Error: Can't locate lib/adapters/http from {"type":"DENO.LAND URL","isStd":false,"baseUrlWithoutBranch":"https://deno.land/x/axiod","branch":"0.26.2","pathToIndex":"mod.ts"}
    at /Users/mashiro/Code/lib/megalodon/node_modules/denoify/lib/resolveNodeModuleToDenoModule/resolveNodeModuleToDenoModule.js:379:19
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async callee (/Users/mashiro/Code/lib/megalodon/node_modules/denoify/tools/addCache.js:19:33)
    at async denoifyImportExportStatement (/Users/mashiro/Code/lib/megalodon/node_modules/denoify/lib/denoifyImportExportStatement.js:77:26)
    at async /Users/mashiro/Code/lib/megalodon/node_modules/denoify/lib/denoifySingleFile.js:105:60
    at async Promise.all (index 0)
    at async replaceAsync (/Users/mashiro/Code/lib/megalodon/node_modules/denoify/tools/replaceAsync.js:12:18)
    at async denoifySingleFile (/Users/mashiro/Code/lib/megalodon/node_modules/denoify/lib/denoifySingleFile.js:104:38)
    at async transformSourceCodeString (/Users/mashiro/Code/lib/megalodon/node_modules/denoify/lib/denoify.js:96:39)
    at async transformCodebase (/Users/mashiro/Code/lib/megalodon/node_modules/denoify/tools/transformCodebase.js:13:49)

Node.js v18.16.0
Denoify 1.5.3

I just want to replace npm lib axios with deno lib axiod, my configuration:

// @ts-check

/** @type { import('denoify/lib/config/parseParams').DenoifyParams } */
const config = {
	ports: {
		axios: "https://deno.land/x/axiod/mod.ts"
	}
 }

module.exports = config;

related issue: #60

deno package registry api

Hello, with the new deno registration you can consult data to your api, after they deleted the database.json file our tool(trex) broke. i think this information can help mend denoify.

You can query the API as follows

this returns a json with the information of the first 20 packets

with a limit we can change the number of packages sent to us with a maximum of 100 packages

using query we can specify the name of the package and this will return the list of packages that match the name

You can also use the page parameter to specify the page, default is 1

I hope this information is helpful 🙂

Can't locate promises from {"type":"DENO.LAND URL ...}

So i am trying to denoify(v1.0.2) a forked project at https://github.com/waptik/epubgen and i'm getting the following error:

Denoify is reading sources files from lib
Deno distribution will be generated at deno_dist
/home/waptik/code/node/epubgen/node_modules/.pnpm/[email protected]/node_modules/denoify/bin/denoify.js:7
    throw error;
    ^

Error: Can't locate promises from {"type":"DENO.LAND URL","isStd":true,"baseUrlWithoutBranch":"https://deno.land/std","pathToIndex":"node/fs.ts"}
    at /home/waptik/code/node/epubgen/node_modules/.pnpm/[email protected]/node_modules/denoify/lib/resolveNodeModuleToDenoModule/resolveNodeModuleToDenoModule.js:374:19
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async callee (/home/waptik/code/node/epubgen/node_modules/.pnpm/[email protected]/node_modules/denoify/tools/addCache.js:19:33)
    at async denoifyImportExportStatement (/home/waptik/code/node/epubgen/node_modules/.pnpm/[email protected]/node_modules/denoify/lib/denoifyImportExportStatement.js:77:26)
    at async /home/waptik/code/node/epubgen/node_modules/.pnpm/[email protected]/node_modules/denoify/lib/denoifySingleFile.js:91:60
    at async Promise.all (index 0)
    at async replaceAsync (/home/waptik/code/node/epubgen/node_modules/.pnpm/[email protected]/node_modules/denoify/tools/replaceAsync.js:12:18)
    at async denoifySingleFile (/home/waptik/code/node/epubgen/node_modules/.pnpm/[email protected]/node_modules/denoify/lib/denoifySingleFile.js:90:38)
    at async transformSourceCodeString (/home/waptik/code/node/epubgen/node_modules/.pnpm/[email protected]/node_modules/denoify/lib/denoify.js:114:39)
    at async transformCodebase (/home/waptik/code/node/epubgen/node_modules/.pnpm/[email protected]/node_modules/denoify/tools/transformCodebase.js:13:49)


Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.