-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
356 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,7 @@ | |
"sugarss": "^3.0.3", | ||
"tailwindcss": "^3.0.2", | ||
"tempy": "^0.3.0", | ||
"wasm-sourcemap": "^1.0.0", | ||
"ws": "^7.0.0" | ||
} | ||
} |
2 changes: 0 additions & 2 deletions
2
...can-invalidateonenvchange/node_modules/parcel-resolver-can-invalidateonenvchange/index.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
packages/core/integration-tests/test/integration/wasm-sourcemap-transformer/.parcelrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"extends": "@parcel/config-default", | ||
"transformers": { | ||
"*.wasm": ["parcel-transformer-test"] | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
packages/core/integration-tests/test/integration/wasm-sourcemap-transformer/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log(new URL("index.wasm", import.meta.url)) |
Binary file added
BIN
+41 Bytes
packages/core/integration-tests/test/integration/wasm-sourcemap-transformer/index.wasm
Binary file not shown.
16 changes: 16 additions & 0 deletions
16
...test/integration/wasm-sourcemap-transformer/node_modules/parcel-transformer-test/index.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
.../integration/wasm-sourcemap-transformer/node_modules/parcel-transformer-test/package.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"name": "@parcel/packager-wasm", | ||
"version": "2.9.3", | ||
"license": "MIT", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"funding": { | ||
"type": "opencollective", | ||
"url": "https://opencollective.com/parcel" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/parcel-bundler/parcel.git" | ||
}, | ||
"main": "lib/WasmPackager.js", | ||
"source": "src/WasmPackager.js", | ||
"engines": { | ||
"node": ">=12.0.0", | ||
"parcel": "^2.9.3" | ||
}, | ||
"dependencies": { | ||
"@parcel/plugin": "2.9.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// @flow strict-local | ||
|
||
import assert from 'assert'; | ||
import {Packager} from '@parcel/plugin'; | ||
import * as wasmmap from './wasm-sourcemap'; | ||
|
||
export default (new Packager({ | ||
async package({bundle, getSourceMapReference}) { | ||
let assets = []; | ||
bundle.traverseAssets(asset => { | ||
assets.push(asset); | ||
}); | ||
|
||
assert.equal(assets.length, 1, 'Wasm bundles must only contain one asset'); | ||
|
||
let [contents, map] = await Promise.all([ | ||
assets[0].getBuffer(), | ||
assets[0].getMap(), | ||
]); | ||
let sourcemapReference = await getSourceMapReference(map); | ||
if (sourcemapReference != null) { | ||
return { | ||
contents: Buffer.from( | ||
wasmmap.SetSourceMapURL( | ||
contents, | ||
sourcemapReference, | ||
sourcemapReference.includes('HASH_REF_') | ||
? // HASH_REF_\w{16} -> \w{8} | ||
sourcemapReference.length - (9 + 16 - 8) | ||
: undefined, | ||
), | ||
), | ||
map, | ||
}; | ||
} else { | ||
return {contents, map}; | ||
} | ||
}, | ||
}): Packager); |
Oops, something went wrong.