@griffel/webpack-plugin 1.1.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -2
- package/index.d.mts +1 -3
- package/package.json +3 -4
- package/resolver/createResolverFactory.d.mts +2 -0
- package/webpack-plugin.js +25 -76
- package/resolver/createEnhancedResolverFactory.d.mts +0 -6
- package/resolver/createFluentOxcResolverFactory.d.mts +0 -7
- package/resolver/createOxcResolverFactory.d.mts +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
# Change Log - @griffel/webpack-plugin
|
|
2
2
|
|
|
3
|
-
This log was last generated on Fri, 06 Mar 2026
|
|
3
|
+
This log was last generated on Fri, 06 Mar 2026 15:54:55 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 2.0.0
|
|
8
|
+
|
|
9
|
+
Fri, 06 Mar 2026 15:54:55 GMT
|
|
10
|
+
|
|
11
|
+
### Major changes
|
|
12
|
+
|
|
13
|
+
- BREAKING: consolidate resolvers into ESM-first createResolverFactory, remove enhanced-resolve dependency (olfedias@microsoft.com)
|
|
14
|
+
- Bump @griffel/transform to v1.2.1
|
|
15
|
+
- Bump @griffel/core to v1.20.1
|
|
16
|
+
|
|
7
17
|
## 1.1.0
|
|
8
18
|
|
|
9
|
-
Fri, 06 Mar 2026 08:
|
|
19
|
+
Fri, 06 Mar 2026 08:17:05 GMT
|
|
10
20
|
|
|
11
21
|
### Minor changes
|
|
12
22
|
|
package/index.d.mts
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
1
|
export { GriffelPlugin, type GriffelCSSExtractionPluginOptions } from './GriffelPlugin.mjs';
|
|
2
|
-
export {
|
|
3
|
-
export { createOxcResolverFactory } from './resolver/createOxcResolverFactory.mjs';
|
|
4
|
-
export { createFluentOxcResolverFactory, type FluentOxcResolverOptions, } from './resolver/createFluentOxcResolverFactory.mjs';
|
|
2
|
+
export { createResolverFactory } from './resolver/createResolverFactory.mjs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@griffel/webpack-plugin",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Webpack plugin that performs CSS extraction for Griffel",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -20,9 +20,8 @@
|
|
|
20
20
|
"./package.json": "./package.json"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@griffel/transform": "^1.2.
|
|
24
|
-
"@griffel/core": "^1.20.
|
|
25
|
-
"enhanced-resolve": "^5.15.0",
|
|
23
|
+
"@griffel/transform": "^1.2.1",
|
|
24
|
+
"@griffel/core": "^1.20.1",
|
|
26
25
|
"oxc-resolver": "^11.19.1",
|
|
27
26
|
"stylis": "^4.2.0"
|
|
28
27
|
},
|
package/webpack-plugin.js
CHANGED
|
@@ -1,33 +1,36 @@
|
|
|
1
1
|
import { styleBucketOrdering, normalizeCSSBucketEntry, defaultCompareMediaQueries } from "@griffel/core";
|
|
2
2
|
import { P as PLUGIN_NAME, G as GriffelCssLoaderContextKey } from "./constants-aY3k4vvW.js";
|
|
3
|
-
import
|
|
3
|
+
import { ResolverFactory } from "oxc-resolver";
|
|
4
4
|
import * as path from "node:path";
|
|
5
5
|
import { compile, COMMENT, serialize, stringify } from "stylis";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
function isCJSOnlyPackage(id) {
|
|
7
|
+
return id === "tslib" || id.startsWith("@babel/runtime") || id.startsWith("@swc/helpers");
|
|
8
|
+
}
|
|
9
|
+
const RESOLVE_OPTIONS_DEFAULTS = {
|
|
10
|
+
conditionNames: ["import", "require"],
|
|
9
11
|
extensions: [".js", ".jsx", ".cjs", ".mjs", ".ts", ".tsx", ".json"]
|
|
10
12
|
};
|
|
11
|
-
function
|
|
12
|
-
const { inheritResolveOptions = ["alias", "modules", "plugins"], webpackResolveOptions } = resolveOptions;
|
|
13
|
+
function createResolverFactory() {
|
|
13
14
|
return function(compilation) {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
...
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
),
|
|
23
|
-
...webpackResolveOptions
|
|
15
|
+
const defaultResolver = new ResolverFactory({
|
|
16
|
+
...RESOLVE_OPTIONS_DEFAULTS
|
|
17
|
+
// ...resolveOptionsFromWebpackConfig,
|
|
18
|
+
});
|
|
19
|
+
const cjsResolver = defaultResolver.cloneWithOptions({
|
|
20
|
+
conditionNames: ["require"],
|
|
21
|
+
extensions: RESOLVE_OPTIONS_DEFAULTS.extensions,
|
|
22
|
+
mainFields: ["module", "main"]
|
|
24
23
|
});
|
|
25
24
|
return function resolveModule(id, { filename }) {
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
const resolver = isCJSOnlyPackage(id) ? cjsResolver : defaultResolver;
|
|
26
|
+
const resolved = resolver.sync(path.dirname(filename), id);
|
|
27
|
+
if (resolved.error) {
|
|
28
|
+
throw resolved.error;
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
if (!resolved.path) {
|
|
31
|
+
throw new Error(`oxc-resolver: Failed to resolve module "${id}"`);
|
|
32
|
+
}
|
|
33
|
+
return resolved.path;
|
|
31
34
|
};
|
|
32
35
|
};
|
|
33
36
|
}
|
|
@@ -156,7 +159,7 @@ class GriffelPlugin {
|
|
|
156
159
|
this.#attachToEntryPoint = options.unstable_attachToEntryPoint;
|
|
157
160
|
this.#collectStats = options.collectStats ?? false;
|
|
158
161
|
this.#compareMediaQueries = options.compareMediaQueries ?? defaultCompareMediaQueries;
|
|
159
|
-
this.#resolverFactory = options.resolverFactory ??
|
|
162
|
+
this.#resolverFactory = options.resolverFactory ?? createResolverFactory();
|
|
160
163
|
}
|
|
161
164
|
apply(compiler) {
|
|
162
165
|
const IS_RSPACK = Object.prototype.hasOwnProperty.call(compiler.webpack, "rspackVersion");
|
|
@@ -308,61 +311,7 @@ class GriffelPlugin {
|
|
|
308
311
|
});
|
|
309
312
|
}
|
|
310
313
|
}
|
|
311
|
-
const RESOLVE_OPTIONS_DEFAULTS$1 = {
|
|
312
|
-
conditionNames: ["require"],
|
|
313
|
-
extensions: [".js", ".jsx", ".cjs", ".mjs", ".ts", ".tsx", ".json"]
|
|
314
|
-
};
|
|
315
|
-
function createOxcResolverFactory() {
|
|
316
|
-
return function(compilation) {
|
|
317
|
-
const resolverFactory = new ResolverFactory({
|
|
318
|
-
...RESOLVE_OPTIONS_DEFAULTS$1
|
|
319
|
-
// ...resolveOptionsFromWebpackConfig,
|
|
320
|
-
});
|
|
321
|
-
return function resolveModule(id, { filename }) {
|
|
322
|
-
const resolvedResolver = resolverFactory.sync(path.dirname(filename), id);
|
|
323
|
-
if (resolvedResolver.error) {
|
|
324
|
-
throw resolvedResolver.error;
|
|
325
|
-
}
|
|
326
|
-
if (!resolvedResolver.path) {
|
|
327
|
-
throw new Error(`oxc-resolver: Failed to resolve module "${id}"`);
|
|
328
|
-
}
|
|
329
|
-
return resolvedResolver.path;
|
|
330
|
-
};
|
|
331
|
-
};
|
|
332
|
-
}
|
|
333
|
-
function defaultIsFluentPackage(id) {
|
|
334
|
-
return id.startsWith("@fluentui/");
|
|
335
|
-
}
|
|
336
|
-
const RESOLVE_OPTIONS_DEFAULTS = {
|
|
337
|
-
conditionNames: ["require"],
|
|
338
|
-
extensions: [".raw.js", ".js", ".jsx", ".cjs", ".mjs", ".ts", ".tsx", ".json"]
|
|
339
|
-
};
|
|
340
|
-
function createFluentOxcResolverFactory(resolveOptions) {
|
|
341
|
-
const { isFluentPackage = defaultIsFluentPackage, ...restOptions } = resolveOptions ?? {};
|
|
342
|
-
return function(compilation) {
|
|
343
|
-
const defaultResolver = new ResolverFactory({
|
|
344
|
-
...RESOLVE_OPTIONS_DEFAULTS,
|
|
345
|
-
...restOptions
|
|
346
|
-
});
|
|
347
|
-
const esmResolver = defaultResolver.cloneWithOptions({
|
|
348
|
-
conditionNames: ["import", "require"]
|
|
349
|
-
});
|
|
350
|
-
return function resolveModule(id, { filename }) {
|
|
351
|
-
const resolver = isFluentPackage(id) ? esmResolver : defaultResolver;
|
|
352
|
-
const resolved = resolver.sync(path.dirname(filename), id);
|
|
353
|
-
if (resolved.error) {
|
|
354
|
-
throw resolved.error;
|
|
355
|
-
}
|
|
356
|
-
if (!resolved.path) {
|
|
357
|
-
throw new Error(`oxc-resolver: Failed to resolve module "${id}"`);
|
|
358
|
-
}
|
|
359
|
-
return resolved.path;
|
|
360
|
-
};
|
|
361
|
-
};
|
|
362
|
-
}
|
|
363
314
|
export {
|
|
364
315
|
GriffelPlugin,
|
|
365
|
-
|
|
366
|
-
createFluentOxcResolverFactory,
|
|
367
|
-
createOxcResolverFactory
|
|
316
|
+
createResolverFactory
|
|
368
317
|
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Configuration } from 'webpack';
|
|
2
|
-
import { TransformResolverFactory } from './types.mjs';
|
|
3
|
-
export declare function createEnhancedResolverFactory(resolveOptions?: {
|
|
4
|
-
inheritResolveOptions?: ('alias' | 'modules' | 'plugins' | 'conditionNames' | 'extensions')[];
|
|
5
|
-
webpackResolveOptions?: Pick<Required<Configuration>['resolve'], 'alias' | 'modules' | 'plugins' | 'conditionNames' | 'extensions'>;
|
|
6
|
-
}): TransformResolverFactory;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { NapiResolveOptions } from 'oxc-resolver';
|
|
2
|
-
import { TransformResolverFactory } from './types.mjs';
|
|
3
|
-
export type FluentOxcResolverOptions = Pick<NapiResolveOptions, 'conditionNames' | 'extensions' | 'alias' | 'mainFields' | 'modules'> & {
|
|
4
|
-
/** Predicate to determine if a module specifier should be resolved with ESM conditions. Defaults to matching `@fluentui/` prefixed packages. */
|
|
5
|
-
isFluentPackage?: (id: string) => boolean;
|
|
6
|
-
};
|
|
7
|
-
export declare function createFluentOxcResolverFactory(resolveOptions?: FluentOxcResolverOptions): TransformResolverFactory;
|