| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 24384d7 commit d908c83
11 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -137,8 +137,10 @@ function parseSource (cjsSource) { | |||
| 137 | 137 | pos += 4; | |
| 138 | 138 | if (source.charCodeAt(pos) === 40/*(*/) { | |
| 139 | 139 | openTokenPosStack[openTokenDepth++] = lastTokenPos; | |
| 140 | - if (source.charCodeAt(++pos) === 114/*r*/) | ||
| 140 | + if (source.charCodeAt(pos + 1) === 114/*r*/) { | ||
| 141 | + pos++; | ||
| 141 | 142 | tryParseRequire(ExportStar); | |
| 143 | + } | ||
| 142 | 144 | } | |
| 143 | 145 | } | |
| 144 | 146 | lastTokenPos = pos; | |
@@ -288,7 +290,7 @@ function tryBacktrackAddStarExportBinding (bPos) { | |||
| 288 | 290 | ||
| 289 | 291 | // `Object.` `prototype.`? hasOwnProperty.call(` IDENTIFIER `, ` IDENTIFIER$2 `)` | |
| 290 | 292 | function tryParseObjectHasOwnProperty (it_id) { | |
| 291 | - ch = commentWhitespace(); | ||
| 293 | + let ch = commentWhitespace(); | ||
| 292 | 294 | if (ch !== 79/*O*/ || !source.startsWith('bject', pos + 1)) return false; | |
| 293 | 295 | pos += 6; | |
| 294 | 296 | ch = commentWhitespace(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | - WASM2WAT := ../wabt/bin/wasm2wat | ||
| 2 | - WASM_OPT := ../binaryen/bin/wasm-opt | ||
| 1 | + WASM2WAT ?= ../wabt/bin/wasm2wat | ||
| 2 | + WASM_OPT ?= ../binaryen/bin/wasm-opt | ||
| 3 | 3 | ||
| 4 | 4 | .PHONY: optimize clean | |
| 5 | 5 | ||
@@ -12,5 +12,8 @@ lib/lexer.wasm: include-wasm/cjs-module-lexer.h src/lexer.c | lib/ | |||
| 12 | 12 | lib/: | |
| 13 | 13 | @mkdir -p $@ | |
| 14 | 14 | ||
| 15 | + optimize: lib/lexer.wasm | ||
| 16 | + $(WASM_OPT) -Oz --enable-bulk-memory --strip-debug lib/lexer.wasm -o lib/lexer.wasm | ||
| 17 | + | ||
| 15 | 18 | clean: | |
| 16 | 19 | $(RM) lib/* | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,7 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | 3 | const WASM_BUILDER_CONTAINER = 'ghcr.io/nodejs/wasm-builder@sha256:975f391d907e42a75b8c72eb77c782181e941608687d4d8694c3e9df415a0970' // v0.0.9 | |
| 4 | 4 | ||
| 5 | - const WASM_OPT = './wasm-opt' | ||
| 5 | + const WASM_OPT = process.env.WASM_OPT || './wasm-opt' | ||
| 6 | 6 | ||
| 7 | 7 | const { execSync } = require('node:child_process') | |
| 8 | 8 | const { writeFileSync, readFileSync, existsSync, mkdirSync } = require('node:fs') | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -137,8 +137,10 @@ function parseSource (cjsSource) { | |||
| 137 | 137 | pos += 4; | |
| 138 | 138 | if (source.charCodeAt(pos) === 40/*(*/) { | |
| 139 | 139 | openTokenPosStack[openTokenDepth++] = lastTokenPos; | |
| 140 | - if (source.charCodeAt(++pos) === 114/*r*/) | ||
| 140 | + if (source.charCodeAt(pos + 1) === 114/*r*/) { | ||
| 141 | + pos++; | ||
| 141 | 142 | tryParseRequire(ExportStar); | |
| 143 | + } | ||
| 142 | 144 | } | |
| 143 | 145 | } | |
| 144 | 146 | lastTokenPos = pos; | |
@@ -288,7 +290,7 @@ function tryBacktrackAddStarExportBinding (bPos) { | |||
| 288 | 290 | ||
| 289 | 291 | // `Object.` `prototype.`? hasOwnProperty.call(` IDENTIFIER `, ` IDENTIFIER$2 `)` | |
| 290 | 292 | function tryParseObjectHasOwnProperty (it_id) { | |
| 291 | - ch = commentWhitespace(); | ||
| 293 | + let ch = commentWhitespace(); | ||
| 292 | 294 | if (ch !== 79/*O*/ || !source.startsWith('bject', pos + 1)) return false; | |
| 293 | 295 | pos += 6; | |
| 294 | 296 | ch = commentWhitespace(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,6 @@ | |||
| 1 | 1 | { | |
| 2 | 2 | "name": "cjs-module-lexer", | |
| 3 | - "version": "2.1.0", | ||
| 3 | + "version": "2.1.1", | ||
| 4 | 4 | "description": "Lexes CommonJS modules, returning their named exports metadata", | |
| 5 | 5 | "main": "lexer.js", | |
| 6 | 6 | "exports": { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -120,8 +120,10 @@ uint32_t parseCJS (uint16_t* _source, uint32_t _sourceLen, void (*_addExport)(co | |||
| 120 | 120 | pos += 4; | |
| 121 | 121 | if (*pos == '(') { | |
| 122 | 122 | openTokenPosStack[openTokenDepth++] = lastTokenPos; | |
| 123 | - if (*(++pos) == 'r') | ||
| 123 | + if (*(pos + 1) == 'r') { | ||
| 124 | + pos++; | ||
| 124 | 125 | tryParseRequire(ExportStar); | |
| 126 | + } | ||
| 125 | 127 | } | |
| 126 | 128 | } | |
| 127 | 129 | lastTokenPos = pos; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments