parcel-bundler / source-map Goto Github PK
View Code? Open in Web Editor NEWA fast source map manipulation, generation and consumption library written in Rust and Node.js
A fast source map manipulation, generation and consumption library written in Rust and Node.js
after succesful installing on arm i get a undefined symbol error in sourcemap.node
just demo
cat package.json
{
"name": "parcel2-demo",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {},
"scripts": {
"start": "parcel serve ./src/index.html",
"build": "parcel build ./src/index.html"
},
"devDependencies": {
"parcel": "^2.0.0-beta.1"
}
}
should build
doesn‘t build, fails with:
$ parcel build ./src/index.html
internal/modules/cjs/loader.js:1127
return process.dlopen(module, path.toNamespacedPath(filename));
^
Error: /home/thomas/git/parcel2-demo/node_modules/@parcel/source-map/build/Release/sourcemap.node: undefined symbol: _ZN4Napi7details31needs_objectwrap_destructor_fixE
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1127:18)
at Module.load (internal/modules/cjs/loader.js:941:32)
at Function.Module._load (internal/modules/cjs/loader.js:782:14)
at Module.require (internal/modules/cjs/loader.js:965:19)
at require (internal/modules/cjs/helpers.js:88:18)
at load (/home/thomas/git/parcel2-demo/node_modules/node-gyp-build/index.js:21:10)
at Object. (/home/thomas/git/parcel2-demo/node_modules/@parcel/source-map/dist/node.js:14:43)
at Module._compile (internal/modules/cjs/loader.js:1076:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:941:32)
error Command failed with exit code 1.
i run code-server on a raspi4 and try some PoCs there sometimes, this time i wanted to try out parcel2
Software | Version(s) |
---|---|
Parcel | 2.0.0 beta 1 |
Node | 14.11.0 |
npm/Yarn | yarn 1.22.5 |
Operating System | Arch Linux ARM |
Non-ASCII characters aren't handled correctly:
const SourceMap = require("@parcel/source-map").default;
const s = new SourceMap();
s.addSource("dist/rörfokus/4784.js")
console.log(s)
thread '<unnamed>' panicked at 'byte index 7 is not a char boundary; it is inside 'ö' (bytes 6..8) of `dist/rörfokus/4784.js`', parcel_sourcemap/src/utils.rs:59:60
source-map/parcel_sourcemap/src/utils.rs
Lines 59 to 61 in 32401c9
This seems to be a better solution:
https://doc.rust-lang.org/std/string/struct.String.html#method.strip_prefix
There's a mention of a Makefile
and emscripten
but I believe these were removed in #52
This issue is mainly cause by duplicated source in a SourceMap, which I believe there is an error on the VLQMap genearted by other compiler, however the SourceMap v3 specification does not stated which as an variant.
follow the step in this repository.
https://github.com/h-a-n-a/issue_1208_parcel_sourcemap_vlq
It looks like the main issue is caused by a memoization mechanism in this function and this function throws as index is larger than the length of sources.
hi! the main parcel package.json supports >= 12 but this one is:
"engines": {
"node": "^12.18.3 || >=14"
},
unfortunately, at work we're on 12.18.2 so i'm unable to install parcel at all. should this align with the main parcel package?
When a VLQ Map's contains a File URL in the map's sources
array, this module should preserve the "file://" URL scheme. Currently, it will strip the scheme and the leading slash, making it impossible for browsers to resolve correctly.
Relevance: By default, dart-sass generates file URLs. Which makes sense, because it's referring to files on the disk, not hosted files. This module mutilates the URL. Which means it will generate two sources for one file.
Before
{
version: 3,
sources: [
"file:///home/binyamin/fake/style.scss"
],
// ... rest of source-map
}
After
{
version: 3,
sources: [
"home/binyamin/fake/style.scss"
],
// ... rest of source-map
}
Hi there,
I got recently this issue and I can't understand where the issue is coming from.
The transformer code is quite trivial so any help will be really appreciated.
Steps to reproduce the issue:
https://github.com/riot/parcel-transformer-riot/tree/bug/22-sourcemap-out-of-range
npm i
npm test
Thank you and have a great day.
I have just installed parcel (npm i -D parcel
) and got the error Error: Cannot find module '../parcel_sourcemap_node/index'
(see below) when running npx parcel build
.
After some investigation, I found that the error happens only with the newest @parcel/source-map
version 2.0.4
.
Fixing it temporarily with "@parcel/source-map": "2.0.2",
in package.json
works.
Node Version used: v16.15.0
Parcel Version used: 2.5.0
and 2.4.0
(same error)
Error: Cannot find module '../parcel_sourcemap_node/index'
Require stack:
- /path/to/project/node_modules/@parcel/source-map/dist/node.js
- /path/to/project/node_modules/@parcel/utils/lib/index.js
- /path/to/project/node_modules/@parcel/core/lib/public/Config.js
- /path/to/project/node_modules/@parcel/core/lib/utils.js
- /path/to/project/node_modules/@parcel/core/lib/public/Environment.js
- /path/to/project/node_modules/@parcel/core/lib/public/Asset.js
- /path/to/project/node_modules/@parcel/core/lib/Parcel.js
- /path/to/project/node_modules/@parcel/core/lib/index.js
- /path/to/project/node_modules/parcel/lib/cli.js
- /path/to/project/node_modules/parcel/lib/bin.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (/path/to/project/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
at Object.<anonymous> (/path/to/project/node_modules/@parcel/source-map/dist/node.js:14:18)
at Module._compile (/path/to/project/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/path/to/project/node_modules/@parcel/source-map/dist/node.js',
'/path/to/project/node_modules/@parcel/utils/lib/index.js',
'/path/to/project/node_modules/@parcel/core/lib/public/Config.js',
'/path/to/project/node_modules/@parcel/core/lib/utils.js',
'/path/to/project/node_modules/@parcel/core/lib/public/Environment.js',
'/path/to/project/node_modules/@parcel/core/lib/public/Asset.js',
'/path/to/project/node_modules/@parcel/core/lib/Parcel.js',
'/path/to/project/node_modules/@parcel/core/lib/index.js',
'/path/to/project/node_modules/parcel/lib/cli.js',
'/path/to/project/node_modules/parcel/lib/bin.js'
]
}
No prebuilds are included for Windows in "2.0.0-alpha.4.19" which causes my workflow to break.
> @parcel/[email protected] install D:\a\linter-ui-default\linter-ui-default\node_modules\@parcel\source-map
> node-gyp-build
D:\a\linter-ui-default\linter-ui-default\node_modules\@parcel\source-map>if not defined npm_config_node_gyp (node "D:\a\_temp\atom\Atom\resources\app\apm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "D:\a\_temp\atom\Atom\resources\app\apm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
npm WARN deprecated [email protected]: Version no longer supported. Upgrade to @latest
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
gyp ERR! find VS
gyp ERR! find VS msvs_version was set from command line or npm config
gyp ERR! find VS - looking for Visual Studio version 2015
gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp ERR! find VS checking VS2019 (16.8.30717.126) found at:
gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise"
gyp ERR! find VS - found "Visual Studio C++ core features"
gyp ERR! find VS - found VC++ toolset: v142
gyp ERR! find VS - found Windows SDK: 10.0.19041.0
gyp ERR! find VS - msvs_version does not match this version
gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
gyp ERR! find VS looking for Visual Studio 2015
gyp ERR! find VS - found in "C:\Program Files (x86)\Microsoft Visual Studio 14.0"
gyp ERR! find VS - could not find MSBuild in registry for this version
gyp ERR! find VS looking for Visual Studio 2013
gyp ERR! find VS - not found
gyp ERR! find VS
gyp ERR! find VS valid versions for msvs_version:
gyp ERR! find VS - "2019"
gyp ERR! find VS - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise"
gyp ERR! find VS
gyp ERR! find VS **************************************************************
gyp ERR! find VS You need to install the latest version of Visual Studio
gyp ERR! find VS including the "Desktop development with C++" workload.
gyp ERR! find VS For more information consult the documentation at:
gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
gyp ERR! find VS **************************************************************
gyp ERR! find VS
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Visual Studio installation to use
gyp ERR! stack at VisualStudioFinder.fail (D:\a\_temp\atom\Atom\resources\app\apm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
gyp ERR! stack at D:\a\_temp\atom\Atom\resources\app\apm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16
gyp ERR! stack at D:\a\_temp\atom\Atom\resources\app\apm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:372:16
gyp ERR! stack at D:\a\_temp\atom\Atom\resources\app\apm\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7
gyp ERR! stack at D:\a\_temp\atom\Atom\resources\app\apm\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
gyp ERR! stack at ChildProcess.exithandler (child_process.js:297:5)
gyp ERR! stack at ChildProcess.emit (events.js:200:13)
gyp ERR! stack at maybeClose (internal/child_process.js:1021:16)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "D:\\a\\_temp\\atom\\Atom\\resources\\app\\apm\\bin\\node.exe" "D:\\a\\_temp\\atom\\Atom\\resources\\app\\apm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\a\linter-ui-default\linter-ui-default\node_modules\@parcel\source-map
gyp ERR! node -v v12.4.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm WARN notsup Unsupported engine for @parcel/[email protected]: wanted: {"node":"^10 || ^12.18.3 || >=14"} (current: {"node":"12.4.0","npm":"6.14.8"})
npm WARN notsup Not compatible with your version of node/npm: @parcel/[email protected]
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @parcel/[email protected] install: `node-gyp-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @parcel/[email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\npm\cache\_logs\2020-12-14T02_18_02_399Z-debug.log
I am trying to run a simple typescript project using parcel on Windows. here is my package.json
file.
{
"name": "maps",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "parcel src/index.html",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"parcel": "^2.10.0"
}
}
I've already installed VC_redist.x64
.
But sill when I run npm start
. I get the following error:
> [email protected] start
> parcel src/index.html
Error: Cannot find module './artifacts/index.win32-ia32-msvc.node'
Require stack:
- C:\Users\x\working\maps\node_modules\@parcel\source-map\parcel_sourcemap_node\index.js
- C:\Users\x\working\maps\node_modules\@parcel\source-map\dist\node.js
- C:\Users\x\working\maps\node_modules\@parcel\utils\lib\index.js
- C:\Users\x\working\maps\node_modules\@parcel\core\lib\public\Config.js
- C:\Users\x\working\maps\node_modules\@parcel\core\lib\utils.js
- C:\Users\x\working\maps\node_modules\@parcel\core\lib\public\Environment.js
- C:\Users\x\working\maps\node_modules\@parcel\core\lib\public\Asset.js
- C:\Users\x\working\maps\node_modules\@parcel\core\lib\Parcel.js
- C:\Users\x\working\maps\node_modules\@parcel\core\lib\index.js
- C:\Users\x\working\maps\node_modules\parcel\lib\cli.js
- C:\Users\x\working\maps\node_modules\parcel\lib\bin.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
at Module._load (node:internal/modules/cjs/loader:922:27)
at Module.require (node:internal/modules/cjs/loader:1143:19)
at require (node:internal/modules/cjs/helpers:110:18)
at Object.<anonymous> (C:\Users\x\working\maps\node_modules\@parcel\source-map\parcel_sourcemap_node\index.js:15:18)
at Module._compile (node:internal/modules/cjs/loader:1256:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Module.require (node:internal/modules/cjs/loader:1143:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\x\\working\\maps\\node_modules\\@parcel\\source-map\\parcel_sourcemap_node\\index.js',
'C:\\Users\\x\\working\\maps\\node_modules\\@parcel\\source-map\\dist\\node.js',
'C:\\Users\\x\\working\\maps\\node_modules\\@parcel\\utils\\lib\\index.js',
'C:\\Users\\x\\working\\maps\\node_modules\\@parcel\\core\\lib\\public\\Config.js',
'C:\\Users\\x\\working\\maps\\node_modules\\@parcel\\core\\lib\\utils.js',
'C:\\Users\\x\\working\\maps\\node_modules\\@parcel\\core\\lib\\public\\Environment.js',
'C:\\Users\\x\\working\\maps\\node_modules\\@parcel\\core\\lib\\public\\Asset.js',
'C:\\Users\\x\\working\\maps\\node_modules\\@parcel\\core\\lib\\Parcel.js',
'C:\\Users\\x\\working\\maps\\node_modules\\@parcel\\core\\lib\\index.js',
'C:\\Users\\x\\working\\maps\\node_modules\\parcel\\lib\\cli.js',
'C:\\Users\\x\\working\\maps\\node_modules\\parcel\\lib\\bin.js'
]
}
There is currently no way to get the sourcfile with findClosestMapping
(only the index).
Lines 110 to 112 in a09800c
Two options:
IndexedMapping<string>
because this function isn't used in performance-critical code (right?)getSource(index: number): string
as a counterpart for getSourceIndex(source: string): number
(and same for name).Note: Coming from parcel-bundler/lightningcss#219
I haven't been able to get this module working for Deno
import type
) with a .js
extension. Deno can't read it properlyrequire
), but Deno uses ESM (import
)Hi, I noticed in order to use @parcel/source-map
in browser environment, I need to wait for init
before usage.
import { default as SourceMap, init } from '@parcel/source-map';
await init; // init wasm binary
// Then start using SourceMap.
Two questions here:
init
is not provided by the typings in index.d.ts
. That will trouble TypeScript users.init
without asking user to do it?init
in src/wasm.js
.init
is exported but is effectively a noop. Let the lib waits on init
(and also remove init
from export) can normalise the usage in Nodejs and browser.In one of the projects we use Parcel, but for some reason, Appveyor x86 fails to build the native modules with this error:
error LNK2001: unresolved external symbol "struct std::atomic<bool> Napi::details::needs_objectwrap_destructor_fix"
More details:
atom-community/zadeh#15
https://ci.appveyor.com/project/aminya/fuzzaldrin-plus-fast-se2je
> node-gyp-build
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
nothing.c
win_delay_load_hook.cc
nothing.vcxproj -> C:\projects\fuzzaldrin-plus-fast-se2je\node_modules\@parcel\source-map\build\Release\\nothing.lib
SourceMap.cpp
MappingContainer.cpp
MappingLine.cpp
Mapping.cpp
win_delay_load_hook.cc
Creating library C:\projects\fuzzaldrin-plus-fast-se2je\node_modules\@parcel\source-map\build\Release\sourcemap.lib and object C:\projects\fuzzaldrin-plus-fast-se2je\node_modules\@parcel\source-map\build\Release\sourcemap.exp
SourceMap.obj : error LNK2001: unresolved external symbol "struct std::atomic<bool> Napi::details::needs_objectwrap_destructor_fix" (?needs_objectwrap_destructor_fix@details@Napi@@3U?$atomic@_N@std@@A) [C:\projects\fuzzaldrin-plus-fast-se2je\node_modules\@parcel\source-map\build\sourcemap.vcxproj]
C:\projects\fuzzaldrin-plus-fast-se2je\node_modules\@parcel\source-map\build\Release\sourcemap.node : fatal error LNK1120: 1 unresolved externals [C:\projects\fuzzaldrin-plus-fast-se2je\node_modules\@parcel\source-map\build\sourcemap.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\projects\fuzzaldrin-plus-fast-se2je\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:314:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\projects\\fuzzaldrin-plus-fast-se2je\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\projects\fuzzaldrin-plus-fast-se2je\node_modules\@parcel\source-map
gyp ERR! node -v v14.6.0
gyp ERR! node-gyp -v v6.1.0
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"ia32"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @parcel/source-map@2.0.0-alpha.4.13 install: `node-gyp-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @parcel/source-map@2.0.0-alpha.4.13 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\appveyor\AppData\Roaming\npm-cache\_logs\2020-09-02T05_31_48_721Z-debug.log
Command exited with code 1
I tried to bundle @parcel/source-map
in an app to run in browser,
Cannot find module '../parcel_sourcemap_wasm/dist-web/parcel_sourcemap_wasm.js' from
'...../node_modules/@parcel/source-map/dist/wasm-bindings-web.js'
The file parcel_sourcemap_wasm/dist-web/parcel_sourcemap_wasm.js
was not in the @parcel/source-map
npm package current version v2.0.2.
It does contain the Rust source code in parcel_sourcemap_wasm/src
. Is the compiled js code missed?
Trying to concat "hello "
and "world"
in a single line, the minimal reproduce is here:
#[test]
fn reproduce() {
let mut hello_map = SourceMap::new("/");
let hello = hello_map.add_source("hello.txt");
hello_map.set_source_content(hello as usize, "hello ");
hello_map.add_mapping(
0,
0,
Some(parcel_sourcemap::OriginalLocation {
original_line: 0,
original_column: 0,
source: hello,
name: None,
}),
);
let mut world_map = SourceMap::new("/");
let world = world_map.add_source("world.txt");
world_map.set_source_content(world as usize, "world");
world_map.add_mapping(
0,
0,
Some(parcel_sourcemap::OriginalLocation {
original_line: 0,
original_column: 0,
source: world,
name: None,
}),
);
let mut hello_world_map = SourceMap::new("/");
hello_world_map.add_sourcemap(&mut hello_map, 0);
hello_world_map.add_sourcemap(&mut world_map, 0);
println!("{}", hello_world_map.to_json(None).unwrap()); // {"version":3,"sourceRoot":null,"mappings":"ACAA","sources":["hello.txt","world.txt"],"sourcesContent":["hello ","world"],"names":[]}
}
generated map: {"version":3,"sourceRoot":null,"mappings":"ACAA","sources":["hello.txt","world.txt"],"sourcesContent":["hello ","world"],"names":[]} }
.
generated string: hello world
.
"hello "
will loose the mapping, "world"
will map to "hello world"
.
Node crashes when parcel 2 (beta.2). I am currently trying to update a legacy app to use parcel, so I have some dependency within my repo (via bower).
Node Version 14.14.0 running on MacOS Big Sur 11.2.1 (20D74)
I set the CI=true
env var in order to get a list:
- Building preprocess.html...
- Building main.preprocess.scss...
- Building can.js...
- Building can.jquery.js...
- Building header.js...
- Building category-slider.js...
- Building footer.js...
- Building html5-video-preview.js...
- Building movie-cover.js...
- Building isInViewport.js...
FATAL ERROR: Error::New napi_get_last_error_info
1: 0x1012d84c5 node::Abort() (.cold.1) [$USER/.nvm/versions/node/v14.14.0/bin/node]
2: 0x1000a5d59 node::Abort() [$USER/.nvm/versions/node/v14.14.0/bin/node]
3: 0x1000a5ebf node::OnFatalError(char const*, char const*) [$USER/.nvm/versions/node/v14.14.0/bin/node]
4: 0x1000a5d69 node::FatalError(char const*, char const*) [$USER/.nvm/versions/node/v14.14.0/bin/node]
5: 0x10007bb4d napi_fatal_error [$USER/.nvm/versions/node/v14.14.0/bin/node]
6: 0x10903c31a [$PROJECT/node_modules/@parcel/source-map/prebuilds/darwin-x64/node.napi.glibc.node]
7: 0x109041bc7 napi_register_module_v1 [$PROJECT/node_modules/@parcel/source-map/prebuilds/darwin-x64/node.napi.glibc.node]
8: 0x10903cef4 SourceMapBinding::addRawMappings(Napi::CallbackInfo const&) [$PROJECT/node_modules/@parcel/source-map/prebuilds/darwin-x64/node.napi.glibc.node]
9: 0x10903d1ff SourceMapBinding::_addNames(Napi::Array&) [$PROJECT/node_modules/@parcel/source-map/prebuilds/darwin-x64/node.napi.glibc.node]
10: 0x10903c9f9 SourceMapBinding::addRawMappings(Napi::CallbackInfo const&) [$PROJECT/node_modules/@parcel/source-map/prebuilds/darwin-x64/node.napi.glibc.node]
11: 0x109042922 Napi::InstanceWrap<SourceMapBinding>::InstanceVoidMethodCallbackWrapper(napi_env__*, napi_callback_info__*) [$PROJECT/node_modules/@parcel/source-map/prebuilds/darwin-x64/node.napi.glibc.node]
12: 0x10904289a Napi::InstanceWrap<SourceMapBinding>::InstanceVoidMethodCallbackWrapper(napi_env__*, napi_callback_info__*) [$PROJECT/node_modules/@parcel/source-map/prebuilds/darwin-x64/node.napi.glibc.node]
13: 0x10006373a v8impl::(anonymous namespace)::FunctionCallbackWrapper::Invoke(v8::FunctionCallbackInfo<v8::Value> const&) [$USER/.nvm/versions/node/v14.14.0/bin/node]
14: 0x100258938 v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo) [$USER/.nvm/versions/node/v14.14.0/bin/node]
15: 0x100257ecc v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<false>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [$USER/.nvm/versions/node/v14.14.0/bin/node]
16: 0x100257632 v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [$USER/.nvm/versions/node/v14.14.0/bin/node]
17: 0x100a70a99 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit [$USER/.nvm/versions/node/v14.14.0/bin/node]
18: 0x100a09d62 Builtins_InterpreterEntryTrampoline [$USER/.nvm/versions/node/v14.14.0/bin/node]
Maybe there is something in isInViewport that breaks it, but removing the import will lead to it crashing later. More specifically, rerunning it will lead to it crashing at different times/files.
Unfortunately, I cannot provide a minimal reproduction example. But I could add somebody to the private repository where the error occurs.
Ensure this package also runs on M1 Macs, besides this also build binaries for these devices and publish them in a new release.
This is also affecting M1 Macs running node 15.3.0 or possibly linked to parcel-bundler/parcel#5046
Originally posted by @WA9ACE in #33 (comment)
TODO:
https://github.com/parcel-bundler/parcel/pull/4313/checks?check_run_id=543074718#step:3:366
FATAL ERROR: Error::Error napi_create_reference
1: 0x9bcb80 node::Abort() [/usr/local/bin/node]
2: 0x9bdd16 node::OnFatalError(char const*, char const*) [/usr/local/bin/node]
3: 0x9bde09 [/usr/local/bin/node]
4: 0x99600b napi_fatal_error [/usr/local/bin/node]
5: 0x7f4f742c75b6 [/usr/src/app/.tmp/parcel-v2/node_modules/@parcel/source-map/build/Release/sourcemap.node]
6: 0x7f4f742c780f Napi::Error::New(napi_env__*) [/usr/src/app/.tmp/parcel-v2/node_modules/@parcel/source-map/build/Release/sourcemap.node]
7: 0x7f4f742c8627 Napi::Object::Get(char const*) const [/usr/src/app/.tmp/parcel-v2/node_modules/@parcel/source-map/build/Release/sourcemap.node]
8: 0x7f4f742bee02 SourceMapBinding::addIndexedMappings(Napi::CallbackInfo const&) [/usr/src/app/.tmp/parcel-v2/node_modules/@parcel/source-map/build/Release/sourcemap.node]
9: 0x7f4f742c8d98 Napi::ObjectWrap<SourceMapBinding>::InstanceVoidMethodCallbackWrapper(napi_env__*, napi_callback_info__*) [/usr/src/app/.tmp/parcel-v2/node_modules/@parcel/source-map/build/Release/sourcemap.node]
10: 0x9770e5 [/usr/local/bin/node]
11: 0xb8466c [/usr/local/bin/node]
12: 0xb86477 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/usr/local/bin/node]
13: 0x134e979 [/usr/local/bin/node]
Aborted (core dumped)
It didn't happen locally for me so far.
Maybe this happens because the Get()
calls here
Lines 409 to 424 in 44b5a71
{
"scripts": {
"postinstall": "yarn run start",
"start": "parcel serve index.html",
"dev": "parcel serve index.html & parcel watch src/index.js",
"build": "NODE_ENV=production parcel build src/index.js -d dist/jquery.pdf.js"
},
"targets":{
"app": "dist/jquery.pdf.js"
},
"dependencies":{
"jspdf":"~2.1.1",
"html2canvas":"1.0.0-rc.7",
"dompurify":"*"
},
"devDependencies": {
"parcel":"next"
}
}
parcel serve index.html
should run server
node:internal/modules/cjs/loader:1142
return process.dlopen(module, path.toNamespacedPath(filename));
^Error: /usr/src/node_modules/@parcel/source-map/build/Release/sourcemap.node: undefined symbol: _ZN4Napi7details31needs_objectwrap_destructor_fixE
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1142:18)
at Module.load (node:internal/modules/cjs/loader:948:32)
at Function.Module._load (node:internal/modules/cjs/loader:789:14)
at Module.require (node:internal/modules/cjs/loader:972:19)
at require (node:internal/modules/cjs/helpers:88:18)
at load (/usr/src/node_modules/node-gyp-build/index.js:21:10)
at Object. (/usr/src/node_modules/@parcel/source-map/dist/node.js:14:43)
at Module._compile (node:internal/modules/cjs/loader:1083:30)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1112:10)
at Module.load (node:internal/modules/cjs/loader:948:32) {
code: 'ERR_DLOPEN_FAILED'
}
I downgraded to v1 and was able to start parcel server and watch features
Trying to run a parcel based project with server
Software | Version(s) |
---|---|
Parcel | next |
Node | v15.1.0 |
npm/Yarn | 1.22.5 |
Operating System | Docker Linux 4.19.97-v7+ |
With a release build (both compiled locally or using the published bianry from 2.0.3), there's a segfault:
const { default: SourceMap } = require('.');
let map = new SourceMap('/test-root');
map.addVLQMap({
mappings: '',
sources: ['x'],
names: [],
});
let buffer = map.toBuffer();
process.stdout.write('4\n\n\n');
let previousMap = new SourceMap(this.projectRoot, buffer);
Process 52935 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_I386_GPFLT)
frame #0: 0x000000012125a9fb index.darwin-x64.node`_rjem_mallocx + 379
index.darwin-x64.node`_rjem_mallocx:
-> 0x12125a9fb <+379>: movzbl (%rcx,%rax), %ecx
0x12125a9ff <+383>: cmpl $0xe7, %ecx
0x12125aa05 <+389>: ja 0x12125aa76 ; <+502>
0x12125aa07 <+391>: movl %ecx, %eax
* frame #0: 0x000000012125a9fb index.darwin-x64.node`_rjem_mallocx + 379
frame #1: 0x000000012122a7b4 index.darwin-x64.node`parcel_sourcemap::SourceMap::from_buffer::hc762a305e0418935 + 308
frame #2: 0x0000000121219182 index.darwin-x64.node`parcel_sourcemap_node::constructor::h55667339899ceede + 3122
engines.node
is set to ^10
in package.json, but source-map completely fails installation on Node 10.0.0
nvm 10.0.0
npm install @parcel/[email protected]
$ npm install @parcel/[email protected]
> @parcel/[email protected] install /home/runner/work/GhostText/GhostText/node_modules/@parcel/source-map
> node-gyp-build
make: Entering directory '/home/runner/work/GhostText/GhostText/node_modules/@parcel/source-map/build'
CC(target) Release/obj.target/nothing/../../node-addon-api/nothing.o
AR(target) Release/obj.target/../../node-addon-api/nothing.a
COPY Release/nothing.a
CXX(target) Release/obj.target/sourcemap/src/napi/SourceMap.o
../src/napi/SourceMap.cpp: In member function ‘void SourceMapBinding::addIndexedMappings(const Napi::CallbackInfo&)’:
../src/napi/SourceMap.cpp:244:22: warning: unused variable ‘mappingIndex’ [-Wunused-variable]
unsigned int mappingIndex = i / 6;
^~~~~~~~~~~~
../src/napi/SourceMap.cpp: At global scope:
../src/napi/SourceMap.cpp:488:36: error: ISO C++ forbids declaration of ‘NAPI_MODULE_INIT’ with no type [-fpermissive]
NAPI_MODULE_INIT(/* env, exports */) {
^
../src/napi/SourceMap.cpp: In function ‘int NAPI_MODULE_INIT()’:
../src/napi/SourceMap.cpp:489:35: error: ‘env’ was not declared in this scope
return SourceMapBinding::Init(env, Napi::Object(env, exports));
^~~
../src/napi/SourceMap.cpp:489:35: note: suggested alternative: ‘ecvt’
return SourceMapBinding::Init(env, Napi::Object(env, exports));
^~~
ecvt
../src/napi/SourceMap.cpp:489:58: error: ‘exports’ was not declared in this scope
return SourceMapBinding::Init(env, Napi::Object(env, exports));
^~~~~~~
sourcemap.target.mk:115: recipe for target 'Release/obj.target/sourcemap/src/napi/SourceMap.o' failed
make: *** [Release/obj.target/sourcemap/src/napi/SourceMap.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/opt/hostedtoolcache/node/10.0.0/x64/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:225:12)
gyp ERR! System Linux 5.4.0-1039-azure
gyp ERR! command "/opt/hostedtoolcache/node/10.0.0/x64/bin/node" "/opt/hostedtoolcache/node/10.0.0/x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/runner/work/GhostText/GhostText/node_modules/@parcel/source-map
gyp ERR! node -v v10.0.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
Demo GitHub Actions workflow and its result:
https://github.com/GhostText/GhostText/blob/ee65fe32995a20e40283fa4afeb543e95747d6b6/.github/workflows/ci.yml#L11
https://github.com/GhostText/GhostText/runs/1834108086?check_suite_focus=true
Would you mind releasing the latest version on npm and cargo? Thank you again for your great work :)
TypeScript definitions exist in this repo, but they are not published. I think it has to do with the files
property in package.json
, it is missing the index.d.ts
file.
I try to use @parcel/source-map to implement remapping like https://github.com/ampproject/remapping for efficiency, but it seems that It generates wrong sourcemap.
You can see the demo https://github.com/hardfist/remap here
The README says that delete()
will remove references in native code. But if I don't call delete()
, and allow my SourceMap
s to be garbage collected by JS, will that cause a memory leak?
// Does this pseudo-code cause a memory leak since it does not call delete()?
while(true) {
const sm = new SourceMap();
sm.addVLQMap(dataFromSomewhere); // etc
// is GCed because we drop the JS reference
}
on macOS 10.13.6:
Symbol not found: ____chkstk_darwin
Referenced from: /@parcel/source-map/parcel_sourcemap_node/artifacts/index.darwin-x64.node (which was built for Mac OS X 10.15)
Expected in: /usr/lib/libSystem.B.dylib
there are several build targets in parcel_sourcemap_node/artefacts. For Apple M1 chips there is index.darwin-arm64.node.
sadly, when running docker/linux system on a M1 chip I get a Error: Cannot find module './artifacts/index.linux-arm64-musl.node'
Is it possible to add this build target?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.