Skip to content

Commit

Permalink
Skip native functions in search. It tried to run the Array.push metho…
Browse files Browse the repository at this point in the history
…d on the blueprint website.
  • Loading branch information
EmileSonneveld committed Dec 26, 2024
1 parent b53727c commit 5099aaa
Show file tree
Hide file tree
Showing 8 changed files with 1,085 additions and 924 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ See [LICENSE][] for more info.
```
npm install
path=%CD%/node_modules/.bin;%path%
:: Avoid ERR_OSSL_EVP_UNSUPPORTED:
SET NODE_OPTIONS=--openssl-legacy-provider
node_modules\.bin\webpack
```
23 changes: 23 additions & 0 deletions build_addon.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import fs from 'fs';
import utils from './src/internal/utils.js'

let distJavaScript = fs.readFileSync('./dist/main.js', 'utf8');

const regex = new RegExp("_internal_utils_js__WEBPACK_IMPORTED_MODULE_0__.default.world.(\\w+ ?= ?\\w+)(\\r?\\n)", "gm")
const replace = "_internal_utils_js__WEBPACK_IMPORTED_MODULE_0__.default.world.$1;$2capture.$1;$2"

distJavaScript = distJavaScript.replaceAll(regex, replace)

let popupJavaScript = fs.readFileSync('./serialise-to-js-addon/popup.js', 'utf8');

const dollarNumb = 'dollar' + new Date().toISOString() // Avoids issue with self referencing
distJavaScript = distJavaScript.replaceAll("$", dollarNumb)
const regexBetweenTokens = new RegExp("(/// BEGIN of modified main.js\\r?\\n)[\\s\\S]*?(\\r?\\n\\s+/// END of modified main.js)", "gm")
popupJavaScript = popupJavaScript.replace(
regexBetweenTokens,
"$1" + distJavaScript + "$2"
)
popupJavaScript = popupJavaScript.replaceAll(dollarNumb, "$")

fs.writeFileSync('./serialise-to-js-addon/popup.js', popupJavaScript, 'utf8');
console.log("build_addon.js done")
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
},
"scripts": {
"all": "npm run clean && npm run lint && npm run build && npm test",
"build": "babel -d lib src && npx webpack",
"build": "babel -d lib src && npx webpack && node build_addon.js",
"clean": "rimraf lib doc coverage .nyc_output *.tgz",
"coverage": "nyc -r text -r html npm test",
"lint": "eslint src test",
Expand Down
Loading

0 comments on commit 5099aaa

Please sign in to comment.