Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: upgrade deps #733

Merged
merged 1 commit into from
Jun 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 5 additions & 9 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
module.exports = (api) => {
api.cache(true)

return {
presets: [
['@babel/preset-env', { targets: { node: '12' }, loose: true }],
'@babel/preset-typescript',
],
}
module.exports = {
presets: [
['@babel/preset-env', { targets: { node: '12' }, loose: true }],
'@babel/preset-typescript',
],
}
2 changes: 1 addition & 1 deletion examples/mocha-esm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
"test": "mocha --loader=./mock-loader.js example.test.js"
},
"devDependencies": {
"mocha": "^9.1.3"
"mocha": "^10.0.0"
}
}
6 changes: 3 additions & 3 deletions examples/webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"start": "webpack serve"
},
"devDependencies": {
"@svgr/webpack": "^6.0.0-alpha.2",
"@svgr/webpack": "^6.2.1",
"html-webpack-plugin": "^5.5.0",
"webpack": "^5.64.0",
"webpack-cli": "^4.9.1",
"webpack-dev-server": "^4.4.0"
"webpack-cli": "^4.10.0",
"webpack-dev-server": "^4.9.2"
}
}
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ module.exports = {
watchPathIgnorePatterns: ['__fixtures__', '__fixtures__build__'],
rootDir: 'packages',
transform: {
'^.+\\.(j|t)sx?$': 'babel-jest',
'^.+\\.(j|t)sx?$': ['babel-jest', { root: __dirname }],
},
}
16,400 changes: 8,530 additions & 7,870 deletions package-lock.json

Large diffs are not rendered by default.

40 changes: 20 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,32 @@
"scripts": {
"build": "build/build.sh",
"dev": "lerna run build --parallel -- --watch",
"format": "prettier --write \"**/*.{js,json,md}\"",
"lint": "eslint .",
"format": "prettier --write .",
"lint": "eslint . && prettier --check .",
"release": "lerna publish --conventional-commits && conventional-github-releaser --preset angular",
"test": "jest --runInBand"
},
"devDependencies": {
"@babel/core": "^7.16.0",
"@babel/preset-env": "^7.16.0",
"@babel/preset-typescript": "^7.16.0",
"@babel/core": "^7.18.5",
"@babel/preset-env": "^7.18.2",
"@babel/preset-typescript": "^7.17.12",
"@rollup/plugin-json": "^4.1.0",
"@types/jest": "^27.0.2",
"@typescript-eslint/eslint-plugin": "^5.3.1",
"@typescript-eslint/parser": "^5.3.1",
"babel-jest": "^27.3.1",
"@types/jest": "^28.1.2",
"@typescript-eslint/eslint-plugin": "^5.28.0",
"@typescript-eslint/parser": "^5.28.0",
"babel-jest": "^28.1.1",
"codecov": "^3.8.3",
"conventional-github-releaser": "^3.1.5",
"esbuild": "^0.13.13",
"eslint": "^8.2.0",
"eslint-plugin-react": "^7.27.0",
"eslint-plugin-react-hooks": "^4.3.0",
"jest": "^27.3.1",
"lerna": "^4.0.0",
"react": "^17.0.2",
"rollup": "^2.60.0",
"rollup-plugin-dts": "^4.0.1",
"rollup-plugin-esbuild": "^4.6.0",
"typescript": "^4.4.4"
"esbuild": "^0.14.46",
"eslint": "^8.18.0",
"eslint-plugin-react": "^7.30.0",
"eslint-plugin-react-hooks": "^4.6.0",
"jest": "^28.1.1",
"lerna": "^5.1.4",
"react": "^18.2.0",
"rollup": "^2.75.6",
"rollup-plugin-dts": "^4.2.2",
"rollup-plugin-esbuild": "^4.9.1",
"typescript": "^4.7.4"
}
}
18 changes: 5 additions & 13 deletions packages/babel-plugin-svg-dynamic-title/src/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { transform } from '@babel/core'
import plugin, { Options } from '.'

const testPlugin = (code: string, options: Options = {tag: 'title'}) => {
const testPlugin = (code: string, options: Options = { tag: 'title' }) => {
const result = transform(code, {
plugins: ['@babel/plugin-syntax-jsx', [plugin, options]],
configFile: false,
Expand All @@ -19,9 +19,7 @@ describe('title plugin', () => {

it('should add title element and fallback to existing title', () => {
// testing when the existing title contains a simple string
expect(
testPlugin(`<svg><title>Hello</title></svg>`),
).toMatchInlineSnapshot(
expect(testPlugin(`<svg><title>Hello</title></svg>`)).toMatchInlineSnapshot(
`"<svg>{title === undefined ? <title id={titleId}>Hello</title> : title ? <title id={titleId}>{title}</title> : null}</svg>;"`,
)
// testing when the existing title contains an JSXExpression
Expand All @@ -40,24 +38,18 @@ describe('title plugin', () => {
)
})
it('should support empty title', () => {
expect(
testPlugin('<svg><title></title></svg>'),
).toMatchInlineSnapshot(
expect(testPlugin('<svg><title></title></svg>')).toMatchInlineSnapshot(
`"<svg>{title ? <title id={titleId}>{title}</title> : null}</svg>;"`,
)
})
it('should support self closing title', () => {
expect(
testPlugin('<svg><title /></svg>'),
).toMatchInlineSnapshot(
expect(testPlugin('<svg><title /></svg>')).toMatchInlineSnapshot(
`"<svg>{title ? <title id={titleId}>{title}</title> : null}</svg>;"`,
)
})

it('should work if an attribute is already present', () => {
expect(
testPlugin('<svg><foo /></svg>'),
).toMatchInlineSnapshot(
expect(testPlugin('<svg><foo /></svg>')).toMatchInlineSnapshot(
`"<svg>{title ? <title id={titleId}>{title}</title> : null}<foo /></svg>;"`,
)
})
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@
"@svgr/plugin-svgo": "^6.2.0",
"camelcase": "^6.2.0",
"chalk": "^4.1.2",
"commander": "^8.2.0",
"commander": "^9.3.0",
"dashify": "^2.0.0",
"glob": "^7.1.7"
"glob": "^8.0.3"
},
"devDependencies": {
"@types/glob": "^7.2.0",
"del": "^6.0.0"
"del": "^6.1.1"
}
}
4 changes: 2 additions & 2 deletions packages/cli/src/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -608,10 +608,10 @@ exports[`cli should suppress output when transforming a directory with a --silen

exports[`cli should transform a whole directory and output relative destination paths 1`] = `
"
__fixtures__/cased/pascalcase.svg -> __fixtures_build__/whole/cased/pascalcase.js
__fixtures__/cased/camelcase.svg -> __fixtures_build__/whole/cased/camelcase.js
__fixtures__/cased/kebab-case.svg -> __fixtures_build__/whole/cased/kebabcase.js
__fixtures__/cased/multiple---dashes.svg -> __fixtures_build__/whole/cased/multipledashes.js
__fixtures__/cased/pascalcase.svg -> __fixtures_build__/whole/cased/pascalcase.js
__fixtures__/complex/skype.svg -> __fixtures_build__/whole/complex/skype.js
__fixtures__/complex/telegram.svg -> __fixtures_build__/whole/complex/telegram.js
__fixtures__/nesting/a/c/three.svg -> __fixtures_build__/whole/nesting/a/c/three.js
Expand All @@ -627,10 +627,10 @@ __fixtures__/withsvgrrc/file.svg -> __fixtures_build__/whole/withsvgrrc/file.js"

exports[`cli should transform a whole directory with --typescript 1`] = `
"
__fixtures__/cased/pascalcase.svg -> __fixtures_build__/whole/cased/pascalcase.tsx
__fixtures__/cased/camelcase.svg -> __fixtures_build__/whole/cased/camelcase.tsx
__fixtures__/cased/kebab-case.svg -> __fixtures_build__/whole/cased/kebabcase.tsx
__fixtures__/cased/multiple---dashes.svg -> __fixtures_build__/whole/cased/multipledashes.tsx
__fixtures__/cased/pascalcase.svg -> __fixtures_build__/whole/cased/pascalcase.tsx
__fixtures__/complex/skype.svg -> __fixtures_build__/whole/complex/skype.tsx
__fixtures__/complex/telegram.svg -> __fixtures_build__/whole/complex/telegram.tsx
__fixtures__/nesting/a/c/three.svg -> __fixtures_build__/whole/nesting/a/c/three.tsx
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/dirCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export const dirCommand: SvgrCommand = async (
}

const dest = path.resolve(outDir as string, path.relative(root, filename))
return write(filename, dest).catch(err => {
return write(filename, dest).catch((err) => {
console.error('Failed to handle file: ', filename)
throw err
})
Expand Down
25 changes: 11 additions & 14 deletions packages/cli/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ const exec = promisify(execCb)

const svgr = path.join(__dirname, '../bin/svgr')

const sortCliResult = (result: string) => {
return result
.split(/\n/)
.sort((a, b) => a.localeCompare(b))
.map((x) => x.toLowerCase())
.join('\n')
}

describe('cli', () => {
const cli = async (args: string) => {
const { stdout } = await exec(`${svgr} ${args}`)
Expand Down Expand Up @@ -56,32 +64,21 @@ describe('cli', () => {

it('should transform a whole directory and output relative destination paths', async () => {
const result = await cli('--out-dir __fixtures_build__/whole __fixtures__')
const sorted = result
.split(/\n/)
.sort()
.map((x) => x.toLowerCase())
.join('\n')
expect(sorted).toMatchSnapshot()
expect(sortCliResult(result)).toMatchSnapshot()
})

it('should transform a whole directory with --typescript', async () => {
const result = await cli(
'--typescript --out-dir __fixtures_build__/whole __fixtures__',
)
const sorted = result
.split(/\n/)
.sort()
.map((x) => x.toLowerCase())
.join('\n')
expect(sorted).toMatchSnapshot()
expect(sortCliResult(result)).toMatchSnapshot()
})

it('should suppress output when transforming a directory with a --silent option', async () => {
const result = await cli(
'--silent --out-dir __fixtures_build__/whole __fixtures__',
)
const sorted = result.split(/\n/).sort().join('\n')
expect(sorted).toMatchSnapshot()
expect(sortCliResult(result)).toMatchSnapshot()
})

it('should support --prettier-config as json', async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@
"cosmiconfig": "^7.0.1"
},
"devDependencies": {
"@types/svgo": "^2.6.0"
"@types/svgo": "^2.6.3"
}
}
4 changes: 2 additions & 2 deletions packages/hast-util-to-babel-ast/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
},
"license": "MIT",
"dependencies": {
"@babel/types": "^7.15.6",
"entities": "^3.0.1"
"@babel/types": "^7.18.4",
"entities": "^4.3.0"
},
"scripts": {
"reset": "rm -rf dist",
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-jsx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
"@svgr/core": "^6.0.0"
},
"dependencies": {
"@babel/core": "^7.15.5",
"@babel/core": "^7.18.5",
"@svgr/babel-preset": "^6.2.0",
"@svgr/hast-util-to-babel-ast": "^6.2.1",
"svg-parser": "^2.0.2"
"svg-parser": "^2.0.4"
}
}
2 changes: 1 addition & 1 deletion packages/plugin-prettier/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
},
"dependencies": {
"deepmerge": "^4.2.2",
"prettier": "^2.4.0"
"prettier": "^2.7.1"
}
}
2 changes: 1 addition & 1 deletion packages/plugin-svgo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@
"dependencies": {
"cosmiconfig": "^7.0.1",
"deepmerge": "^4.2.2",
"svgo": "^2.5.0"
"svgo": "^2.8.0"
}
}
14 changes: 7 additions & 7 deletions packages/rollup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,18 @@
"prepublishOnly": "npm run reset && npm run build"
},
"dependencies": {
"@babel/core": "^7.15.5",
"@babel/plugin-transform-react-constant-elements": "^7.14.5",
"@babel/preset-env": "^7.15.6",
"@babel/preset-react": "^7.14.5",
"@babel/preset-typescript": "^7.16.0",
"@rollup/pluginutils": "^4.1.2",
"@babel/core": "^7.18.5",
"@babel/plugin-transform-react-constant-elements": "^7.17.12",
"@babel/preset-env": "^7.18.2",
"@babel/preset-react": "^7.17.12",
"@babel/preset-typescript": "^7.17.12",
"@rollup/pluginutils": "^4.2.1",
"@svgr/core": "^6.2.1",
"@svgr/plugin-jsx": "^6.2.1",
"@svgr/plugin-svgo": "^6.2.0"
},
"devDependencies": {
"rollup": "^2.56.3",
"rollup": "^2.75.6",
"rollup-plugin-image": "^1.0.2",
"rollup-plugin-url": "^3.0.1"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/rollup/src/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`rollup loader should convert file 1`] = `
"var _path;

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

import * as React from \\"react\\";

Expand Down
2 changes: 1 addition & 1 deletion packages/rollup/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const plugin: PluginImpl<Options> = (options = {}) => {
body: [],
},
code: jsCode,
map: null
map: null,
}
},
}
Expand Down
2 changes: 1 addition & 1 deletion packages/webpack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ By default, `@svgr/webpack` includes a `babel-loader` with [an optimized configu
It is possible to detect the module that requires your SVG using [`Rule.issuer`](https://webpack.js.org/configuration/module/#ruleissuer) in Webpack 5. Using it you can specify two different configurations for JavaScript and the rest of your files.

```js
[
;[
{
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
issuer: /\.[jt]sx?$/,
Expand Down
14 changes: 7 additions & 7 deletions packages/webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,19 @@
"prepublishOnly": "npm run reset && npm run build"
},
"dependencies": {
"@babel/core": "^7.15.5",
"@babel/plugin-transform-react-constant-elements": "^7.14.5",
"@babel/preset-env": "^7.15.6",
"@babel/preset-react": "^7.14.5",
"@babel/preset-typescript": "^7.15.0",
"@babel/core": "^7.18.5",
"@babel/plugin-transform-react-constant-elements": "^7.17.12",
"@babel/preset-env": "^7.18.2",
"@babel/preset-react": "^7.17.12",
"@babel/preset-typescript": "^7.17.12",
"@svgr/core": "^6.2.1",
"@svgr/plugin-jsx": "^6.2.1",
"@svgr/plugin-svgo": "^6.2.0"
},
"devDependencies": {
"babel-loader": "^8.2.2",
"babel-loader": "^8.2.5",
"memory-fs": "^0.5.0",
"url-loader": "^4.1.1",
"webpack": "^5.52.1"
"webpack": "^5.73.0"
}
}
2 changes: 1 addition & 1 deletion packages/webpack/src/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default SvgIcon;"
exports[`webpack loader transforms file (typescript: true) 1`] = `
"var _g;

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

import * as React from \\"react\\";

Expand Down