Skip to content

Commit

Permalink
chore: bump Rspack, webpack & enhanced-resolve (#485)
Browse files Browse the repository at this point in the history
  • Loading branch information
layershifter authored Jan 11, 2024
1 parent 8b9a354 commit 5f2a0e4
Show file tree
Hide file tree
Showing 7 changed files with 347 additions and 370 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: improve checks on .rules",
"packageName": "@griffel/next-extraction-plugin",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: bump `enhanced-resolve` & improve internal types",
"packageName": "@griffel/webpack-loader",
"email": "[email protected]",
"dependentChangeType": "patch"
}
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
"@nrwl/web": "15.3.3",
"@nrwl/workspace": "15.3.3",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
"@rspack/cli": "0.4.5",
"@rspack/core": "0.4.5",
"@rspack/cli": "0.5.0",
"@rspack/core": "0.5.0",
"@storybook/addon-essentials": "6.5.15",
"@storybook/builder-webpack5": "6.5.15",
"@storybook/manager-webpack5": "6.5.15",
Expand Down Expand Up @@ -140,7 +140,7 @@
"tsconfig-paths": "4.1.1",
"typescript": "4.8.4",
"url-loader": "^4.1.1",
"webpack": "^5.76.0",
"webpack": "^5.89.0",
"webpack-merge": "^5.8.0",
"yargs": "^17.5.1"
},
Expand All @@ -158,7 +158,7 @@
"ajv": "^8.4.0",
"browserslist": "^4.19.1",
"csstype": "^3.1.3",
"enhanced-resolve": "^5.8.2",
"enhanced-resolve": "^5.15.0",
"rtl-css-js": "^1.16.1",
"source-map-js": "1.0.2",
"stylis": "^4.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,14 @@ export const withGriffelCSSExtraction =
config.module?.rules?.find(
rule =>
typeof rule === 'object' &&
rule !== null &&
Array.isArray(rule.oneOf) &&
rule.oneOf.some(
({ test }) => test instanceof RegExp && typeof test.test === 'function' && test.test('filename.css'),
setRule =>
setRule &&
setRule.test instanceof RegExp &&
typeof setRule.test.test === 'function' &&
setRule.test.test('filename.css'),
),
) as RuleSetRule
)?.oneOf;
Expand Down
2 changes: 1 addition & 1 deletion packages/webpack-loader/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"dependencies": {
"@babel/core": "^7.23.2",
"@griffel/babel-preset": "^1.5.5",
"enhanced-resolve": "^5.8.2",
"enhanced-resolve": "^5.15.0",
"tslib": "^2.1.0"
},
"peerDependencies": {
Expand Down
8 changes: 6 additions & 2 deletions packages/webpack-loader/src/webpackLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ export type WebpackLoaderOptions = BabelPluginOptions & {
>;
};

type ResolveOptions = Pick<
enhancedResolve.ResolveOptionsOptionalFS,
'alias' | 'conditionNames' | 'extensions' | 'modules' | 'plugins'
>;
type WebpackLoaderParams = Parameters<webpack.LoaderDefinitionFunction<WebpackLoaderOptions>>;

export function shouldTransformSourceCode(
Expand Down Expand Up @@ -73,7 +77,7 @@ export function webpackLoader(

EvalCache.clearForFile(this.resourcePath);

const resolveOptionsDefaults: webpack.ResolveOptions = {
const resolveOptionsDefaults: ResolveOptions = {
conditionNames: ['require'],
extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'],
};
Expand All @@ -91,7 +95,7 @@ export function webpackLoader(
resolveOptionsFromWebpackConfig[resolveOptionKey],
]),
),
...webpackResolveOptions,
...(webpackResolveOptions as ResolveOptions),
});

const originalResolveFilename = Module._resolveFilename;
Expand Down
Loading

0 comments on commit 5f2a0e4

Please sign in to comment.