Skip to content

Commit

Permalink
v1.0.3 - support std/node/assert, fix multiline imports
Browse files Browse the repository at this point in the history
  • Loading branch information
balupton committed Aug 18, 2020
1 parent b839d2f commit 101863c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
7 changes: 6 additions & 1 deletion HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# History

## v1.0.3 2020 August 19

- Fixed multiline imports being ignored
- Added support for [std/node/assert polyfills that just landed](https://github.com/denoland/deno/issues/7102)

## v1.0.2 2020 August 18

- Fix `__dirname` detection (regression in v1.0.1)
- Fixed `__dirname` detection (regression in v1.0.1)

## v1.0.1 2020 August 18

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "make-deno-edition",
"version": "1.0.2",
"version": "1.0.3",
"description": "Automatically makes package.json projects (such as npm packages and node.js modules) compatible with Deno.",
"homepage": "https://github.com/bevry/make-deno-edition",
"license": "MIT",
Expand Down
9 changes: 5 additions & 4 deletions source/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,12 @@ const perms: string[] = [
'write',
]

// test ground: https://repl.it/@balupton/match-import#index.js
const importRegExp = /^(?:import|export) .+? from ['"]([^'"]+)['"]$/gms

// https://deno.land/std/node
const builtins: { [key: string]: boolean | string } = {
assert: false,
assert: true,
buffer: true,
child_process: false,
cluster: false,
Expand Down Expand Up @@ -193,9 +196,7 @@ export function convert(path: string, details: Details): File {
const file = details.files[path]

// extract imports
const matches = file.source.matchAll(
/^(?:import|export) .+? from ['"]([^'"]+)['"]$/gm
)
const matches = file.source.matchAll(importRegExp)
for (const match of matches) {
const i: Import = {
type: null,
Expand Down

0 comments on commit 101863c

Please sign in to comment.