Compare commits

..

4 Commits

Author SHA1 Message Date
JJ Kasper
a32ba8f214 Publish Stable
- @vercel/next@2.6.16
2020-07-30 14:15:29 -05:00
JJ Kasper
d416f70a6e Publish Canary
- @vercel/frameworks@0.0.18-canary.2
 - vercel@20.0.0-canary.8
 - @vercel/next@2.6.16-canary.0
 - @vercel/node@1.7.5-canary.0
 - @vercel/routing-utils@1.8.4-canary.0
 - @vercel/redwood@0.0.2-canary.2
2020-07-30 13:45:26 -05:00
JJ Kasper
ba9e1dd0ba [routing-utils] Update header replacing to handle more cases (#4942)
This adds handling for more cases while updating header values to make sure to escape any characters that could break compiling with `path-to-regexp`

x-ref: https://github.com/vercel/next.js/pull/15592
2020-07-30 18:22:30 +00:00
Steven
d513f74b70 [frameworks][redwood] Bump to RedwoodJS to 0.15.0 (#4953)
Implements https://github.com/redwoodjs/redwood/pull/904
2020-07-30 10:52:04 -04:00
18 changed files with 15012 additions and 539 deletions

View File

@@ -3,6 +3,6 @@
"version": "0.0.0",
"private": true,
"dependencies": {
"@redwoodjs/api": "0.14.0"
"@redwoodjs/api": "0.15.0"
}
}

View File

@@ -7,7 +7,7 @@
]
},
"devDependencies": {
"@redwoodjs/core": "0.14.0"
"@redwoodjs/core": "0.15.0"
},
"eslintConfig": {
"extends": "@redwoodjs/eslint-config"

View File

@@ -6,8 +6,8 @@
"defaults"
],
"dependencies": {
"@redwoodjs/router": "0.14.0",
"@redwoodjs/web": "0.14.0",
"@redwoodjs/router": "0.15.0",
"@redwoodjs/web": "0.15.0",
"prop-types": "^15.7.2",
"react": "^16.13.1",
"react-dom": "^16.13.1"

14339
examples/redwoodjs/yarn.lock Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -703,7 +703,7 @@
"value": "yarn rw db up --no-db-client --auto-approve && yarn rw build"
},
"devCommand": {
"value": "yarn rw dev"
"value": "yarn rw dev --fwd=\"--port=$PORT --open=false\""
},
"outputDirectory": {
"value": "RedwoodJS default"

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/frameworks",
"version": "0.0.18-canary.1",
"version": "0.0.18-canary.2",
"main": "frameworks.json",
"license": "UNLICENSED",
"scripts": {

View File

@@ -1,6 +1,6 @@
{
"name": "vercel",
"version": "20.0.0-canary.7",
"version": "20.0.0-canary.8",
"preferGlobal": true,
"license": "Apache-2.0",
"description": "The command-line interface for Vercel",
@@ -64,10 +64,10 @@
"dependencies": {
"@vercel/build-utils": "2.4.3-canary.2",
"@vercel/go": "1.1.5-canary.0",
"@vercel/next": "2.6.15",
"@vercel/node": "1.7.4",
"@vercel/next": "2.6.16",
"@vercel/node": "1.7.5-canary.0",
"@vercel/python": "1.2.2",
"@vercel/redwood": "0.0.2-canary.1",
"@vercel/redwood": "0.0.2-canary.2",
"@vercel/ruby": "1.2.3",
"@vercel/static-build": "0.17.7-canary.1",
"update-notifier": "4.1.0"

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/next",
"version": "2.6.15",
"version": "2.6.16",
"license": "MIT",
"main": "./dist/index",
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/next-js",

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/node",
"version": "1.7.4",
"version": "1.7.5-canary.0",
"license": "MIT",
"main": "./dist/index",
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/node-js",

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/routing-utils",
"version": "1.8.3",
"version": "1.8.4-canary.0",
"description": "Vercel routing utilities",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",

View File

@@ -218,18 +218,42 @@ function replaceSegments(
return destination;
}
function safelyCompile(str: string, indexes: { [k: string]: string }): string {
if (!str) {
return str;
function safelyCompile(
value: string,
indexes: { [k: string]: string }
): string {
if (!value) {
return value;
}
// path-to-regexp cannot compile question marks
return str
.split('?')
.map(part => {
const compiler = compile(part);
return compiler(indexes);
})
.join('?');
for (const key of Object.keys(indexes)) {
if (value.includes(`:${key}`)) {
value = value
.replace(
new RegExp(`:${key}\\*`, 'g'),
`:${key}--ESCAPED_PARAM_ASTERISK`
)
.replace(
new RegExp(`:${key}\\?`, 'g'),
`:${key}--ESCAPED_PARAM_QUESTION`
)
.replace(new RegExp(`:${key}\\+`, 'g'), `:${key}--ESCAPED_PARAM_PLUS`)
.replace(
new RegExp(`:${key}(?!\\w)`, 'g'),
`--ESCAPED_PARAM_COLON${key}`
);
}
}
value = value
.replace(/(:|\*|\?|\+|\(|\)|\{|\})/g, '\\$1')
.replace(/--ESCAPED_PARAM_PLUS/g, '+')
.replace(/--ESCAPED_PARAM_COLON/g, ':')
.replace(/--ESCAPED_PARAM_QUESTION/g, '?')
.replace(/--ESCAPED_PARAM_ASTERISK/g, '*');
// the value needs to start with a forward-slash to be compiled
// correctly
return compile(`/${value}`, { validate: false })(indexes).substr(1);
}
function toSegmentDest(index: number): string {

View File

@@ -508,6 +508,60 @@ test('convertHeaders', () => {
},
],
},
{
source: '/like/params/:path',
headers: [
{
key: 'x-path',
value: ':path',
},
{
key: 'some:path',
value: 'hi',
},
{
key: 'x-test',
value: 'some:value*',
},
{
key: 'x-test-2',
value: 'value*',
},
{
key: 'x-test-3',
value: ':value?',
},
{
key: 'x-test-4',
value: ':value+',
},
{
key: 'x-test-5',
value: 'something https:',
},
{
key: 'x-test-6',
value: ':hello(world)',
},
{
key: 'x-test-7',
value: 'hello(world)',
},
{
key: 'x-test-8',
value: 'hello{1,}',
},
{
key: 'x-test-9',
value: ':hello{1,2}',
},
{
key: 'content-security-policy',
value:
"default-src 'self'; img-src *; media-src media1.com media2.com; script-src userscripts.example.com/:path",
},
],
},
]);
const expected = [
@@ -526,6 +580,25 @@ test('convertHeaders', () => {
headers: { 'on-blog': '$1', $1: 'blog' },
continue: true,
},
{
continue: true,
headers: {
'content-security-policy':
"default-src 'self'; img-src *; media-src media1.com media2.com; script-src userscripts.example.com/$1",
some$1: 'hi',
'x-path': '$1',
'x-test': 'some:value*',
'x-test-2': 'value*',
'x-test-3': ':value?',
'x-test-4': ':value+',
'x-test-5': 'something https:',
'x-test-6': ':hello(world)',
'x-test-7': 'hello(world)',
'x-test-8': 'hello{1,}',
'x-test-9': ':hello{1,2}',
},
src: '^\\/like\\/params(?:\\/([^\\/]+?))$',
},
];
deepEqual(actual, expected);
@@ -534,12 +607,14 @@ test('convertHeaders', () => {
['hello/world/file.eot', 'another/font.ttf', 'dir/arial.font.css'],
['404.html'],
['/blog/first-post', '/blog/another/one'],
['/like/params/first', '/like/params/second'],
];
const mustNotMatch = [
['hello/file.jpg', 'hello/font-css', 'dir/arial.font-css'],
['403.html', '500.html'],
['/blogg', '/random'],
['/non-match', '/like/params', '/like/params/'],
];
assertRegexMatches(actual, mustMatch, mustNotMatch);

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/redwood",
"version": "0.0.2-canary.1",
"version": "0.0.2-canary.2",
"main": "./dist/index.js",
"license": "MIT",
"homepage": "https://vercel.com/docs",

View File

@@ -3,6 +3,6 @@
"version": "0.0.0",
"private": true,
"dependencies": {
"@redwoodjs/api": "0.14.0"
"@redwoodjs/api": "0.15.0"
}
}

View File

@@ -7,7 +7,7 @@
]
},
"devDependencies": {
"@redwoodjs/core": "0.14.0"
"@redwoodjs/core": "0.15.0"
},
"engines": {
"node": ">=12",

View File

@@ -14,7 +14,7 @@
"method": "POST",
"headers": { "Accept": "application/json" },
"body": { "query": "{ redwood { version } }" },
"mustContain": "0.14.0"
"mustContain": "0.15.0"
}
]
}

View File

@@ -6,8 +6,8 @@
"defaults"
],
"dependencies": {
"@redwoodjs/router": "0.14.0",
"@redwoodjs/web": "0.14.0",
"@redwoodjs/router": "0.15.0",
"@redwoodjs/web": "0.15.0",
"prop-types": "^15.7.2",
"react": "^16.13.1",
"react-dom": "^16.13.1"

File diff suppressed because it is too large Load Diff