Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
cezaraugusto committed Aug 23, 2024
1 parent f8f6bc1 commit 0115308
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 31 deletions.
4 changes: 2 additions & 2 deletions programs/develop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"@colors/colors": "^1.6.0",
"@rspack/cli": "^0.7.5",
"@rspack/core": "^0.7.5",
"@rspack/plugin-react-refresh": "^1.0.0",
"@swc/core": "^1.7.3",
"@types/firefox-webext-browser": "^120.0.4",
"acorn": "^8.12.1",
Expand Down Expand Up @@ -61,6 +62,7 @@
"parse5-utils": "^2.0.0",
"postcss": "^8.4.40",
"progress": "^2.0.3",
"react-refresh": "^0.14.2",
"sass-embedded": "^1.77.8",
"schema-utils": "^4.2.0",
"slugify": "^1.6.6",
Expand Down Expand Up @@ -89,7 +91,6 @@
},
"optionalDependencies": {
"@babel/core": "^7.24.9",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.15",
"@prefresh/webpack": "^4.0.1",
"@vue/compiler-sfc": "^3.4.34",
"babel-loader": "^9.1.3",
Expand All @@ -102,7 +103,6 @@
"postcss-preset-env": "^9.6.0",
"postcss-scss": "^4.0.9",
"react-refresh": "^0.14.2",
"react-refresh-typescript": "^2.0.9",
"resolve-url-loader": "^5.0.0",
"sass": "^1.77.8",
"sass-loader": "^16.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export async function commonStyleLoaders(
) {
const maybeInstallPostCss = await maybeUsePostCss(projectPath, opts)
if (maybeInstallPostCss.loader) {
// @ts-expect-error
styleLoaders.push(maybeInstallPostCss)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import {
RuntimeGlobals,
// @ts-expect-error - runtimeRequirementInTree is not typed
RuntimeModule,
Template,
type Compiler
Expand All @@ -24,11 +25,14 @@ export class AddPublicPathRuntimeModule {
const {RuntimeGlobals} = compiler.webpack

compiler.hooks.compilation.tap('PublicPathRuntimeModule', (compilation) => {
// @ts-expect-error - runtimeRequirementInTree is not typed
compilation.hooks.runtimeRequirementInTree
.for(RuntimeGlobals.publicPath)
// @ts-expect-error - runtimeRequirementInTree is not typed
.tap(AddPublicPathRuntimeModule.name, (chunk) => {
const module = PublicPathRuntimeModule()

// @ts-expect-error - runtimeRequirementInTree is not typed
compilation.addRuntimeModule(chunk, module)

return true
Expand All @@ -44,12 +48,15 @@ function PublicPathRuntimeModule() {
}

generate() {
// @ts-expect-error - runtimeRequirementInTree is not typed
const publicPath = this.compilation?.outputOptions.publicPath

return Template.asString([
...weakRuntimeCheck,
`var path = ${JSON.stringify(
// @ts-expect-error - runtimeRequirementInTree is not typed
this.compilation?.getPath(publicPath || '', {
// @ts-expect-error - runtimeRequirementInTree is not typed
hash: this.compilation.hash || 'XXXX'
})
)}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ export class WebResourcesPlugin {
)

modules.forEach((module) => {
// @ts-expect-error - module has no type
chunkGraph.getModuleChunks(module).forEach((chunk) => {
// @ts-expect-error - module has no type
chunk.auxiliaryFiles.forEach((file) => {
if (!importedFiles.includes(file)) {
importedFiles.push(file)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ class TargetWebExtensionPlugin {
new WebExtension({
background: this.getEntryName(manifest),
weakRuntimeCheck: true
// @ts-ignore
}).apply(compiler)
}
}
Expand Down
38 changes: 9 additions & 29 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2144,19 +2144,6 @@
resolved "https://registry.yarnpkg.com/@pkgjs/parseargs/-/parseargs-0.11.0.tgz#a77ea742fab25775145434eb1d2328cf5013ac33"
integrity sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==

"@pmmmwh/react-refresh-webpack-plugin@^0.5.15":
version "0.5.15"
resolved "https://registry.yarnpkg.com/@pmmmwh/react-refresh-webpack-plugin/-/react-refresh-webpack-plugin-0.5.15.tgz#f126be97c30b83ed777e2aeabd518bc592e6e7c4"
integrity sha512-LFWllMA55pzB9D34w/wXUCf8+c+IYKuJDgxiZ3qMhl64KRMBHYM1I3VdGaD2BV5FNPV2/S2596bppxHbv2ZydQ==
dependencies:
ansi-html "^0.0.9"
core-js-pure "^3.23.3"
error-stack-parser "^2.0.6"
html-entities "^2.1.0"
loader-utils "^2.0.4"
schema-utils "^4.2.0"
source-map "^0.7.3"

"@polka/url@^1.0.0-next.20":
version "1.0.0-next.25"
resolved "https://registry.yarnpkg.com/@polka/url/-/url-1.0.0-next.25.tgz#f077fdc0b5d0078d30893396ff4827a13f99e817"
Expand Down Expand Up @@ -2360,6 +2347,14 @@
webpack-dev-server "4.13.1"
ws "8.8.1"

"@rspack/plugin-react-refresh@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@rspack/plugin-react-refresh/-/plugin-react-refresh-1.0.0.tgz#7e0cc22b157d25131be4283667cdbb86960a3650"
integrity sha512-WvXkLewW5G0Mlo5H1b251yDh5FFiH4NDAbYlFpvFjcuXX2AchZRf9zdw57BDE/ADyWsJgA8kixN/zZWBTN3iYA==
dependencies:
error-stack-parser "^2.0.6"
html-entities "^2.1.0"

"@sinclair/typebox@^0.27.8":
version "0.27.8"
resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.27.8.tgz#6667fac16c436b5434a387a34dedb013198f6e6e"
Expand Down Expand Up @@ -3241,11 +3236,6 @@ ansi-html-community@^0.0.8:
resolved "https://registry.yarnpkg.com/ansi-html-community/-/ansi-html-community-0.0.8.tgz#69fbc4d6ccbe383f9736934ae34c3f8290f1bf41"
integrity sha512-1APHAyr3+PCamwNw3bXCPp4HFLONZt/yIH0sZp0/469KWNTEy+qN5jQ3GVX6DMZ1UXAi34yVwtTeaG/HpBuuzw==

ansi-html@^0.0.9:
version "0.0.9"
resolved "https://registry.yarnpkg.com/ansi-html/-/ansi-html-0.0.9.tgz#6512d02342ae2cc68131952644a129cb734cd3f0"
integrity sha512-ozbS3LuenHVxNRh/wdnN16QapUHzauqSomAl1jwwJRRsGwFwtj644lIhxfWu0Fy0acCij2+AEgHvjscq3dlVXg==

ansi-regex@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304"
Expand Down Expand Up @@ -3952,11 +3942,6 @@ core-js-compat@^3.37.1, core-js-compat@^3.38.0:
dependencies:
browserslist "^4.23.3"

core-js-pure@^3.23.3:
version "3.38.1"
resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.38.1.tgz#e8534062a54b7221344884ba9b52474be495ada3"
integrity sha512-BY8Etc1FZqdw1glX0XNOq2FDwfrg/VGqoZOZCdaL+UmdaqDwQwYXkMJT4t6In+zfEfOJDcM9T0KdbBeJg8KKCQ==

core-util-is@~1.0.0:
version "1.0.3"
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85"
Expand Down Expand Up @@ -6102,7 +6087,7 @@ loader-utils@^1.0.2:
emojis-list "^3.0.0"
json5 "^1.0.1"

loader-utils@^2.0.0, loader-utils@^2.0.4:
loader-utils@^2.0.0:
version "2.0.4"
resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-2.0.4.tgz#8b5cb38b5c34a9a018ee1fc0e6a066d1dfcc528c"
integrity sha512-xXqpXoINfFhgua9xiqD8fPFHgkoq1mmmpE92WlDbm9rNRd/EbRb+Gqf908T2DMfuHjjJlksiK2RbHVOdD/MqSw==
Expand Down Expand Up @@ -7277,11 +7262,6 @@ react-is@^18.0.0:
resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.3.1.tgz#e83557dc12eae63a99e003a46388b1dcbb44db7e"
integrity sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==

react-refresh-typescript@^2.0.9:
version "2.0.9"
resolved "https://registry.yarnpkg.com/react-refresh-typescript/-/react-refresh-typescript-2.0.9.tgz#f8a86efcb34f8d717100230564b9b57477d74b10"
integrity sha512-chAnOO4vpxm/3WkgOVmti+eN8yUtkJzeGkOigV6UA9eDFz12W34e/SsYe2H5+RwYJ3+sfSZkVbiXcG1chEBxlg==

react-refresh@^0.14.2:
version "0.14.2"
resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.14.2.tgz#3833da01ce32da470f1f936b9d477da5c7028bf9"
Expand Down

0 comments on commit 0115308

Please sign in to comment.