Skip to content

Commit 7f258ab

Browse files
committed
feat: support file-loader v5
Fixes #367
1 parent 24d126b commit 7f258ab

File tree

12 files changed

+2907
-2857
lines changed

12 files changed

+2907
-2857
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"codecov": "^3.5.0",
3030
"conventional-github-releaser": "^3.1.3",
3131
"eslint": "^6.0.1",
32-
"eslint-config-airbnb": "^17.1.0",
32+
"eslint-config-airbnb": "^18.0.1",
3333
"eslint-config-prettier": "^6.0.0",
3434
"eslint-plugin-import": "^2.17.3",
3535
"eslint-plugin-jsx-a11y": "^6.2.1",

packages/cli/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
"@svgr/plugin-prettier": "^4.3.2",
3232
"@svgr/plugin-svgo": "^4.3.1",
3333
"camelcase": "^5.3.1",
34-
"chalk": "^2.4.2",
35-
"commander": "^2.20.0",
34+
"chalk": "^3.0.0",
35+
"commander": "^4.0.1",
3636
"dashify": "^2.0.0",
3737
"glob": "^7.1.4",
3838
"output-file-sync": "^2.0.1",

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@
2727
"dependencies": {
2828
"@svgr/plugin-jsx": "^4.3.3",
2929
"camelcase": "^5.3.1",
30-
"cosmiconfig": "^5.2.1"
30+
"cosmiconfig": "^6.0.0"
3131
}
3232
}

packages/core/src/config.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import cosmiconfig from 'cosmiconfig'
1+
import { cosmiconfig, cosmiconfigSync } from 'cosmiconfig'
22

33
export const DEFAULT_CONFIG = {
44
h2xConfig: null,
@@ -25,6 +25,12 @@ const explorer = cosmiconfig('svgr', {
2525
rcExtensions: true,
2626
})
2727

28+
const explorerSync = cosmiconfigSync('svgr', {
29+
sync: true,
30+
cache: true,
31+
rcExtensions: true,
32+
})
33+
2834
export async function resolveConfig(searchFrom, configFile) {
2935
if (configFile == null) {
3036
const result = await explorer.search(searchFrom)
@@ -36,10 +42,10 @@ export async function resolveConfig(searchFrom, configFile) {
3642

3743
resolveConfig.sync = (searchFrom, configFile) => {
3844
if (configFile == null) {
39-
const result = explorer.searchSync(searchFrom)
45+
const result = explorerSync.search(searchFrom)
4046
return result ? result.config : null
4147
}
42-
const result = explorer.loadSync(configFile)
48+
const result = explorerSync.load(configFile)
4349
return result ? result.config : null
4450
}
4551

@@ -49,7 +55,7 @@ export async function resolveConfigFile(filePath) {
4955
}
5056

5157
resolveConfigFile.sync = filePath => {
52-
const result = explorer.searchSync(filePath)
58+
const result = explorerSync.search(filePath)
5359
return result ? result.filepath : null
5460
}
5561

packages/parcel-plugin-svgr/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
"parcel-bundler": "^1.10.0"
2929
},
3030
"dependencies": {
31-
"@babel/core": "^7.4.5",
32-
"@babel/plugin-transform-react-constant-elements": "^7.0.0",
33-
"@babel/preset-env": "^7.4.5",
34-
"@babel/preset-react": "^7.0.0",
31+
"@babel/core": "^7.7.5",
32+
"@babel/plugin-transform-react-constant-elements": "^7.7.4",
33+
"@babel/preset-env": "^7.7.6",
34+
"@babel/preset-react": "^7.7.4",
3535
"@svgr/core": "^4.3.3",
3636
"@svgr/plugin-jsx": "^4.3.3",
3737
"@svgr/plugin-svgo": "^4.3.1"

packages/plugin-jsx/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
"prepublishOnly": "yarn run build"
2222
},
2323
"dependencies": {
24-
"@babel/core": "^7.4.5",
24+
"@babel/core": "^7.7.5",
2525
"@svgr/babel-preset": "^4.3.3",
2626
"@svgr/hast-util-to-babel-ast": "^4.3.2",
27-
"svg-parser": "^2.0.0"
27+
"svg-parser": "^2.0.2"
2828
}
2929
}

packages/plugin-svgo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"prepublishOnly": "yarn run build"
2222
},
2323
"dependencies": {
24-
"cosmiconfig": "^5.2.1",
24+
"cosmiconfig": "^6.0.0",
2525
"merge-deep": "^3.0.2",
2626
"svgo": "^1.2.2"
2727
}

packages/plugin-svgo/src/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/* eslint-disable no-underscore-dangle */
22
import SVGO from 'svgo'
3-
import cosmiconfig from 'cosmiconfig'
3+
import { cosmiconfigSync } from 'cosmiconfig'
44
import mergeDeep from 'merge-deep'
55

6-
const explorer = cosmiconfig('svgo', {
6+
const explorer = cosmiconfigSync('svgo', {
77
searchPlaces: [
88
'package.json',
99
'.svgorc',
@@ -114,7 +114,7 @@ function getInfo(state) {
114114
export default function svgoPlugin(code, config, state) {
115115
if (!config.svgo) return code
116116
const filePath = getFilePath(state)
117-
const svgoRcConfig = config.runtimeConfig ? explorer.searchSync(filePath) : {}
117+
const svgoRcConfig = config.runtimeConfig ? explorer.search(filePath) : {}
118118
const svgo = createSvgo(config, svgoRcConfig)
119119
const { data } = optimizeSync.call(svgo, code, getInfo(state))
120120
return data

packages/rollup/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,18 @@
2525
"prepublishOnly": "yarn run build"
2626
},
2727
"dependencies": {
28-
"@babel/core": "^7.4.5",
29-
"@babel/plugin-transform-react-constant-elements": "^7.0.0",
30-
"@babel/preset-env": "^7.4.5",
31-
"@babel/preset-react": "^7.0.0",
28+
"@babel/core": "^7.7.5",
29+
"@babel/plugin-transform-react-constant-elements": "^7.7.4",
30+
"@babel/preset-env": "^7.7.6",
31+
"@babel/preset-react": "^7.7.4",
3232
"@svgr/core": "^4.3.3",
3333
"@svgr/plugin-jsx": "^4.3.3",
3434
"@svgr/plugin-svgo": "^4.3.1",
35-
"rollup-pluginutils": "^2.8.1"
35+
"rollup-pluginutils": "^2.8.2"
3636
},
3737
"devDependencies": {
3838
"rollup": "^1.14.2",
3939
"rollup-plugin-image": "^1.0.2",
40-
"rollup-plugin-url": "^2.2.1"
40+
"rollup-plugin-url": "^3.0.1"
4141
}
4242
}

packages/webpack/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
},
3737
"devDependencies": {
3838
"babel-loader": "^8.0.6",
39-
"memory-fs": "^0.4.1",
40-
"url-loader": "^2.0.0",
39+
"memory-fs": "^0.5.0",
40+
"url-loader": "^3.0.0",
4141
"webpack": "^4.33.0"
4242
}
4343
}

0 commit comments

Comments
 (0)