next-remove-imports 1.0.9 → 1.0.10

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
@@ -30,7 +30,8 @@ import removeImports from 'next-remove-imports'
30
30
 
31
31
  /** @type {function(import("next").NextConfig): import("next").NextConfig}} */
32
32
  const removeImportsFun = removeImports({
33
- options: { },
33
+ // test: /node_modules([\s\S]*?)\.(tsx|ts|js|mjs|jsx)$/,
34
+ // matchImports: "\\.(less|css|scss|sass|styl)$"
34
35
  });
35
36
 
36
37
  export default removeImportsFun({
@@ -83,6 +84,21 @@ module.exports = (phase, { defaultConfig }) => {
83
84
  };
84
85
  ```
85
86
 
87
+ ## Options
88
+
89
+ ```typescript
90
+ export type PluginOptions = {
91
+ /**
92
+ * @default "/node_modules([\s\S]*?)\.(tsx|ts|js|mjs|jsx)$/"
93
+ */
94
+ test?: RegExp;
95
+ /**
96
+ * @default "\\.(less|css|scss|sass|styl)$"
97
+ */
98
+ matchImports?: string;
99
+ }
100
+ ```
101
+
86
102
  ## License
87
103
 
88
104
  Licensed under the MIT License.
package/lib/index.d.ts CHANGED
@@ -1,6 +1,12 @@
1
1
  import { NextConfig } from 'next';
2
- declare type PluginOptions = {
2
+ export declare type PluginOptions = {
3
+ /**
4
+ * @default "/node_modules([\s\S]*?)\.(tsx|ts|js|mjs|jsx)$/"
5
+ */
3
6
  test?: RegExp;
7
+ /**
8
+ * @default "\\.(less|css|scss|sass|styl)$"
9
+ */
4
10
  matchImports?: string;
5
11
  };
6
12
  declare const _default: (pluginOptions?: PluginOptions) => (nextConfig?: NextConfig) => NextConfig;
package/lib/index.js.map CHANGED
@@ -32,7 +32,7 @@
32
32
  "../src/index.ts"
33
33
  ],
34
34
  "sourcesContent": [
35
- "import { NextConfig } from 'next';\nimport { WebpackConfigContext } from 'next/dist/server/config-shared';\n\ntype PluginOptions = {\n test?: RegExp;\n matchImports?: string;\n}\n\nexport default (pluginOptions: PluginOptions = {}) => (nextConfig: NextConfig = {}): NextConfig => {\n const test = pluginOptions.test || /node_modules([\\s\\S]*?)\\.(tsx|ts|js|mjs|jsx)$/;\n const matchImports = pluginOptions.matchImports || \"\\\\.(less|css|scss|sass|styl)$\";\n return Object.assign({}, nextConfig, {\n webpack(config: any, options: WebpackConfigContext) {\n if (!options.isServer) {\n config.module.rules.unshift({\n test: test,\n loader: require.resolve('babel-loader', {\n paths: [process.cwd()]\n }),\n options: {\n plugins: [\n [\n require.resolve('babel-plugin-transform-remove-imports', {\n // https://nodejs.org/api/modules.html#requireresolverequest-options\n paths: [process.cwd()]\n }), {\n \"test\": matchImports\n }\n ]\n ]\n }\n });\n }\n if (typeof nextConfig.webpack === 'function') {\n return nextConfig.webpack(config, options)\n }\n return config\n },\n })\n}\n\n"
35
+ "import { NextConfig } from 'next';\nimport { WebpackConfigContext } from 'next/dist/server/config-shared';\n\nexport type PluginOptions = {\n /**\n * @default \"/node_modules([\\s\\S]*?)\\.(tsx|ts|js|mjs|jsx)$/\"\n */\n test?: RegExp;\n /**\n * @default \"\\\\.(less|css|scss|sass|styl)$\"\n */\n matchImports?: string;\n}\n\nexport default (pluginOptions: PluginOptions = {}) => (nextConfig: NextConfig = {}): NextConfig => {\n const test = pluginOptions.test || /node_modules([\\s\\S]*?)\\.(tsx|ts|js|mjs|jsx)$/;\n const matchImports = pluginOptions.matchImports || \"\\\\.(less|css|scss|sass|styl)$\";\n return Object.assign({}, nextConfig, {\n webpack(config: any, options: WebpackConfigContext) {\n if (!options.isServer) {\n config.module.rules.unshift({\n test: test,\n loader: require.resolve('babel-loader', {\n paths: [process.cwd()]\n }),\n options: {\n plugins: [\n [\n require.resolve('babel-plugin-transform-remove-imports', {\n // https://nodejs.org/api/modules.html#requireresolverequest-options\n paths: [process.cwd()]\n }), {\n \"test\": matchImports\n }\n ]\n ]\n }\n });\n }\n if (typeof nextConfig.webpack === 'function') {\n return nextConfig.webpack(config, options)\n }\n return config\n },\n })\n}\n\n"
36
36
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CAAAU,OAAA,GAAAA,OAAA,CAAAC,OAAA"
38
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-remove-imports",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "description": "The default behavior is to remove all `.less`/`.css`/`.scss`/`.sass`/`.styl` imports from all packages in node_modules.",
5
5
  "homepage": "https://uiwjs.github.io/next-remove-imports/",
6
6
  "main": "./lib/index.js",