Skip to content
Open
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
12 changes: 6 additions & 6 deletions WASMbindgenAsset.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class WASMbindgenAsset extends Asset {
return super.process()
}

isTragetRust() {
isTargetRust() {
return path.basename(this.name) === 'Cargo.toml' || path.extname(this.name) === '.rs'
}

Expand All @@ -49,7 +49,7 @@ class WASMbindgenAsset extends Asset {
}

async parse(code) {
if (!this.isTragetRust()) {
if (!this.isTargetRust()) {
if (this.isNormalTOML())
return toml.parse(code)
else
Expand Down Expand Up @@ -155,7 +155,7 @@ class WASMbindgenAsset extends Asset {

const export_names = []
js_content = js_content.replace(/export\ function\ \w+/g, x => {
const name = x.slice(15)
const name = x.slice(16)
export_names.push(name)
return '__exports.' + name + ' = function'
})
Expand All @@ -169,7 +169,7 @@ class WASMbindgenAsset extends Asset {

const exported_classes = []
js_content = js_content.replace(/export\ class\ \w+/g, x => {
const name = x.slice(12)
const name = x.slice(13)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@felixrabe why do you need to change here?

exported_classes.push(name)
export_names.push(name)
return `class ${name}`
Expand Down Expand Up @@ -236,7 +236,7 @@ class WASMbindgenAsset extends Asset {
}

async collectDependencies() {
if (!this.isTragetRust())
if (!this.isTargetRust())
return false

// Read deps file
Expand All @@ -253,7 +253,7 @@ class WASMbindgenAsset extends Asset {
}

async generate() {
if (this.isTragetRust()) {
if (this.isTargetRust()) {
return [
{
type: 'js',
Expand Down