Skip to content

Commit

Permalink
Patch PhosphorJS during application webpack build
Browse files Browse the repository at this point in the history
* Use string-replace-loader to remove the critical line from PhosphorJS during application bundleing
* Extend `webpack generator.ts` to add this to applications' `gen-webpack.config.js`
* Remove the now obsolete `postinstall` hook to remove the line

Signed-off-by: Lucas Koehler <lkoehler@eclipsesource.com>
  • Loading branch information
lucas-koehler committed May 20, 2022
1 parent 0f28d4f commit c13f4b8
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 35 deletions.
1 change: 1 addition & 0 deletions dev-packages/application-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"source-map": "^0.6.1",
"source-map-loader": "^2.0.1",
"source-map-support": "^0.5.19",
"string-replace-loader": "^3.1.0",
"style-loader": "^2.0.0",
"umd-compat-loader": "^2.1.2",
"webpack": "^5.48.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,16 @@ module.exports = {
cache: staticCompression,
module: {
rules: [
{
// Removes the host check in PhosporJS to enable moving widgets to secondary windows.
test: /widget\\.js$/,
loader: 'string-replace-loader',
include: /node_modules[\\\\/]@phosphor[\\\\/]widgets[\\\\/]lib/,
options: {
search: /^.*?throw new Error\\('Host is not attached.'\\).*?$/gm,
replace: ''
}
},
{
test: /\\.css$/,
exclude: /materialcolors\\.css$|\\.useable\\.css$/,
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
"lint:clean": "rimraf .eslintcache",
"lint:oneshot": "node --max-old-space-size=4096 node_modules/eslint/bin/eslint.js --cache=true \"{dev-packages,packages,examples}/**/*.{ts,tsx}\"",
"preinstall": "node-gyp install",
"postinstall": "node scripts/patch-libraries.js",
"prepare": "yarn -s compile:references && lerna run prepare && yarn -s compile",
"publish:latest": "lerna publish --exact --yes --no-push && yarn -s publish:check",
"publish:next": "lerna publish preminor --exact --canary --preid next --dist-tag next --no-git-reset --no-git-tag-version --no-push --yes && yarn -s publish:check",
Expand Down
34 changes: 0 additions & 34 deletions scripts/patch-libraries.js

This file was deleted.

8 changes: 8 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10656,6 +10656,14 @@ string-argv@^0.1.1:
resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.1.2.tgz#c5b7bc03fb2b11983ba3a72333dd0559e77e4738"
integrity sha512-mBqPGEOMNJKXRo7z0keX0wlAhbBAjilUdPW13nN0PecVryZxdHIeM7TqbsSUA7VYuS00HGC6mojP7DlQzfa9ZA==

string-replace-loader@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/string-replace-loader/-/string-replace-loader-3.1.0.tgz#11ac6ee76bab80316a86af358ab773193dd57a4f"
integrity sha512-5AOMUZeX5HE/ylKDnEa/KKBqvlnFmRZudSOjVJHxhoJg9QYTwl1rECx7SLR8BBH7tfxb4Rp7EM2XVfQFxIhsbQ==
dependencies:
loader-utils "^2.0.0"
schema-utils "^3.0.0"

string-width@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3"
Expand Down

0 comments on commit c13f4b8

Please sign in to comment.