Skip to content

Feat: Dynamic import refinements & fixes, optimization#102

Merged
guybedford merged 2 commits intomainfrom
dynamic-fixes
Feb 22, 2022
Merged

Feat: Dynamic import refinements & fixes, optimization#102
guybedford merged 2 commits intomainfrom
dynamic-fixes

Conversation

@guybedford
Copy link
Copy Markdown
Owner

@guybedford guybedford commented Feb 22, 2022

This PR upgrades dynamic import analysis, as described in the readme diff here, and fixes #56, #53 and #98.

To summarize the changes:

  • d no longer tracks the start of the dynamic import statement import('x') but rather the start of the bracket at ('x')
  • The ss to se range can be reliably used for the whole statement import('x')
  • The s and e range will either be the inside of the brackets for an unknown expression, or the exact quoted string start and end position after whitespace and comments but including the quotes for a string literal import.

This also includes a bugfix for the asm.js build with multiline dynamic imports.

Since this is a breaking change it will be the 0.10 release.

It also includes some hard-won optimization work bringing the footprints from:

    dist/lexer.js:  4,670B Brotli (11,532B raw)
dist/lexer.asm.js:  4,975B Brotli (19,476B raw)

to:

    dist/lexer.js:  4,512B Brotli (10,668B raw)
dist/lexer.asm.js:  4,685B Brotli (16,896B raw)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expose string start/end for dynamic imports

1 participant