1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
Description: fix for path-to-regex 8
Also replace rollup-plugin-buble with @rollup/plugin-babel because buble
cannot transpile modern ES6+ syntax (generator functions, for...of loops)
used by path-to-regexp v8.
Author: Yadd <yadd@debian.org>
Bug-Debian: https://bugs.debian.org/1120203
Forwarded: no
Last-Update: 2025-11-06
--- a/build/configs.js
+++ b/build/configs.js
@@ -1,5 +1,5 @@
const path = require('path')
-const buble = require('rollup-plugin-buble')
+const {babel} = require('@rollup/plugin-babel')
const flow = require('rollup-plugin-flow-no-whitespace')
const cjs = require('@rollup/plugin-commonjs')
const node = require('@rollup/plugin-node-resolve').nodeResolve
@@ -97,7 +97,19 @@
}
if (opts.transpile !== false) {
- config.input.plugins.push(buble())
+ config.input.plugins.push(babel({
+ exclude: 'node_modules/**',
+ babelHelpers: 'bundled',
+ presets: [
+ ['@babel/preset-env', {
+ modules: false,
+ targets: {
+ browsers: ['> 1%', 'last 2 versions', 'not ie <= 8']
+ }
+ }]
+ ],
+ babelrc: false
+ }))
}
return config
--- a/src/create-route-map.js
+++ b/src/create-route-map.js
@@ -194,7 +194,9 @@
path: string,
pathToRegexpOptions: PathToRegexpOptions
): RouteRegExp {
- const regex = Regexp(path, [], pathToRegexpOptions)
+ const result = Regexp(path, pathToRegexpOptions)
+ const regex = result.regexp
+ regex.keys = result.keys
if (process.env.NODE_ENV !== 'production') {
const keys: any = Object.create(null)
regex.keys.forEach(key => {
--- a/src/util/params.js
+++ b/src/util/params.js
@@ -23,7 +23,7 @@
// and fix #3106 so that you can work with location descriptor object having params.pathMatch equal to empty string
if (typeof params.pathMatch === 'string') params[0] = params.pathMatch
- return filler(params, { pretty: true })
+ return filler(params)
} catch (e) {
if (process.env.NODE_ENV !== 'production') {
// Fix #3072 no warn if `pathMatch` is string
|