Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/package/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class Package {
paths.push(...['./browser-', './node-'].map(n => n + rel.slice(2)))
}
}
const code = paths.map(p => `import("${p}")`).join('\n')
const code = paths.map(p => `import("${p.replace(/\\/g, '/')}")`).join('\n')
const input = new URL(dist + '/esm/_ipjsInput.js')
await writeFile(input, code)
const onwarn = warning => {
Expand Down
3 changes: 0 additions & 3 deletions src/path-to-url.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// adapted from https://nodejs.org/api/path.html#path_path_resolve_paths
const CHAR_FORWARD_SLASH = '/'
const percentRegEx = /%/g
const backslashRegEx = /\\/g
const newlineRegEx = /\n/g
const carriageReturnRegEx = /\r/g
const tabRegEx = /\t/g
Expand All @@ -18,8 +17,6 @@ export default (filepath, cwd) => {
resolved[resolved.length - 1] !== '/') { resolved += '/' }
const outURL = new URL('file://')
if (resolved.includes('%')) { resolved = resolved.replace(percentRegEx, '%25') }
// In posix, "/" is a valid character in paths
if (resolved.includes('\\')) { resolved = resolved.replace(backslashRegEx, '%5C') }
if (resolved.includes('\n')) { resolved = resolved.replace(newlineRegEx, '%0A') }
if (resolved.includes('\r')) { resolved = resolved.replace(carriageReturnRegEx, '%0D') }
if (resolved.includes('\t')) { resolved = resolved.replace(tabRegEx, '%09') }
Expand Down