@fluentui/react-icons-atomic-webpack-loader 0.0.6 → 0.0.7

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/README.md CHANGED
@@ -27,6 +27,8 @@ Add the loader to your webpack config as an [`enforce: 'pre'`](https://webpack.j
27
27
 
28
28
  NOTE: Unlike most loaders, this one should NOT exclude `node_modules`. It needs to process files inside `node_modules` as well to transform barrel imports from `@fluentui/react-icons` and `@fluentui/react-brand-icons` in your third-party dependencies. Files that don't reference a supported module are skipped via a fast pre-check, so there is no meaningful overhead.
29
29
 
30
+ The loader also works unchanged with [rspack](https://rspack.rs) (`>=2.0.0`) — the same rule shape applies, and every fixture in this package's test suite is verified against both bundlers. `webpack` and `@rspack/core` are declared as **optional** peer dependencies, so you only need to install the one you use.
31
+
30
32
  ```js
31
33
  // webpack.config.js
32
34
  module.exports = {
package/lib/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import type { IconVariant } from './modules';
2
- import type { LoaderContext } from 'webpack';
2
+ import type { AtomicLoaderContext } from './loader-context';
3
3
  export type { IconVariant };
4
+ export type { AtomicLoaderContext };
4
5
  export interface FluentIconsAtomicImportLoaderOptions {
5
6
  /**
6
7
  * The icon variant to resolve atomic imports to. Defaults to `'svg'`.
@@ -58,4 +59,4 @@ export interface FluentIconsAtomicImportLoaderOptions {
58
59
  */
59
60
  allowDynamicImports?: boolean;
60
61
  }
61
- export default function fluentIconsAtomicImportLoader(this: LoaderContext<FluentIconsAtomicImportLoaderOptions>, sourceCode: string): void;
62
+ export default function fluentIconsAtomicImportLoader(this: AtomicLoaderContext, sourceCode: string): void;
@@ -0,0 +1,19 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ import type { FluentIconsAtomicImportLoaderOptions } from './index';
4
+ /**
5
+ * Hand-maintained description of the loader context members this loader uses.
6
+ *
7
+ * Deliberately not `import type { LoaderContext } from 'webpack'`: both bundlers are optional
8
+ * peers, so referencing webpack's types here would leak into the generated `.d.ts` and break
9
+ * type-checking for consumers who only installed `@rspack/core`.
10
+ *
11
+ * Members are intentionally wider than webpack's and rspack's, so both real loader contexts remain
12
+ * assignable. `test/types.conformance.ts` fails to compile if either bundler drifts out of bounds.
13
+ */
14
+ export interface AtomicLoaderContext {
15
+ readonly resourcePath: string;
16
+ getOptions(): FluentIconsAtomicImportLoaderOptions;
17
+ callback(err: Error | null | undefined, content?: string | Buffer, sourceMap?: any, additionalData?: any): void;
18
+ emitWarning(warning: Error): void;
19
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,12 +1,15 @@
1
1
  {
2
2
  "name": "@fluentui/react-icons-atomic-webpack-loader",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "Webpack loader that transforms barrel imports and re-exports from @fluentui/react-icons into atomic deep paths",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
7
7
  "build": "yarn run -T tsc -p .",
8
8
  "lint": "yarn run -T eslint package.json",
9
- "test": "yarn run -T vitest run && yarn run -T webpack -c test/webpack.config.js"
9
+ "test": "yarn run -T vitest run && yarn run test:types && node test/run.js --bundler all",
10
+ "test:types": "yarn run -T tsc -p test/tsconfig.conformance.json",
11
+ "test:webpack": "node test/run.js --bundler webpack",
12
+ "test:rspack": "node test/run.js --bundler rspack"
10
13
  },
11
14
  "engines": {
12
15
  "node": ">=20.0.0"
@@ -28,8 +31,17 @@
28
31
  "@fluentui/react-icons": "*"
29
32
  },
30
33
  "peerDependencies": {
34
+ "@rspack/core": ">=2.0.0",
31
35
  "webpack": ">=5.0.0"
32
36
  },
37
+ "peerDependenciesMeta": {
38
+ "@rspack/core": {
39
+ "optional": true
40
+ },
41
+ "webpack": {
42
+ "optional": true
43
+ }
44
+ },
33
45
  "files": [
34
46
  "lib/*"
35
47
  ]