next-remove-imports 1.0.8 → 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 +33 -1
- package/lib/index.d.ts +7 -1
- package/lib/index.js.map +9 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ This is a plugin for [nextjs](https://github.com/vercel/next.js). The default be
|
|
|
11
11
|
> - https://github.com/uiwjs/react-md-editor/issues/52#issuecomment-848969341
|
|
12
12
|
> - https://github.com/vercel/next.js/issues/9607
|
|
13
13
|
> - Example: https://codesandbox.io/s/nextjs-example-react-md-editor-qjhn7?file=/pages/index.js
|
|
14
|
-
> - Example: [@uiwjs/next-remove-imports/example](https://github.com/uiwjs/next-remove-imports/tree/main/example)
|
|
14
|
+
> - Example: [@uiwjs/next-remove-imports/example](https://github.com/uiwjs/next-remove-imports/tree/main/example/cjs)
|
|
15
15
|
> - Example: https://next-remove-imports-example.vercel.app
|
|
16
16
|
|
|
17
17
|
## Install
|
|
@@ -24,6 +24,23 @@ yarn add next-remove-imports
|
|
|
24
24
|
|
|
25
25
|
## Usage
|
|
26
26
|
|
|
27
|
+
```javascript
|
|
28
|
+
// next.config.mjs
|
|
29
|
+
import removeImports from 'next-remove-imports'
|
|
30
|
+
|
|
31
|
+
/** @type {function(import("next").NextConfig): import("next").NextConfig}} */
|
|
32
|
+
const removeImportsFun = removeImports({
|
|
33
|
+
// test: /node_modules([\s\S]*?)\.(tsx|ts|js|mjs|jsx)$/,
|
|
34
|
+
// matchImports: "\\.(less|css|scss|sass|styl)$"
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export default removeImportsFun({
|
|
38
|
+
webpack(config, options) {
|
|
39
|
+
return config
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
```
|
|
43
|
+
|
|
27
44
|
```js
|
|
28
45
|
// next.config.js
|
|
29
46
|
const removeImports = require('next-remove-imports')({
|
|
@@ -67,6 +84,21 @@ module.exports = (phase, { defaultConfig }) => {
|
|
|
67
84
|
};
|
|
68
85
|
```
|
|
69
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
|
+
|
|
70
102
|
## License
|
|
71
103
|
|
|
72
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
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"names": [
|
|
4
|
+
"_default",
|
|
4
5
|
"pluginOptions",
|
|
6
|
+
"arguments",
|
|
7
|
+
"length",
|
|
8
|
+
"undefined",
|
|
5
9
|
"nextConfig",
|
|
6
10
|
"test",
|
|
7
11
|
"matchImports",
|
|
@@ -20,13 +24,15 @@
|
|
|
20
24
|
"paths",
|
|
21
25
|
"process",
|
|
22
26
|
"cwd",
|
|
23
|
-
"plugins"
|
|
27
|
+
"plugins",
|
|
28
|
+
"exports",
|
|
29
|
+
"default"
|
|
24
30
|
],
|
|
25
31
|
"sources": [
|
|
26
32
|
"../src/index.ts"
|
|
27
33
|
],
|
|
28
34
|
"sourcesContent": [
|
|
29
|
-
"import { NextConfig } from 'next';\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"
|
|
30
36
|
],
|
|
31
|
-
"mappings": ";;;;;;
|
|
37
|
+
"mappings": ";;;;;;eAce,SAAAA,SAAA;EAAA,IAACC,aAA4B,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAAA,OAAK,YAA6C;IAAA,IAA5CG,UAAsB,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;IAChF,IAAMI,IAAI,GAAGL,aAAa,CAACK,IAAI,IAAI,8CAA8C;IACjF,IAAMC,YAAY,GAAGN,aAAa,CAACM,YAAY,IAAI,+BAA+B;IAClF,OAAOC,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,EAAEJ,UAAU,EAAE;MACnCK,OAAO,WAAAA,QAACC,MAAW,EAAEC,OAA6B,EAAE;QAClD,IAAI,CAACA,OAAO,CAACC,QAAQ,EAAE;UACrBF,MAAM,CAACG,MAAM,CAACC,KAAK,CAACC,OAAO,CAAC;YAC1BV,IAAI,EAAEA,IAAI;YACVW,MAAM,EAAEC,OAAO,CAACC,OAAO,CAAC,cAAc,EAAE;cACtCC,KAAK,EAAE,CAACC,OAAO,CAACC,GAAG,EAAE;YACvB,CAAC,CAAC;YACFV,OAAO,EAAE;cACPW,OAAO,EAAE,CACP,CACEL,OAAO,CAACC,OAAO,CAAC,uCAAuC,EAAE;gBACvD;gBACAC,KAAK,EAAE,CAACC,OAAO,CAACC,GAAG,EAAE;cACvB,CAAC,CAAC,EAAE;gBACF,MAAM,EAAEf;cACV,CAAC,CACF;YAEL;UACF,CAAC,CAAC;QACJ;QACA,IAAI,OAAOF,UAAU,CAACK,OAAO,KAAK,UAAU,EAAE;UAC5C,OAAOL,UAAU,CAACK,OAAO,CAACC,MAAM,EAAEC,OAAO,CAAC;QAC5C;QACA,OAAOD,MAAM;MACf;IACF,CAAC,CAAC;EACJ,CAAC;AAAA;AAAAa,OAAA,cAAAxB,QAAA;AAAAc,MAAA,CAAAU,OAAA,GAAAA,OAAA,CAAAC,OAAA"
|
|
32
38
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-remove-imports",
|
|
3
|
-
"version": "1.0.
|
|
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",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@babel/core": "^7.14.3",
|
|
28
|
-
"babel-loader": "^
|
|
28
|
+
"babel-loader": "^9.0.0",
|
|
29
29
|
"babel-plugin-transform-remove-imports": "^1.5.4"
|
|
30
30
|
}
|
|
31
31
|
}
|