mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-11 12:57:46 +00:00
Compare commits
71 Commits
@now/pytho
...
@now/pytho
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
08641ab804 | ||
|
|
e7f87ceba7 | ||
|
|
e9632699e1 | ||
|
|
a9427bbe76 | ||
|
|
cd700b01cc | ||
|
|
12244133f8 | ||
|
|
55acea648c | ||
|
|
48a6b77fed | ||
|
|
b0e20c043c | ||
|
|
88ceaf12d0 | ||
|
|
0f94a523a6 | ||
|
|
0b3a01d07b | ||
|
|
c03d9479e1 | ||
|
|
8d987243c6 | ||
|
|
23d877de75 | ||
|
|
8855813697 | ||
|
|
5ca59332ed | ||
|
|
860a678b74 | ||
|
|
ecb3fd25da | ||
|
|
5cb95bd226 | ||
|
|
47bc8c04ad | ||
|
|
2879041a65 | ||
|
|
2e7e403725 | ||
|
|
30eede64ec | ||
|
|
70f3d6f7de | ||
|
|
e1f7191f67 | ||
|
|
a8f4b67aa2 | ||
|
|
d64a53cbb1 | ||
|
|
4300882d12 | ||
|
|
0711e094f3 | ||
|
|
4ec1883262 | ||
|
|
cb53db4157 | ||
|
|
49aea85638 | ||
|
|
3971b5a8cf | ||
|
|
958946d01a | ||
|
|
f3d284476f | ||
|
|
6076b12067 | ||
|
|
5c7eba6049 | ||
|
|
3ed99a5b25 | ||
|
|
f8b08926f2 | ||
|
|
354e80b3e3 | ||
|
|
0cfb4a8466 | ||
|
|
8facd2845f | ||
|
|
9dae464fa6 | ||
|
|
6ff4b25d79 | ||
|
|
6766e9a099 | ||
|
|
d327426c93 | ||
|
|
47f73c856f | ||
|
|
9fdd247773 | ||
|
|
fe59cabf15 | ||
|
|
da37a9bc06 | ||
|
|
bad779be1f | ||
|
|
5eb5deb8eb | ||
|
|
f9afee7dba | ||
|
|
547e9ed684 | ||
|
|
68d2927cbf | ||
|
|
ca7f716432 | ||
|
|
9d15c35623 | ||
|
|
a55ce5da8f | ||
|
|
f0a06b797e | ||
|
|
0a77f43832 | ||
|
|
4ce0d31688 | ||
|
|
280802615f | ||
|
|
c7db281065 | ||
|
|
ca00739041 | ||
|
|
11f8b17599 | ||
|
|
970ab7d5c5 | ||
|
|
71c082dccd | ||
|
|
76a185eb90 | ||
|
|
8c0f3d107d | ||
|
|
5bfbd63e13 |
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
@@ -4,7 +4,7 @@
|
||||
* @styfle
|
||||
/packages/now-node @styfle @tootallnate @lucleray
|
||||
/packages/now-node-bridge @styfle @tootallnate @lucleray
|
||||
/packages/now-next @timer @dav-is
|
||||
/packages/now-next @timer
|
||||
/packages/now-go @styfle @sophearak
|
||||
/packages/now-python @styfle @sophearak
|
||||
/packages/now-rust @styfle @mike-engel @anmonteiro
|
||||
|
||||
12
.github/main.workflow
vendored
12
.github/main.workflow
vendored
@@ -18,21 +18,21 @@ action "1. Canary yarn install" {
|
||||
uses = "actions/npm@59b64a598378f31e49cb76f27d6f3312b582f680"
|
||||
needs = ["0. Canary PR not deleted"]
|
||||
runs = "yarn"
|
||||
args = "install"
|
||||
args = "--pure-lockfile install"
|
||||
}
|
||||
|
||||
action "2. Canary yarn run build" {
|
||||
uses = "actions/npm@59b64a598378f31e49cb76f27d6f3312b582f680"
|
||||
needs = ["1. Canary yarn install"]
|
||||
runs = "yarn"
|
||||
args = "run build"
|
||||
args = "--pure-lockfile run build"
|
||||
}
|
||||
|
||||
action "3. Canary yarn run publish" {
|
||||
uses = "actions/npm@59b64a598378f31e49cb76f27d6f3312b582f680"
|
||||
needs = ["2. Canary yarn run build"]
|
||||
runs = "yarn"
|
||||
args = "run publish-from-github"
|
||||
args = "--pure-lockfile run publish-from-github"
|
||||
secrets = ["NPM_TOKEN"]
|
||||
}
|
||||
|
||||
@@ -57,20 +57,20 @@ action "1. Master yarn install" {
|
||||
uses = "actions/npm@59b64a598378f31e49cb76f27d6f3312b582f680"
|
||||
needs = ["0. Master PR not deleted"]
|
||||
runs = "yarn"
|
||||
args = "install"
|
||||
args = "--pure-lockfile install"
|
||||
}
|
||||
|
||||
action "2. Master yarn run build" {
|
||||
uses = "actions/npm@59b64a598378f31e49cb76f27d6f3312b582f680"
|
||||
needs = ["1. Master yarn install"]
|
||||
runs = "yarn"
|
||||
args = "run build"
|
||||
args = "--pure-lockfile run build"
|
||||
}
|
||||
|
||||
action "3. Master yarn run publish" {
|
||||
uses = "actions/npm@59b64a598378f31e49cb76f27d6f3312b582f680"
|
||||
needs = ["2. Master yarn run build"]
|
||||
runs = "yarn"
|
||||
args = "run publish-from-github"
|
||||
args = "--pure-lockfile run publish-from-github"
|
||||
secrets = ["NPM_TOKEN"]
|
||||
}
|
||||
|
||||
26
package.json
26
package.json
@@ -43,23 +43,19 @@
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/fs-extra": "^5.0.4",
|
||||
"@types/glob": "^7.1.1",
|
||||
"@types/multistream": "^2.1.1",
|
||||
"@types/node": "^10.12.8",
|
||||
"@types/node": "*",
|
||||
"async-retry": "1.2.3",
|
||||
"buffer-replace": "^1.0.0",
|
||||
"codecov": "^3.2.0",
|
||||
"eslint": "^5.9.0",
|
||||
"eslint-config-airbnb-base": "^13.1.0",
|
||||
"eslint-config-prettier": "^3.1.0",
|
||||
"eslint-plugin-import": "^2.14.0",
|
||||
"buffer-replace": "1.0.0",
|
||||
"codecov": "3.2.0",
|
||||
"eslint": "5.9.0",
|
||||
"eslint-config-airbnb-base": "13.1.0",
|
||||
"eslint-config-prettier": "3.3.0",
|
||||
"eslint-plugin-import": "2.14.0",
|
||||
"fs-extra": "^7.0.1",
|
||||
"glob": "^7.1.3",
|
||||
"jest": "^23.6.0",
|
||||
"lint-staged": "^8.0.4",
|
||||
"node-fetch": "^2.3.0",
|
||||
"pre-commit": "^1.2.2",
|
||||
"jest": "24.7.1",
|
||||
"lint-staged": "8.1.0",
|
||||
"node-fetch": "2.6.0",
|
||||
"pre-commit": "1.2.2",
|
||||
"prettier": "1.17.1"
|
||||
},
|
||||
"prettier": {
|
||||
|
||||
@@ -9,10 +9,6 @@ const {
|
||||
shouldServe,
|
||||
} = require('@now/build-utils'); // eslint-disable-line import/no-extraneous-dependencies
|
||||
|
||||
exports.config = {
|
||||
maxLambdaSize: '10mb',
|
||||
};
|
||||
|
||||
// From this list: https://import.pw/importpw/import/docs/config.md
|
||||
const allowedConfigImports = new Set([
|
||||
'CACHE',
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@now/bash",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.2",
|
||||
"description": "Now 2.0 builder for HTTP endpoints written in Bash",
|
||||
"main": "index.js",
|
||||
"author": "Nathan Rajlich <nate@zeit.co>",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@now/build-utils",
|
||||
"version": "0.8.0",
|
||||
"version": "0.8.9",
|
||||
"license": "MIT",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.js",
|
||||
@@ -35,6 +35,7 @@
|
||||
"@types/end-of-stream": "^1.4.0",
|
||||
"@types/fs-extra": "^5.0.5",
|
||||
"@types/glob": "^7.1.1",
|
||||
"@types/multistream": "2.1.1",
|
||||
"@types/node-fetch": "^2.1.6",
|
||||
"@types/semver": "6.0.0",
|
||||
"@types/yazl": "^2.4.1",
|
||||
|
||||
@@ -10,8 +10,8 @@ const BUILDERS = new Map<string, Builder>([
|
||||
]);
|
||||
|
||||
const API_BUILDERS: Builder[] = [
|
||||
{ src: 'api/**/*.js', use: '@now/node', config },
|
||||
{ src: 'api/**/*.ts', use: '@now/node', config },
|
||||
{ src: 'api/**/*.js', use: '@now/node@canary', config },
|
||||
{ src: 'api/**/*.ts', use: '@now/node@canary', config },
|
||||
{ src: 'api/**/*.rs', use: '@now/rust', config },
|
||||
{ src: 'api/**/*.go', use: '@now/go', config },
|
||||
{ src: 'api/**/*.php', use: '@now/php', config },
|
||||
@@ -20,28 +20,91 @@ const API_BUILDERS: Builder[] = [
|
||||
{ src: 'api/**/*.sh', use: '@now/bash', config },
|
||||
];
|
||||
|
||||
export async function detectBuilder(pkg: PackageJson): Promise<Builder> {
|
||||
interface Warning {
|
||||
code: string;
|
||||
message: string;
|
||||
}
|
||||
|
||||
export async function detectBuilder(
|
||||
pkg: PackageJson
|
||||
): Promise<{
|
||||
builder: null | Builder;
|
||||
warnings: null | Warning[];
|
||||
}> {
|
||||
let warnings: null | Warning[] = null;
|
||||
|
||||
const scripts = pkg.scripts || {};
|
||||
|
||||
if (!scripts.build) {
|
||||
warnings = [
|
||||
{
|
||||
code: 'missing_build_script',
|
||||
message:
|
||||
'Your `package.json` file is missing a `build` property inside the `script` property',
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
for (const [dependency, builder] of BUILDERS) {
|
||||
const deps = Object.assign({}, pkg.dependencies, pkg.devDependencies);
|
||||
|
||||
// Return the builder when a dependency matches
|
||||
if (deps[dependency]) {
|
||||
return builder;
|
||||
return { builder, warnings };
|
||||
}
|
||||
}
|
||||
|
||||
// If there is no `build` and `now-build` script
|
||||
// we'll not select `@now/static-build`
|
||||
// since it would fail
|
||||
if (!scripts.build) {
|
||||
return { builder: null, warnings };
|
||||
}
|
||||
|
||||
// By default we'll choose the `static-build` builder
|
||||
return { src, use: '@now/static-build', config };
|
||||
const builder = { src, use: '@now/static-build', config };
|
||||
return { builder, warnings };
|
||||
}
|
||||
|
||||
// Files that match a specific pattern will get ignored
|
||||
export function ignoreApiFilter(file: string) {
|
||||
if (file.includes('/.')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (file.includes('/_')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If the file does not match any builder we also
|
||||
// don't want to create a route e.g. `package.json`
|
||||
if (API_BUILDERS.every(({ src }) => !minimatch(file, src))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// We need to sort the file paths by alphabet to make
|
||||
// sure the routes stay in the same order e.g. for deduping
|
||||
export function sortFiles(fileA: string, fileB: string) {
|
||||
return fileA.localeCompare(fileB);
|
||||
}
|
||||
|
||||
export async function detectApiBuilders(
|
||||
files: string[]
|
||||
): Promise<Builder[] | null> {
|
||||
const builds = files.map(file => {
|
||||
return API_BUILDERS.find(({ src }): boolean => minimatch(file, src));
|
||||
});
|
||||
const builds = files
|
||||
.sort(sortFiles)
|
||||
.filter(ignoreApiFilter)
|
||||
.map(file => {
|
||||
const result = API_BUILDERS.find(
|
||||
({ src }): boolean => minimatch(file, src)
|
||||
);
|
||||
|
||||
// We can use `new Set` here since `builds` contains references to `API_BUILDERS`
|
||||
const finishedBuilds = Array.from(new Set(builds.filter(Boolean)));
|
||||
return result ? { ...result, src: file } : null;
|
||||
});
|
||||
|
||||
const finishedBuilds = builds.filter(Boolean);
|
||||
return finishedBuilds.length > 0 ? (finishedBuilds as Builder[]) : null;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,17 @@
|
||||
import path from 'path';
|
||||
import { Route } from './types';
|
||||
import { parse as parsePath } from 'path';
|
||||
import { ignoreApiFilter, sortFiles } from './detect-builder';
|
||||
|
||||
function joinPath(...segments: string[]) {
|
||||
const joinedPath = segments.join('/');
|
||||
return joinedPath.replace(/\/{2,}/g, '/');
|
||||
}
|
||||
|
||||
function concatArrayOfText(texts: string[]): string {
|
||||
if (texts.length <= 2) {
|
||||
return texts.join(' and ');
|
||||
}
|
||||
|
||||
const last = texts.pop();
|
||||
return `${texts.join(', ')}, and ${last}`;
|
||||
}
|
||||
@@ -11,7 +21,7 @@ function concatArrayOfText(texts: string[]): string {
|
||||
// It will return `null` if there are no brackets
|
||||
// and therefore no segment.
|
||||
function getSegmentName(segment: string): string | null {
|
||||
const { name } = path.parse(segment);
|
||||
const { name } = parsePath(segment);
|
||||
|
||||
if (name.startsWith('[') && name.endsWith(']')) {
|
||||
return name.slice(1, -1);
|
||||
@@ -23,7 +33,6 @@ function getSegmentName(segment: string): string | null {
|
||||
function createRouteFromPath(filePath: string): Route {
|
||||
const parts = filePath.split('/');
|
||||
|
||||
let append: string = '';
|
||||
let counter: number = 1;
|
||||
const query: string[] = [];
|
||||
|
||||
@@ -33,23 +42,12 @@ function createRouteFromPath(filePath: string): Route {
|
||||
const isLast = index === parts.length - 1;
|
||||
|
||||
if (name !== null) {
|
||||
// We can't use `URLSearchParams` because `$` would get escaped
|
||||
query.push(`${name}=$${counter++}`);
|
||||
|
||||
if (isLast) {
|
||||
// We append this to the last one
|
||||
// to make sure GET params still work
|
||||
// and are just appended to our GET params
|
||||
append += `$${counter++}`;
|
||||
return `([^\\/|\\?]+)\\/?(?:\\?(.*))?`;
|
||||
}
|
||||
|
||||
return `([^\\/]+)`;
|
||||
} else if (isLast) {
|
||||
// If it is the last part we want to remove the extension
|
||||
// and capture everything after that as regex group and append it
|
||||
const { name: fileName } = path.parse(segment);
|
||||
append += `$${counter++}`;
|
||||
return `${fileName}(.*)`;
|
||||
const { name: fileName } = parsePath(segment);
|
||||
return fileName;
|
||||
}
|
||||
|
||||
return segment;
|
||||
@@ -57,9 +55,7 @@ function createRouteFromPath(filePath: string): Route {
|
||||
);
|
||||
|
||||
const src = `^/${srcParts.join('/')}$`;
|
||||
const dest = `/${filePath}${query.length ? '?' : ''}${query.join('&')}${
|
||||
query.length ? '&' : ''
|
||||
}${append}`;
|
||||
const dest = `/${filePath}${query.length ? '?' : ''}${query.join('&')}`;
|
||||
|
||||
return { src, dest };
|
||||
}
|
||||
@@ -101,8 +97,8 @@ function partiallyMatches(pathA: string, pathB: string): boolean {
|
||||
// got resolved, so we can check if they have conflicts
|
||||
function pathOccurrences(filePath: string, files: string[]): string[] {
|
||||
const getAbsolutePath = (unresolvedPath: string): string => {
|
||||
const { dir, name } = path.parse(unresolvedPath);
|
||||
const parts = path.join(dir, name).split('/');
|
||||
const { dir, name } = parsePath(unresolvedPath);
|
||||
const parts = joinPath(dir, name).split('/');
|
||||
return parts.map(part => part.replace(/\[.*\]/, '1')).join('/');
|
||||
};
|
||||
|
||||
@@ -183,7 +179,10 @@ export async function detectApiRoutes(
|
||||
|
||||
// The deepest routes need to be
|
||||
// the first ones to get handled
|
||||
const sortedFiles = files.sort(sortFilesBySegmentCount);
|
||||
const sortedFiles = files
|
||||
.filter(ignoreApiFilter)
|
||||
.sort(sortFiles)
|
||||
.sort(sortFilesBySegmentCount);
|
||||
|
||||
const defaultRoutes: Route[] = [];
|
||||
|
||||
@@ -196,8 +195,6 @@ export async function detectApiRoutes(
|
||||
|
||||
const conflictingSegment = getConflictingSegment(file);
|
||||
|
||||
console.log({ file, conflictingSegment });
|
||||
|
||||
if (conflictingSegment) {
|
||||
return {
|
||||
defaultRoutes: null,
|
||||
|
||||
@@ -18,7 +18,7 @@ function spawnAsync(
|
||||
opts = { stdio: 'inherit', cwd, ...opts };
|
||||
const child = spawn(command, args, opts);
|
||||
|
||||
if (opts.stdio === 'pipe') {
|
||||
if (opts.stdio === 'pipe' && child.stderr) {
|
||||
child.stderr.on('data', data => stderrLogs.push(data));
|
||||
}
|
||||
|
||||
@@ -139,13 +139,7 @@ export async function runNpmInstall(
|
||||
} else {
|
||||
await spawnAsync(
|
||||
'yarn',
|
||||
commandArgs.concat([
|
||||
'--ignore-engines',
|
||||
'--mutex',
|
||||
'network',
|
||||
'--cwd',
|
||||
destPath,
|
||||
]),
|
||||
commandArgs.concat(['--ignore-engines', '--cwd', destPath]),
|
||||
destPath,
|
||||
opts
|
||||
);
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
"builds": [
|
||||
{
|
||||
"src": "index.js",
|
||||
"use": "@now/node",
|
||||
"config": { "maxLambdaSize": "18mb" }
|
||||
"use": "@now/node"
|
||||
}
|
||||
],
|
||||
"probes": [{ "path": "/", "mustContain": "found:RANDOMNESS_PLACEHOLDER" }]
|
||||
|
||||
@@ -139,7 +139,7 @@ for (const fixture of fs.readdirSync(fixturesPath)) {
|
||||
|
||||
// few foreign tests
|
||||
|
||||
const buildersToTestWith = ['now-node-server', 'now-static-build'];
|
||||
const buildersToTestWith = ['now-node', 'now-static-build'];
|
||||
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const builder of buildersToTestWith) {
|
||||
@@ -168,20 +168,21 @@ for (const builder of buildersToTestWith) {
|
||||
it('Test `detectBuilder`', async () => {
|
||||
{
|
||||
const pkg = { dependencies: { next: '1.0.0' } };
|
||||
const builder = await detectBuilder(pkg);
|
||||
const { builder, warnings } = await detectBuilder(pkg);
|
||||
expect(builder.use).toBe('@now/next');
|
||||
expect(warnings.length).toBe(1);
|
||||
}
|
||||
|
||||
{
|
||||
const pkg = { devDependencies: { next: '1.0.0' } };
|
||||
const builder = await detectBuilder(pkg);
|
||||
const { builder } = await detectBuilder(pkg);
|
||||
expect(builder.use).toBe('@now/next');
|
||||
}
|
||||
|
||||
{
|
||||
const pkg = {};
|
||||
const builder = await detectBuilder(pkg);
|
||||
expect(builder.use).toBe('@now/static-build');
|
||||
const { builder } = await detectBuilder(pkg);
|
||||
expect(builder).toBe(null);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -190,7 +191,7 @@ it('Test `detectApiBuilders`', async () => {
|
||||
const files = ['package.json', 'api/user.js', 'api/team.js'];
|
||||
|
||||
const builders = await detectApiBuilders(files);
|
||||
expect(builders[0].use).toBe('@now/node');
|
||||
expect(builders[0].use).toBe('@now/node@canary');
|
||||
}
|
||||
|
||||
{
|
||||
@@ -198,7 +199,7 @@ it('Test `detectApiBuilders`', async () => {
|
||||
|
||||
const builders = await detectApiBuilders(files);
|
||||
expect(builders.some(({ use }) => use === '@now/go')).toBeTruthy();
|
||||
expect(builders.some(({ use }) => use === '@now/node')).toBeTruthy();
|
||||
expect(builders.some(({ use }) => use === '@now/node@canary')).toBeTruthy();
|
||||
}
|
||||
|
||||
{
|
||||
@@ -207,14 +208,28 @@ it('Test `detectApiBuilders`', async () => {
|
||||
const builders = await detectApiBuilders(files);
|
||||
expect(builders).toBe(null);
|
||||
}
|
||||
|
||||
{
|
||||
const files = [
|
||||
'api/users/[id].js',
|
||||
'api/_utils/handler.js',
|
||||
'api/users/.helper.js',
|
||||
'api/teams/_helper.js',
|
||||
];
|
||||
|
||||
const builders = await detectApiBuilders(files);
|
||||
expect(builders.length).toBe(1);
|
||||
}
|
||||
});
|
||||
|
||||
it('Test `detectApiRoutes`', async () => {
|
||||
{
|
||||
const files = ['api/user.go', 'api/team.js'];
|
||||
const files = ['api/user.go', 'api/team.js', 'api/package.json'];
|
||||
|
||||
const { defaultRoutes } = await detectApiRoutes(files);
|
||||
expect(defaultRoutes.length).toBe(2);
|
||||
expect(defaultRoutes[0].dest).toBe('/api/team.js');
|
||||
expect(defaultRoutes[1].dest).toBe('/api/user.go');
|
||||
}
|
||||
|
||||
{
|
||||
@@ -244,4 +259,15 @@ it('Test `detectApiRoutes`', async () => {
|
||||
const { defaultRoutes } = await detectApiRoutes(files);
|
||||
expect(defaultRoutes.length).toBe(2);
|
||||
}
|
||||
|
||||
{
|
||||
const files = [
|
||||
'api/_utils/handler.js',
|
||||
'api/[endpoint]/.helper.js',
|
||||
'api/[endpoint]/[id].js',
|
||||
];
|
||||
|
||||
const builders = await detectApiBuilders(files);
|
||||
expect(builders.length).toBe(1);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -45,10 +45,6 @@ async function initPrivateGit(credentials: string) {
|
||||
|
||||
export const version = 2;
|
||||
|
||||
export const config = {
|
||||
maxLambdaSize: '10mb',
|
||||
};
|
||||
|
||||
export async function build({
|
||||
files,
|
||||
entrypoint,
|
||||
@@ -120,7 +116,14 @@ Learn more: https://zeit.co/docs/v2/deployments/official-builders/go-now-go/#ent
|
||||
const parsedAnalyzed = JSON.parse(analyzed) as Analyzed;
|
||||
|
||||
if (meta.isDev) {
|
||||
const base = dirname(downloadedFiles['now.json'].fsPath);
|
||||
let base = null;
|
||||
|
||||
if (config && config.zeroConfig) {
|
||||
base = workPath;
|
||||
} else {
|
||||
base = dirname(downloadedFiles['now.json'].fsPath);
|
||||
}
|
||||
|
||||
const destNow = join(
|
||||
base,
|
||||
'.now',
|
||||
@@ -234,7 +237,7 @@ Learn more: https://zeit.co/docs/v2/deployments/official-builders/go-now-go/#ent
|
||||
|
||||
if (meta.isDev && isGoModExist && isGoModInRootDir) {
|
||||
await writeFile(
|
||||
join(dirname(downloadedFiles['now.json'].fsPath), mainModGoFileName),
|
||||
join(dirname(downloadedFiles['go.mod'].fsPath), mainModGoFileName),
|
||||
mainModGoContents
|
||||
);
|
||||
} else if (isGoModExist && isGoModInRootDir) {
|
||||
@@ -284,7 +287,7 @@ Learn more: https://zeit.co/docs/v2/deployments/official-builders/go-now-go/#ent
|
||||
|
||||
let baseGoModPath = '';
|
||||
if (meta.isDev && isGoModExist && isGoModInRootDir) {
|
||||
baseGoModPath = dirname(downloadedFiles['now.json'].fsPath);
|
||||
baseGoModPath = dirname(downloadedFiles['go.mod'].fsPath);
|
||||
} else if (isGoModExist && isGoModInRootDir) {
|
||||
baseGoModPath = srcPath;
|
||||
} else if (isGoModExist && !isGoModInRootDir) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@now/go",
|
||||
"version": "0.5.4",
|
||||
"version": "0.5.6",
|
||||
"license": "MIT",
|
||||
"homepage": "https://zeit.co/docs/v2/deployments/official-builders/go-now-go",
|
||||
"repository": {
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
save-prefix ""
|
||||
@@ -1,32 +0,0 @@
|
||||
const { FileBlob, shouldServe } = require('@now/build-utils'); // eslint-disable-line import/no-extraneous-dependencies
|
||||
const { minify } = require('html-minifier');
|
||||
|
||||
const defaultOptions = {
|
||||
minifyCSS: true,
|
||||
minifyJS: true,
|
||||
removeComments: true,
|
||||
removeAttributeQuotes: true,
|
||||
removeEmptyAttributes: true,
|
||||
removeOptionalTags: true,
|
||||
removeRedundantAttributes: true,
|
||||
useShortDoctype: true,
|
||||
collapseWhitespace: true,
|
||||
collapseBooleanAttributes: true,
|
||||
caseSensitive: true,
|
||||
};
|
||||
|
||||
exports.analyze = ({ files, entrypoint }) => files[entrypoint].digest;
|
||||
|
||||
exports.build = async ({ files, entrypoint, config }) => {
|
||||
const stream = files[entrypoint].toStream();
|
||||
const options = Object.assign({}, defaultOptions, config || {});
|
||||
const { data } = await FileBlob.fromStream({ stream });
|
||||
const content = data.toString();
|
||||
|
||||
const minified = minify(content, options);
|
||||
const result = new FileBlob({ data: minified });
|
||||
|
||||
return { [entrypoint]: result };
|
||||
};
|
||||
|
||||
exports.shouldServe = shouldServe;
|
||||
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"name": "@now/html-minifier",
|
||||
"version": "1.1.4",
|
||||
"license": "MIT",
|
||||
"homepage": "https://zeit.co/docs/v2/deployments/official-builders/html-minifier-now-html-minifier",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zeit/now-builders.git",
|
||||
"directory": "packages/now-html-minifier"
|
||||
},
|
||||
"dependencies": {
|
||||
"html-minifier": "3.5.21"
|
||||
}
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
camel-case@3.0.x:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/camel-case/-/camel-case-3.0.0.tgz#ca3c3688a4e9cf3a4cda777dc4dcbc713249cf73"
|
||||
integrity sha1-yjw2iKTpzzpM2nd9xNy8cTJJz3M=
|
||||
dependencies:
|
||||
no-case "^2.2.0"
|
||||
upper-case "^1.1.1"
|
||||
|
||||
clean-css@4.2.x:
|
||||
version "4.2.1"
|
||||
resolved "https://registry.yarnpkg.com/clean-css/-/clean-css-4.2.1.tgz#2d411ef76b8569b6d0c84068dabe85b0aa5e5c17"
|
||||
integrity sha512-4ZxI6dy4lrY6FHzfiy1aEOXgu4LIsW2MhwG0VBKdcoGoH/XLFgaHSdLTGr4O8Be6A8r3MOphEiI8Gc1n0ecf3g==
|
||||
dependencies:
|
||||
source-map "~0.6.0"
|
||||
|
||||
commander@2.17.x, commander@~2.17.1:
|
||||
version "2.17.1"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.17.1.tgz#bd77ab7de6de94205ceacc72f1716d29f20a77bf"
|
||||
integrity sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==
|
||||
|
||||
he@1.2.x:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f"
|
||||
integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==
|
||||
|
||||
html-minifier@3.5.21:
|
||||
version "3.5.21"
|
||||
resolved "https://registry.yarnpkg.com/html-minifier/-/html-minifier-3.5.21.tgz#d0040e054730e354db008463593194015212d20c"
|
||||
integrity sha512-LKUKwuJDhxNa3uf/LPR/KVjm/l3rBqtYeCOAekvG8F1vItxMUpueGd94i/asDDr8/1u7InxzFA5EeGjhhG5mMA==
|
||||
dependencies:
|
||||
camel-case "3.0.x"
|
||||
clean-css "4.2.x"
|
||||
commander "2.17.x"
|
||||
he "1.2.x"
|
||||
param-case "2.1.x"
|
||||
relateurl "0.2.x"
|
||||
uglify-js "3.4.x"
|
||||
|
||||
lower-case@^1.1.1:
|
||||
version "1.1.4"
|
||||
resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-1.1.4.tgz#9a2cabd1b9e8e0ae993a4bf7d5875c39c42e8eac"
|
||||
integrity sha1-miyr0bno4K6ZOkv31YdcOcQujqw=
|
||||
|
||||
no-case@^2.2.0:
|
||||
version "2.3.2"
|
||||
resolved "https://registry.yarnpkg.com/no-case/-/no-case-2.3.2.tgz#60b813396be39b3f1288a4c1ed5d1e7d28b464ac"
|
||||
integrity sha512-rmTZ9kz+f3rCvK2TD1Ue/oZlns7OGoIWP4fc3llxxRXlOkHKoWPPWJOfFYpITabSow43QJbRIoHQXtt10VldyQ==
|
||||
dependencies:
|
||||
lower-case "^1.1.1"
|
||||
|
||||
param-case@2.1.x:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/param-case/-/param-case-2.1.1.tgz#df94fd8cf6531ecf75e6bef9a0858fbc72be2247"
|
||||
integrity sha1-35T9jPZTHs915r75oIWPvHK+Ikc=
|
||||
dependencies:
|
||||
no-case "^2.2.0"
|
||||
|
||||
relateurl@0.2.x:
|
||||
version "0.2.7"
|
||||
resolved "https://registry.yarnpkg.com/relateurl/-/relateurl-0.2.7.tgz#54dbf377e51440aca90a4cd274600d3ff2d888a9"
|
||||
integrity sha1-VNvzd+UUQKypCkzSdGANP/LYiKk=
|
||||
|
||||
source-map@~0.6.0, source-map@~0.6.1:
|
||||
version "0.6.1"
|
||||
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
|
||||
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
|
||||
|
||||
uglify-js@3.4.x:
|
||||
version "3.4.9"
|
||||
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.4.9.tgz#af02f180c1207d76432e473ed24a28f4a782bae3"
|
||||
integrity sha512-8CJsbKOtEbnJsTyv6LE6m6ZKniqMiFWmm9sRbopbkGs3gMPPfd3Fh8iIA4Ykv5MgaTbqHr4BaoGLJLZNhsrW1Q==
|
||||
dependencies:
|
||||
commander "~2.17.1"
|
||||
source-map "~0.6.1"
|
||||
|
||||
upper-case@^1.1.1:
|
||||
version "1.1.3"
|
||||
resolved "https://registry.yarnpkg.com/upper-case/-/upper-case-1.1.3.tgz#f6b4501c2ec4cdd26ba78be7222961de77621598"
|
||||
integrity sha1-9rRQHC7EzdJrp4vnIilh3ndiFZg=
|
||||
@@ -1 +0,0 @@
|
||||
/test
|
||||
@@ -1,15 +0,0 @@
|
||||
const { Lambda } = require('@now/build-utils/lambda.js'); // eslint-disable-line import/no-extraneous-dependencies
|
||||
const streamToBuffer = require('@now/build-utils/fs/stream-to-buffer.js'); // eslint-disable-line import/no-extraneous-dependencies
|
||||
const { shouldServe } = require('@now/build-utils'); // eslint-disable-line import/no-extraneous-dependencies
|
||||
|
||||
exports.build = async ({ files, entrypoint, config }) => {
|
||||
if (!files[entrypoint]) throw new Error('Entrypoint not found in files');
|
||||
const { handler, runtime } = config;
|
||||
if (!handler) throw new Error('Handler not found in config');
|
||||
if (!runtime) throw new Error('Runtime not found in config');
|
||||
const zipBuffer = await streamToBuffer(files[entrypoint].toStream());
|
||||
const lambda = new Lambda({ zipBuffer, handler, runtime });
|
||||
return { [entrypoint]: lambda };
|
||||
};
|
||||
|
||||
exports.shouldServe = shouldServe;
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"name": "@now/lambda",
|
||||
"version": "0.5.4",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zeit/now-builders.git",
|
||||
"directory": "packages/now-lambda"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jest"
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"version": 2,
|
||||
"builds": [
|
||||
{
|
||||
"src": "index.zip",
|
||||
"use": "@now/lambda",
|
||||
"config": { "handler": "index.handler", "runtime": "nodejs8.10" }
|
||||
},
|
||||
{
|
||||
"src": "subdirectory/index.zip",
|
||||
"use": "@now/lambda",
|
||||
"config": { "handler": "index.handler", "runtime": "nodejs8.10" }
|
||||
}
|
||||
],
|
||||
"probes": [
|
||||
{ "path": "/", "mustContain": "cow:NO_REPLACE_TO_AVOID_CRC_MISMATCH" },
|
||||
{
|
||||
"path": "/subdirectory/",
|
||||
"mustContain": "yoda:NO_REPLACE_TO_AVOID_CRC_MISMATCH"
|
||||
}
|
||||
]
|
||||
}
|
||||
Binary file not shown.
@@ -1,33 +0,0 @@
|
||||
/* global beforeAll, expect, it, jest */
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const {
|
||||
packAndDeploy,
|
||||
testDeployment,
|
||||
} = require('../../../test/lib/deployment/test-deployment.js');
|
||||
|
||||
jest.setTimeout(4 * 60 * 1000);
|
||||
const buildUtilsUrl = '@canary';
|
||||
let builderUrl;
|
||||
|
||||
beforeAll(async () => {
|
||||
const builderPath = path.resolve(__dirname, '..');
|
||||
builderUrl = await packAndDeploy(builderPath);
|
||||
console.log('builderUrl', builderUrl);
|
||||
});
|
||||
|
||||
const fixturesPath = path.resolve(__dirname, 'fixtures');
|
||||
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const fixture of fs.readdirSync(fixturesPath)) {
|
||||
// eslint-disable-next-line no-loop-func
|
||||
it(`should build ${fixture}`, async () => {
|
||||
await expect(
|
||||
testDeployment(
|
||||
{ builderUrl, buildUtilsUrl },
|
||||
path.join(fixturesPath, fixture),
|
||||
),
|
||||
).resolves.toBeDefined();
|
||||
});
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
/test
|
||||
@@ -1,45 +0,0 @@
|
||||
const { FileBlob, shouldServe } = require('@now/build-utils'); // eslint-disable-line import/no-extraneous-dependencies
|
||||
const unified = require('unified');
|
||||
const unifiedStream = require('unified-stream');
|
||||
const markdown = require('remark-parse');
|
||||
const remark2rehype = require('remark-rehype');
|
||||
const doc = require('rehype-document');
|
||||
const format = require('rehype-format');
|
||||
const html = require('rehype-stringify');
|
||||
|
||||
exports.analyze = ({ files, entrypoint }) => files[entrypoint].digest;
|
||||
|
||||
exports.build = async ({ files, entrypoint, config }) => {
|
||||
const stream = files[entrypoint].toStream();
|
||||
const options = config || {};
|
||||
|
||||
const title = options.title || null;
|
||||
const language = options.language || 'en';
|
||||
const meta = options.meta || null;
|
||||
const css = options.css || null;
|
||||
|
||||
const processor = unified()
|
||||
.use(markdown)
|
||||
.use(remark2rehype)
|
||||
.use(doc, {
|
||||
title,
|
||||
language,
|
||||
meta,
|
||||
css,
|
||||
})
|
||||
.use(format)
|
||||
.use(html);
|
||||
|
||||
const result = await FileBlob.fromStream({
|
||||
stream: stream.pipe(unifiedStream(processor)),
|
||||
});
|
||||
|
||||
const replacedEntrypoint = entrypoint.replace(/\.[^.]+$/, '.html');
|
||||
|
||||
return { [replacedEntrypoint]: result };
|
||||
};
|
||||
|
||||
exports.shouldServe = (options) => {
|
||||
const requestPath = options.requestPath.replace(/\.html$/, '.md');
|
||||
return shouldServe({ ...options, requestPath });
|
||||
};
|
||||
@@ -1,23 +0,0 @@
|
||||
{
|
||||
"name": "@now/md",
|
||||
"version": "0.5.5",
|
||||
"license": "MIT",
|
||||
"homepage": "https://zeit.co/docs/v2/deployments/official-builders/markdown-now-md",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zeit/now-builders.git",
|
||||
"directory": "packages/now-md"
|
||||
},
|
||||
"dependencies": {
|
||||
"rehype-document": "^2.2.0",
|
||||
"rehype-format": "^2.3.0",
|
||||
"rehype-stringify": "^4.0.0",
|
||||
"remark-parse": "^6.0.1",
|
||||
"remark-rehype": "^3.0.1",
|
||||
"unified": "^7.0.0",
|
||||
"unified-stream": "^1.0.2"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jest"
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
# Testing Markdown
|
||||
|
||||
cow:RANDOMNESS_PLACEHOLDER
|
||||
|
||||
[Wow a link!](https://zeit.co)
|
||||
11
packages/now-md/test/fixtures/01-cowsay/now.json
vendored
11
packages/now-md/test/fixtures/01-cowsay/now.json
vendored
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"version": 2,
|
||||
"builds": [
|
||||
{ "src": "index.md", "use": "@now/md" },
|
||||
{ "src": "subdirectory/index.md", "use": "@now/md" }
|
||||
],
|
||||
"probes": [
|
||||
{ "path": "/", "mustContain": "cow:RANDOMNESS_PLACEHOLDER" },
|
||||
{ "path": "/subdirectory/", "mustContain": "yoda:RANDOMNESS_PLACEHOLDER" }
|
||||
]
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
# Testing Markdown
|
||||
|
||||
yoda:RANDOMNESS_PLACEHOLDER
|
||||
|
||||
[Wow a link!](https://zeit.co)
|
||||
@@ -1,33 +0,0 @@
|
||||
/* global beforeAll, expect, it, jest */
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const {
|
||||
packAndDeploy,
|
||||
testDeployment,
|
||||
} = require('../../../test/lib/deployment/test-deployment.js');
|
||||
|
||||
jest.setTimeout(4 * 60 * 1000);
|
||||
const buildUtilsUrl = '@canary';
|
||||
let builderUrl;
|
||||
|
||||
beforeAll(async () => {
|
||||
const builderPath = path.resolve(__dirname, '..');
|
||||
builderUrl = await packAndDeploy(builderPath);
|
||||
console.log('builderUrl', builderUrl);
|
||||
});
|
||||
|
||||
const fixturesPath = path.resolve(__dirname, 'fixtures');
|
||||
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const fixture of fs.readdirSync(fixturesPath)) {
|
||||
// eslint-disable-next-line no-loop-func
|
||||
it(`should build ${fixture}`, async () => {
|
||||
await expect(
|
||||
testDeployment(
|
||||
{ builderUrl, buildUtilsUrl },
|
||||
path.join(fixturesPath, fixture),
|
||||
),
|
||||
).resolves.toBeDefined();
|
||||
});
|
||||
}
|
||||
@@ -1,508 +0,0 @@
|
||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
array-iterate@^1.0.0:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.npmjs.org/array-iterate/-/array-iterate-1.1.2.tgz#f66a57e84426f8097f4197fbb6c051b8e5cdf7d8"
|
||||
integrity sha512-1hWSHTIlG/8wtYD+PPX5AOBtKWngpDFjrsrHgZpe+JdgNGz0udYu6ZIkAa/xuenIUEqFv7DvE2Yr60jxweJSrQ==
|
||||
|
||||
bail@^1.0.0:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.npmjs.org/bail/-/bail-1.0.3.tgz#63cfb9ddbac829b02a3128cd53224be78e6c21a3"
|
||||
integrity sha512-1X8CnjFVQ+a+KW36uBNMTU5s8+v5FzeqrP7hTG5aTb4aPreSbZJlhwPon9VKMuEVgV++JM+SQrALY3kr7eswdg==
|
||||
|
||||
ccount@^1.0.0:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.npmjs.org/ccount/-/ccount-1.0.3.tgz#f1cec43f332e2ea5a569fd46f9f5bde4e6102aff"
|
||||
integrity sha512-Jt9tIBkRc9POUof7QA/VwWd+58fKkEEfI+/t1/eOlxKM7ZhrczNzMFefge7Ai+39y1pR/pP6cI19guHy3FSLmw==
|
||||
|
||||
character-entities-html4@^1.0.0:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-1.1.2.tgz#c44fdde3ce66b52e8d321d6c1bf46101f0150610"
|
||||
integrity sha512-sIrXwyna2+5b0eB9W149izTPJk/KkJTg6mEzDGibwBUkyH1SbDa+nf515Ppdi3MaH35lW0JFJDWeq9Luzes1Iw==
|
||||
|
||||
character-entities-legacy@^1.0.0:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-1.1.2.tgz#7c6defb81648498222c9855309953d05f4d63a9c"
|
||||
integrity sha512-9NB2VbXtXYWdXzqrvAHykE/f0QJxzaKIpZ5QzNZrrgQ7Iyxr2vnfS8fCBNVW9nUEZE0lo57nxKRqnzY/dKrwlA==
|
||||
|
||||
character-entities@^1.0.0:
|
||||
version "1.2.2"
|
||||
resolved "https://registry.npmjs.org/character-entities/-/character-entities-1.2.2.tgz#58c8f371c0774ef0ba9b2aca5f00d8f100e6e363"
|
||||
integrity sha512-sMoHX6/nBiy3KKfC78dnEalnpn0Az0oSNvqUWYTtYrhRI5iUIYsROU48G+E+kMFQzqXaJ8kHJZ85n7y6/PHgwQ==
|
||||
|
||||
character-reference-invalid@^1.0.0:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-1.1.2.tgz#21e421ad3d84055952dab4a43a04e73cd425d3ed"
|
||||
integrity sha512-7I/xceXfKyUJmSAn/jw8ve/9DyOP7XxufNYLI9Px7CmsKgEUaZLUTax6nZxGQtaoiZCjpu6cHPj20xC/vqRReQ==
|
||||
|
||||
collapse-white-space@^1.0.0, collapse-white-space@^1.0.2:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.npmjs.org/collapse-white-space/-/collapse-white-space-1.0.4.tgz#ce05cf49e54c3277ae573036a26851ba430a0091"
|
||||
integrity sha512-YfQ1tAUZm561vpYD+5eyWN8+UsceQbSrqqlc/6zDY2gtAE+uZLSdkkovhnGpmCThsvKBFakq4EdY/FF93E8XIw==
|
||||
|
||||
comma-separated-tokens@^1.0.0, comma-separated-tokens@^1.0.1:
|
||||
version "1.0.5"
|
||||
resolved "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-1.0.5.tgz#b13793131d9ea2d2431cf5b507ddec258f0ce0db"
|
||||
integrity sha512-Cg90/fcK93n0ecgYTAz1jaA3zvnQ0ExlmKY1rdbyHqAx6BHxwoJc+J7HDu0iuQ7ixEs1qaa+WyQ6oeuBpYP1iA==
|
||||
dependencies:
|
||||
trim "0.0.1"
|
||||
|
||||
detab@^2.0.0:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.npmjs.org/detab/-/detab-2.0.1.tgz#531f5e326620e2fd4f03264a905fb3bcc8af4df4"
|
||||
integrity sha512-/hhdqdQc5thGrqzjyO/pz76lDZ5GSuAs6goxOaKTsvPk7HNnzAyFN5lyHgqpX4/s1i66K8qMGj+VhA9504x7DQ==
|
||||
dependencies:
|
||||
repeat-string "^1.5.4"
|
||||
|
||||
doctype@^2.0.0:
|
||||
version "2.0.2"
|
||||
resolved "https://registry.npmjs.org/doctype/-/doctype-2.0.2.tgz#b791fb52f57f300a3e81d1b2816517c044ff1432"
|
||||
integrity sha512-RuESV/brHB7HGyUWzlHvFaaHQspzld15CC0RG+nzbuD+KQNDvxWmbubGrhqwF0SJqbbEGt8lncSTtghI/vNb6Q==
|
||||
|
||||
extend@^3.0.0:
|
||||
version "3.0.2"
|
||||
resolved "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa"
|
||||
integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==
|
||||
|
||||
hast-util-embedded@^1.0.0, hast-util-embedded@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.npmjs.org/hast-util-embedded/-/hast-util-embedded-1.0.1.tgz#2889896b4fd1d485a51cb9ce4f5bd17b47049eba"
|
||||
integrity sha512-VreBCMxmSRCT7OjZihrth3ByA9GtLKbRyoDJafP/1vxAxx+VNdhHKKADCSIyMGvrvTExVRqU/BnVq51dxMLAeQ==
|
||||
dependencies:
|
||||
hast-util-is-element "^1.0.0"
|
||||
|
||||
hast-util-has-property@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.npmjs.org/hast-util-has-property/-/hast-util-has-property-1.0.1.tgz#ac08c40bcbf27b80a85aaae91e4f6250a53e802f"
|
||||
integrity sha512-DUck5lp8ku3o8n9GIA1Nghdz8UQyis2/b/ro0O4z5HP/y82uzZL6CXehuQmY5re+rLgTP4MVF/YpYDj9YqD0wA==
|
||||
|
||||
hast-util-is-body-ok-link@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.npmjs.org/hast-util-is-body-ok-link/-/hast-util-is-body-ok-link-1.0.1.tgz#f5d8893f4f21fa1ae51c059ac29abdbc8e6e6046"
|
||||
integrity sha512-qFDY0oz0lbc0DOcy61BSgJo+wi/ykFs4p95YjrtRP81eNfmBPs/Z0j4WLFmepJ6znfxLlRcPpic8FOdzCD5aKw==
|
||||
dependencies:
|
||||
hast-util-has-property "^1.0.0"
|
||||
hast-util-is-element "^1.0.0"
|
||||
|
||||
hast-util-is-element@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.npmjs.org/hast-util-is-element/-/hast-util-is-element-1.0.1.tgz#c76e8aafbdb6e5c83265bf50324e2f2e024eb12a"
|
||||
integrity sha512-s/ggaNehYVqmLgTXEv12Lbb72bsOD2r5DhAqPgtDdaI/YFNXVzz0zHFVJnhjIjn7Nak8GbL4nzT2q0RA5div+A==
|
||||
|
||||
hast-util-parse-selector@^2.2.0:
|
||||
version "2.2.0"
|
||||
resolved "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-2.2.0.tgz#2175f18cdd697308fc3431d5c29a9e48dfa4817a"
|
||||
integrity sha512-trw0pqZN7+sH9k7hPWCJNZUbWW2KroSIM/XpIy3G5ZMtx9LSabCyoSp4skJZ4q/eZ5UOBPtvWh4W9c+RE3HRoQ==
|
||||
|
||||
hast-util-phrasing@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.npmjs.org/hast-util-phrasing/-/hast-util-phrasing-1.0.1.tgz#c2167222ac18c93459681aeba06d8169fd267de2"
|
||||
integrity sha512-PS7eg0yzYyVsTEf82CyrY0nMevcjofTcs7ygi3m6ykggveKqmNc39+/1JWT478piWt3hq5gOsXbMoCxjRQi+rA==
|
||||
dependencies:
|
||||
hast-util-embedded "^1.0.0"
|
||||
hast-util-has-property "^1.0.0"
|
||||
hast-util-is-body-ok-link "^1.0.0"
|
||||
hast-util-is-element "^1.0.0"
|
||||
|
||||
hast-util-to-html@^4.0.0:
|
||||
version "4.0.1"
|
||||
resolved "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-4.0.1.tgz#3666b05afb62bd69f8f5e6c94db04dea19438e2a"
|
||||
integrity sha512-2emzwyf0xEsc4TBIPmDJmBttIw8R4SXAJiJZoiRR/s47ODYWgOqNoDbf2SJAbMbfNdFWMiCSOrI3OVnX6Qq2Mg==
|
||||
dependencies:
|
||||
ccount "^1.0.0"
|
||||
comma-separated-tokens "^1.0.1"
|
||||
hast-util-is-element "^1.0.0"
|
||||
hast-util-whitespace "^1.0.0"
|
||||
html-void-elements "^1.0.0"
|
||||
property-information "^4.0.0"
|
||||
space-separated-tokens "^1.0.0"
|
||||
stringify-entities "^1.0.1"
|
||||
unist-util-is "^2.0.0"
|
||||
xtend "^4.0.1"
|
||||
|
||||
hast-util-whitespace@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-1.0.1.tgz#d67da2c87637b1ce1d85dd15b270ba057930149a"
|
||||
integrity sha512-Mfx2ZnmVMTAopZ8as42nKrNt650tCZYhy/MPeO1Imdg/cmCWK6GUSnFrrE3ezGjVifn7x5zMfu8jrjwIGyImSw==
|
||||
|
||||
hastscript@^4.0.0:
|
||||
version "4.1.0"
|
||||
resolved "https://registry.npmjs.org/hastscript/-/hastscript-4.1.0.tgz#ea5593fa6f6709101fc790ced818393ddaa045ce"
|
||||
integrity sha512-bOTn9hEfzewvHyXdbYGKqOr/LOz+2zYhKbC17U2YAjd16mnjqB1BQ0nooM/RdMy/htVyli0NAznXiBtwDi1cmQ==
|
||||
dependencies:
|
||||
comma-separated-tokens "^1.0.0"
|
||||
hast-util-parse-selector "^2.2.0"
|
||||
property-information "^4.0.0"
|
||||
space-separated-tokens "^1.0.0"
|
||||
|
||||
html-void-elements@^1.0.0:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.npmjs.org/html-void-elements/-/html-void-elements-1.0.3.tgz#956707dbecd10cf658c92c5d27fee763aa6aa982"
|
||||
integrity sha512-SaGhCDPXJVNrQyKMtKy24q6IMdXg5FCPN3z+xizxw9l+oXQw5fOoaj/ERU5KqWhSYhXtW5bWthlDbTDLBhJQrA==
|
||||
|
||||
html-whitespace-sensitive-tag-names@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.npmjs.org/html-whitespace-sensitive-tag-names/-/html-whitespace-sensitive-tag-names-1.0.0.tgz#fd6ed3a3d631ce29341aefe26a8fea720d3adfa7"
|
||||
integrity sha1-/W7To9Yxzik0Gu/iao/qcg0636c=
|
||||
|
||||
inherits@^2.0.1:
|
||||
version "2.0.3"
|
||||
resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz#633c2c83e3da42a502f52466022480f4208261de"
|
||||
integrity sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=
|
||||
|
||||
is-alphabetical@^1.0.0:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-1.0.2.tgz#1fa6e49213cb7885b75d15862fb3f3d96c884f41"
|
||||
integrity sha512-V0xN4BYezDHcBSKb1QHUFMlR4as/XEuCZBzMJUU4n7+Cbt33SmUnSol+pnXFvLxSHNq2CemUXNdaXV6Flg7+xg==
|
||||
|
||||
is-alphanumerical@^1.0.0:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-1.0.2.tgz#1138e9ae5040158dc6ff76b820acd6b7a181fd40"
|
||||
integrity sha512-pyfU/0kHdISIgslFfZN9nfY1Gk3MquQgUm1mJTjdkEPpkAKNWuBTSqFwewOpR7N351VkErCiyV71zX7mlQQqsg==
|
||||
dependencies:
|
||||
is-alphabetical "^1.0.0"
|
||||
is-decimal "^1.0.0"
|
||||
|
||||
is-buffer@^2.0.0:
|
||||
version "2.0.3"
|
||||
resolved "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.3.tgz#4ecf3fcf749cbd1e472689e109ac66261a25e725"
|
||||
integrity sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw==
|
||||
|
||||
is-decimal@^1.0.0:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.npmjs.org/is-decimal/-/is-decimal-1.0.2.tgz#894662d6a8709d307f3a276ca4339c8fa5dff0ff"
|
||||
integrity sha512-TRzl7mOCchnhchN+f3ICUCzYvL9ul7R+TYOsZ8xia++knyZAJfv/uA1FvQXsAnYIl1T3B2X5E/J7Wb1QXiIBXg==
|
||||
|
||||
is-hexadecimal@^1.0.0:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-1.0.2.tgz#b6e710d7d07bb66b98cb8cece5c9b4921deeb835"
|
||||
integrity sha512-but/G3sapV3MNyqiDBLrOi4x8uCIw0RY3o/Vb5GT0sMFHrVV7731wFSVy41T5FO1og7G0gXLJh0MkgPRouko/A==
|
||||
|
||||
is-plain-obj@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e"
|
||||
integrity sha1-caUMhCnfync8kqOQpKA7OfzVHT4=
|
||||
|
||||
is-whitespace-character@^1.0.0:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.npmjs.org/is-whitespace-character/-/is-whitespace-character-1.0.2.tgz#ede53b4c6f6fb3874533751ec9280d01928d03ed"
|
||||
integrity sha512-SzM+T5GKUCtLhlHFKt2SDAX2RFzfS6joT91F2/WSi9LxgFdsnhfPK/UIA+JhRR2xuyLdrCys2PiFDrtn1fU5hQ==
|
||||
|
||||
is-word-character@^1.0.0:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.npmjs.org/is-word-character/-/is-word-character-1.0.2.tgz#46a5dac3f2a1840898b91e576cd40d493f3ae553"
|
||||
integrity sha512-T3FlsX8rCHAH8e7RE7PfOPZVFQlcV3XRF9eOOBQ1uf70OxO7CjjSOjeImMPCADBdYWcStAbVbYvJ1m2D3tb+EA==
|
||||
|
||||
markdown-escapes@^1.0.0:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.npmjs.org/markdown-escapes/-/markdown-escapes-1.0.2.tgz#e639cbde7b99c841c0bacc8a07982873b46d2122"
|
||||
integrity sha512-lbRZ2mE3Q9RtLjxZBZ9+IMl68DKIXaVAhwvwn9pmjnPLS0h/6kyBMgNhqi1xFJ/2yv6cSyv0jbiZavZv93JkkA==
|
||||
|
||||
mdast-util-definitions@^1.2.0:
|
||||
version "1.2.3"
|
||||
resolved "https://registry.npmjs.org/mdast-util-definitions/-/mdast-util-definitions-1.2.3.tgz#49f936b09207c45b438db19551652934312f04f0"
|
||||
integrity sha512-P6wpRO8YVQ1iv30maMc93NLh7COvufglBE8/ldcOyYmk5EbfF0YeqlLgtqP/FOBU501Kqar1x5wYWwB3Nga74g==
|
||||
dependencies:
|
||||
unist-util-visit "^1.0.0"
|
||||
|
||||
mdast-util-to-hast@^3.0.0:
|
||||
version "3.0.2"
|
||||
resolved "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-3.0.2.tgz#26b1971f49d6db1e3428463a12e66c89db5021cb"
|
||||
integrity sha512-YI8Ea3TFWEZrS31+6Q/d8ZYTOSDKM06IPc3l2+OMFX1o3JTG2mrztlmzDsUMwIXLWofEdTVl/WXBgRG6ddlU/A==
|
||||
dependencies:
|
||||
collapse-white-space "^1.0.0"
|
||||
detab "^2.0.0"
|
||||
mdast-util-definitions "^1.2.0"
|
||||
mdurl "^1.0.1"
|
||||
trim "0.0.1"
|
||||
trim-lines "^1.0.0"
|
||||
unist-builder "^1.0.1"
|
||||
unist-util-generated "^1.1.0"
|
||||
unist-util-position "^3.0.0"
|
||||
unist-util-visit "^1.1.0"
|
||||
xtend "^4.0.1"
|
||||
|
||||
mdurl@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz#fe85b2ec75a59037f2adfec100fd6c601761152e"
|
||||
integrity sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4=
|
||||
|
||||
object-assign@^4.1.0:
|
||||
version "4.1.1"
|
||||
resolved "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
|
||||
integrity sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=
|
||||
|
||||
once@^1.4.0:
|
||||
version "1.4.0"
|
||||
resolved "https://registry.npmjs.org/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
|
||||
integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E=
|
||||
dependencies:
|
||||
wrappy "1"
|
||||
|
||||
parse-entities@^1.1.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.npmjs.org/parse-entities/-/parse-entities-1.2.0.tgz#9deac087661b2e36814153cb78d7e54a4c5fd6f4"
|
||||
integrity sha512-XXtDdOPLSB0sHecbEapQi6/58U/ODj/KWfIXmmMCJF/eRn8laX6LZbOyioMoETOOJoWRW8/qTSl5VQkUIfKM5g==
|
||||
dependencies:
|
||||
character-entities "^1.0.0"
|
||||
character-entities-legacy "^1.0.0"
|
||||
character-reference-invalid "^1.0.0"
|
||||
is-alphanumerical "^1.0.0"
|
||||
is-decimal "^1.0.0"
|
||||
is-hexadecimal "^1.0.0"
|
||||
|
||||
property-information@^4.0.0:
|
||||
version "4.2.0"
|
||||
resolved "https://registry.npmjs.org/property-information/-/property-information-4.2.0.tgz#f0e66e07cbd6fed31d96844d958d153ad3eb486e"
|
||||
integrity sha512-TlgDPagHh+eBKOnH2VYvk8qbwsCG/TAJdmTL7f1PROUcSO8qt/KSmShEQ/OKvock8X9tFjtqjCScyOkkkvIKVQ==
|
||||
dependencies:
|
||||
xtend "^4.0.1"
|
||||
|
||||
rehype-document@^2.2.0:
|
||||
version "2.2.0"
|
||||
resolved "https://registry.npmjs.org/rehype-document/-/rehype-document-2.2.0.tgz#cf884a1b05811c3f1f46ec7e85ffb59d60c1e134"
|
||||
integrity sha512-/eIHrU84/mdikF2HjEh1zcfylKjj6xlga9MPS3nvv50gO5xAsjtqHPZ2Jom0XUfgsOQkqvV9S/HzqrTTjWQq0A==
|
||||
dependencies:
|
||||
doctype "^2.0.0"
|
||||
hastscript "^4.0.0"
|
||||
unist-builder "^1.0.1"
|
||||
|
||||
rehype-format@^2.3.0:
|
||||
version "2.3.0"
|
||||
resolved "https://registry.npmjs.org/rehype-format/-/rehype-format-2.3.0.tgz#ebbf6b8579e8194574c1ac4dfb306c29c0b074da"
|
||||
integrity sha512-uv09q8BdbeRIo5LLrt8cMnONX6HUvpzvcwxjLiC5XLIeYb6KA7AS2inSJXQJ1Wu2B5rHK8CQgcoiig4Jr8krGA==
|
||||
dependencies:
|
||||
hast-util-embedded "^1.0.1"
|
||||
hast-util-phrasing "^1.0.0"
|
||||
html-whitespace-sensitive-tag-names "^1.0.0"
|
||||
rehype-minify-whitespace "^2.0.0"
|
||||
repeat-string "^1.5.4"
|
||||
unist-util-visit-parents "^1.0.0"
|
||||
|
||||
rehype-minify-whitespace@^2.0.0:
|
||||
version "2.0.3"
|
||||
resolved "https://registry.npmjs.org/rehype-minify-whitespace/-/rehype-minify-whitespace-2.0.3.tgz#9aef3b73d0dfbcf890844d10d8f45fd5bdf145ec"
|
||||
integrity sha512-KzOH3F92J7Wvr3WuaqSO69FuN+vwbitVYxdSolLXrwLwdo67VXn/qSYGR7gnYDJKgfm/+m3l8hZHY43Zg+YscQ==
|
||||
dependencies:
|
||||
collapse-white-space "^1.0.0"
|
||||
hast-util-embedded "^1.0.0"
|
||||
hast-util-has-property "^1.0.0"
|
||||
hast-util-is-body-ok-link "^1.0.0"
|
||||
hast-util-is-element "^1.0.0"
|
||||
html-whitespace-sensitive-tag-names "^1.0.0"
|
||||
unist-util-is "^2.0.0"
|
||||
unist-util-modify-children "^1.0.0"
|
||||
|
||||
rehype-stringify@^4.0.0:
|
||||
version "4.0.0"
|
||||
resolved "https://registry.npmjs.org/rehype-stringify/-/rehype-stringify-4.0.0.tgz#2efd32f81862f9ab05c738b0d1ebe8a32fa87dac"
|
||||
integrity sha512-ZWBQg2fW3/75jms314hu4YIqqlAwXdbzpmwd4ez/q4nKA/zKnVUKso0xe6PfGr5Xy5GXpn4uDr9gAYgBXam7vA==
|
||||
dependencies:
|
||||
hast-util-to-html "^4.0.0"
|
||||
xtend "^4.0.1"
|
||||
|
||||
remark-parse@^6.0.1:
|
||||
version "6.0.1"
|
||||
resolved "https://registry.npmjs.org/remark-parse/-/remark-parse-6.0.1.tgz#62bc4fc91045dbb0a9fc6900150b0404e2598e99"
|
||||
integrity sha512-H9h8c/uafJAoVoHvIBMzWuUDxDckW7+tc60/OkstZQw6fv7qDX6ALl3A8a1G6aRrx1s4WeaF0spm4WbXHAHcOw==
|
||||
dependencies:
|
||||
collapse-white-space "^1.0.2"
|
||||
is-alphabetical "^1.0.0"
|
||||
is-decimal "^1.0.0"
|
||||
is-whitespace-character "^1.0.0"
|
||||
is-word-character "^1.0.0"
|
||||
markdown-escapes "^1.0.0"
|
||||
parse-entities "^1.1.0"
|
||||
repeat-string "^1.5.4"
|
||||
state-toggle "^1.0.0"
|
||||
trim "0.0.1"
|
||||
trim-trailing-lines "^1.0.0"
|
||||
unherit "^1.0.4"
|
||||
unist-util-remove-position "^1.0.0"
|
||||
vfile-location "^2.0.0"
|
||||
xtend "^4.0.1"
|
||||
|
||||
remark-rehype@^3.0.1:
|
||||
version "3.0.1"
|
||||
resolved "https://registry.npmjs.org/remark-rehype/-/remark-rehype-3.0.1.tgz#7c35c08e022ca55bd33719548dd555b1a721a181"
|
||||
integrity sha512-A9oIvjlUwY2qLNrgoH7MxQb6EEs7kgdOXLtY/5CYCnvsupor7e7gTGmfkzccBkqJ/6nkbEdiX3hfY11FAvYGHg==
|
||||
dependencies:
|
||||
mdast-util-to-hast "^3.0.0"
|
||||
|
||||
repeat-string@^1.5.4:
|
||||
version "1.6.1"
|
||||
resolved "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637"
|
||||
integrity sha1-jcrkcOHIirwtYA//Sndihtp15jc=
|
||||
|
||||
replace-ext@1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.0.tgz#de63128373fcbf7c3ccfa4de5a480c45a67958eb"
|
||||
integrity sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs=
|
||||
|
||||
space-separated-tokens@^1.0.0:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-1.1.2.tgz#e95ab9d19ae841e200808cd96bc7bd0adbbb3412"
|
||||
integrity sha512-G3jprCEw+xFEs0ORweLmblJ3XLymGGr6hxZYTYZjIlvDti9vOBUjRQa1Rzjt012aRrocKstHwdNi+F7HguPsEA==
|
||||
dependencies:
|
||||
trim "0.0.1"
|
||||
|
||||
state-toggle@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.npmjs.org/state-toggle/-/state-toggle-1.0.1.tgz#c3cb0974f40a6a0f8e905b96789eb41afa1cde3a"
|
||||
integrity sha512-Qe8QntFrrpWTnHwvwj2FZTgv+PKIsp0B9VxLzLLbSpPXWOgRgc5LVj/aTiSfK1RqIeF9jeC1UeOH8Q8y60A7og==
|
||||
|
||||
stringify-entities@^1.0.1:
|
||||
version "1.3.2"
|
||||
resolved "https://registry.npmjs.org/stringify-entities/-/stringify-entities-1.3.2.tgz#a98417e5471fd227b3e45d3db1861c11caf668f7"
|
||||
integrity sha512-nrBAQClJAPN2p+uGCVJRPIPakKeKWZ9GtBCmormE7pWOSlHat7+x5A8gx85M7HM5Dt0BP3pP5RhVW77WdbJJ3A==
|
||||
dependencies:
|
||||
character-entities-html4 "^1.0.0"
|
||||
character-entities-legacy "^1.0.0"
|
||||
is-alphanumerical "^1.0.0"
|
||||
is-hexadecimal "^1.0.0"
|
||||
|
||||
trim-lines@^1.0.0:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.npmjs.org/trim-lines/-/trim-lines-1.1.1.tgz#da738ff58fa74817588455e30b11b85289f2a396"
|
||||
integrity sha512-X+eloHbgJGxczUk1WSjIvn7aC9oN3jVE3rQfRVKcgpavi3jxtCn0VVKtjOBj64Yop96UYn/ujJRpTbCdAF1vyg==
|
||||
|
||||
trim-trailing-lines@^1.0.0:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.npmjs.org/trim-trailing-lines/-/trim-trailing-lines-1.1.1.tgz#e0ec0810fd3c3f1730516b45f49083caaf2774d9"
|
||||
integrity sha512-bWLv9BbWbbd7mlqqs2oQYnLD/U/ZqeJeJwbO0FG2zA1aTq+HTvxfHNKFa/HGCVyJpDiioUYaBhfiT6rgk+l4mg==
|
||||
|
||||
trim@0.0.1:
|
||||
version "0.0.1"
|
||||
resolved "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz#5858547f6b290757ee95cccc666fb50084c460dd"
|
||||
integrity sha1-WFhUf2spB1fulczMZm+1AITEYN0=
|
||||
|
||||
trough@^1.0.0:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.npmjs.org/trough/-/trough-1.0.3.tgz#e29bd1614c6458d44869fc28b255ab7857ef7c24"
|
||||
integrity sha512-fwkLWH+DimvA4YCy+/nvJd61nWQQ2liO/nF/RjkTpiOGi+zxZzVkhb1mvbHIIW4b/8nDsYI8uTmAlc0nNkRMOw==
|
||||
|
||||
unherit@^1.0.4:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.npmjs.org/unherit/-/unherit-1.1.1.tgz#132748da3e88eab767e08fabfbb89c5e9d28628c"
|
||||
integrity sha512-+XZuV691Cn4zHsK0vkKYwBEwB74T3IZIcxrgn2E4rKwTfFyI1zCh7X7grwh9Re08fdPlarIdyWgI8aVB3F5A5g==
|
||||
dependencies:
|
||||
inherits "^2.0.1"
|
||||
xtend "^4.0.1"
|
||||
|
||||
unified-stream@^1.0.2:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.npmjs.org/unified-stream/-/unified-stream-1.0.2.tgz#e905138dfb0ffbb2e64e49b2ea89fc09e32a8ee5"
|
||||
integrity sha512-hMPof8kORTeQwHjZ14rSM7Bb0prwFkjt248n9ZLkRBbxRLG3cIb+9htMRxMoGx8A3OiyTx3qfUZEcPV1P5a/YQ==
|
||||
dependencies:
|
||||
once "^1.4.0"
|
||||
|
||||
unified@^7.0.0:
|
||||
version "7.0.0"
|
||||
resolved "https://registry.npmjs.org/unified/-/unified-7.0.0.tgz#9c8f4fcee78f8e7e895f0e3d6adb53bd015e1a53"
|
||||
integrity sha512-j+Sm7upmmt3RXPBeA+KFGYBlHBxClnby2DtxezFKwMfhWTAklY4WbEdhwRo6c6GpuHdi04YDsyPKY/kh5a/xnQ==
|
||||
dependencies:
|
||||
bail "^1.0.0"
|
||||
extend "^3.0.0"
|
||||
is-plain-obj "^1.1.0"
|
||||
trough "^1.0.0"
|
||||
vfile "^3.0.0"
|
||||
x-is-string "^0.1.0"
|
||||
|
||||
unist-builder@^1.0.1:
|
||||
version "1.0.3"
|
||||
resolved "https://registry.npmjs.org/unist-builder/-/unist-builder-1.0.3.tgz#ab0f9d0f10936b74f3e913521955b0478e0ff036"
|
||||
integrity sha512-/KB8GEaoeHRyIqClL+Kam+Y5NWJ6yEiPsAfv1M+O1p+aKGgjR89WwoEHKTyOj17L6kAlqtKpAgv2nWvdbQDEig==
|
||||
dependencies:
|
||||
object-assign "^4.1.0"
|
||||
|
||||
unist-util-generated@^1.1.0:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.npmjs.org/unist-util-generated/-/unist-util-generated-1.1.2.tgz#8b993f9239d8e560be6ee6e91c3f7b7208e5ce25"
|
||||
integrity sha512-1HcwiEO62dr0XWGT+abVK4f0aAm8Ik8N08c5nAYVmuSxfvpA9rCcNyX/le8xXj1pJK5nBrGlZefeWB6bN8Pstw==
|
||||
|
||||
unist-util-is@^2.0.0, unist-util-is@^2.1.2:
|
||||
version "2.1.2"
|
||||
resolved "https://registry.npmjs.org/unist-util-is/-/unist-util-is-2.1.2.tgz#1193fa8f2bfbbb82150633f3a8d2eb9a1c1d55db"
|
||||
integrity sha512-YkXBK/H9raAmG7KXck+UUpnKiNmUdB+aBGrknfQ4EreE1banuzrKABx3jP6Z5Z3fMSPMQQmeXBlKpCbMwBkxVw==
|
||||
|
||||
unist-util-modify-children@^1.0.0:
|
||||
version "1.1.3"
|
||||
resolved "https://registry.npmjs.org/unist-util-modify-children/-/unist-util-modify-children-1.1.3.tgz#d764a935f612dfb21b1bb92b0ea24321dc19a5f7"
|
||||
integrity sha512-Aw3Us+NPrJGYWyLhcaqYzgxd/pryIanDNHVVvwdtTEEQ3Yfa/+sjnT2EeAAHbtTMAaYEdPW3XN6jxbzVWAo/BQ==
|
||||
dependencies:
|
||||
array-iterate "^1.0.0"
|
||||
|
||||
unist-util-position@^3.0.0:
|
||||
version "3.0.1"
|
||||
resolved "https://registry.npmjs.org/unist-util-position/-/unist-util-position-3.0.1.tgz#8e220c24658239bf7ddafada5725ed0ea1ebbc26"
|
||||
integrity sha512-05QfJDPI7PE1BIUtAxeSV+cDx21xP7+tUZgSval5CA7tr0pHBwybF7OnEa1dOFqg6BfYH/qiMUnWwWj+Frhlww==
|
||||
|
||||
unist-util-remove-position@^1.0.0:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.npmjs.org/unist-util-remove-position/-/unist-util-remove-position-1.1.2.tgz#86b5dad104d0bbfbeb1db5f5c92f3570575c12cb"
|
||||
integrity sha512-XxoNOBvq1WXRKXxgnSYbtCF76TJrRoe5++pD4cCBsssSiWSnPEktyFrFLE8LTk3JW5mt9hB0Sk5zn4x/JeWY7Q==
|
||||
dependencies:
|
||||
unist-util-visit "^1.1.0"
|
||||
|
||||
unist-util-stringify-position@^1.0.0, unist-util-stringify-position@^1.1.1:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-1.1.2.tgz#3f37fcf351279dcbca7480ab5889bb8a832ee1c6"
|
||||
integrity sha512-pNCVrk64LZv1kElr0N1wPiHEUoXNVFERp+mlTg/s9R5Lwg87f9bM/3sQB99w+N9D/qnM9ar3+AKDBwo/gm/iQQ==
|
||||
|
||||
unist-util-visit-parents@^1.0.0:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-1.1.2.tgz#f6e3afee8bdbf961c0e6f028ea3c0480028c3d06"
|
||||
integrity sha512-yvo+MMLjEwdc3RhhPYSximset7rwjMrdt9E41Smmvg25UQIenzrN83cRnF1JMzoMi9zZOQeYXHSDf7p+IQkW3Q==
|
||||
|
||||
unist-util-visit-parents@^2.0.0:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.npmjs.org/unist-util-visit-parents/-/unist-util-visit-parents-2.0.1.tgz#63fffc8929027bee04bfef7d2cce474f71cb6217"
|
||||
integrity sha512-6B0UTiMfdWql4cQ03gDTCSns+64Zkfo2OCbK31Ov0uMizEz+CJeAp0cgZVb5Fhmcd7Bct2iRNywejT0orpbqUA==
|
||||
dependencies:
|
||||
unist-util-is "^2.1.2"
|
||||
|
||||
unist-util-visit@^1.0.0, unist-util-visit@^1.1.0:
|
||||
version "1.4.0"
|
||||
resolved "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-1.4.0.tgz#1cb763647186dc26f5e1df5db6bd1e48b3cc2fb1"
|
||||
integrity sha512-FiGu34ziNsZA3ZUteZxSFaczIjGmksfSgdKqBfOejrrfzyUy5b7YrlzT1Bcvi+djkYDituJDy2XB7tGTeBieKw==
|
||||
dependencies:
|
||||
unist-util-visit-parents "^2.0.0"
|
||||
|
||||
vfile-location@^2.0.0:
|
||||
version "2.0.3"
|
||||
resolved "https://registry.npmjs.org/vfile-location/-/vfile-location-2.0.3.tgz#083ba80e50968e8d420be49dd1ea9a992131df77"
|
||||
integrity sha512-zM5/l4lfw1CBoPx3Jimxoc5RNDAHHpk6AM6LM0pTIkm5SUSsx8ZekZ0PVdf0WEZ7kjlhSt7ZlqbRL6Cd6dBs6A==
|
||||
|
||||
vfile-message@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.npmjs.org/vfile-message/-/vfile-message-1.0.1.tgz#51a2ccd8a6b97a7980bb34efb9ebde9632e93677"
|
||||
integrity sha512-vSGCkhNvJzO6VcWC6AlJW4NtYOVtS+RgCaqFIYUjoGIlHnFL+i0LbtYvonDWOMcB97uTPT4PRsyYY7REWC9vug==
|
||||
dependencies:
|
||||
unist-util-stringify-position "^1.1.1"
|
||||
|
||||
vfile@^3.0.0:
|
||||
version "3.0.1"
|
||||
resolved "https://registry.npmjs.org/vfile/-/vfile-3.0.1.tgz#47331d2abe3282424f4a4bb6acd20a44c4121803"
|
||||
integrity sha512-y7Y3gH9BsUSdD4KzHsuMaCzRjglXN0W2EcMf0gpvu6+SbsGhMje7xDc8AEoeXy6mIwCKMI6BkjMsRjzQbhMEjQ==
|
||||
dependencies:
|
||||
is-buffer "^2.0.0"
|
||||
replace-ext "1.0.0"
|
||||
unist-util-stringify-position "^1.0.0"
|
||||
vfile-message "^1.0.0"
|
||||
|
||||
wrappy@1:
|
||||
version "1.0.2"
|
||||
resolved "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
|
||||
integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=
|
||||
|
||||
x-is-string@^0.1.0:
|
||||
version "0.1.0"
|
||||
resolved "https://registry.npmjs.org/x-is-string/-/x-is-string-0.1.0.tgz#474b50865af3a49a9c4657f05acd145458f77d82"
|
||||
integrity sha1-R0tQhlrzpJqcRlfwWs0UVFj3fYI=
|
||||
|
||||
xtend@^4.0.1:
|
||||
version "4.0.1"
|
||||
resolved "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af"
|
||||
integrity sha1-pcbVMr5lbiPbgg77lDofBJmNY68=
|
||||
@@ -1 +0,0 @@
|
||||
/test
|
||||
@@ -1,52 +0,0 @@
|
||||
const download = require('@now/build-utils/fs/download.js'); // eslint-disable-line import/no-extraneous-dependencies
|
||||
const fs = require('fs');
|
||||
const { promisify } = require('util');
|
||||
const getWritableDirectory = require('@now/build-utils/fs/get-writable-directory.js'); // eslint-disable-line import/no-extraneous-dependencies
|
||||
const glob = require('@now/build-utils/fs/glob.js'); // eslint-disable-line import/no-extraneous-dependencies
|
||||
const path = require('path');
|
||||
const { runNpmInstall } = require('@now/build-utils/fs/run-user-scripts.js'); // eslint-disable-line import/no-extraneous-dependencies
|
||||
|
||||
const writeFile = promisify(fs.writeFile);
|
||||
|
||||
exports.build = async ({
|
||||
files, entrypoint, workPath, meta,
|
||||
}) => {
|
||||
console.log('downloading user files...');
|
||||
const downloadedFiles = await download(files, workPath, meta);
|
||||
console.log('writing package.json...');
|
||||
const packageJson = { dependencies: { 'mdx-deck': '1.7.15' } };
|
||||
const packageJsonPath = path.join(workPath, 'package.json');
|
||||
await writeFile(packageJsonPath, JSON.stringify(packageJson));
|
||||
console.log('installing dependencies...');
|
||||
process.env.PUPPETEER_SKIP_CHROMIUM_DOWNLOAD = '1'; // TODO opts argument for runNpmInstall
|
||||
await runNpmInstall(path.dirname(packageJsonPath), [
|
||||
'--prod',
|
||||
'--prefer-offline',
|
||||
]);
|
||||
console.log('building...');
|
||||
const outDir = await getWritableDirectory();
|
||||
const entrypointFsPath = downloadedFiles[entrypoint].fsPath;
|
||||
const mountpoint = path.dirname(entrypoint);
|
||||
|
||||
const build = require(path.join(
|
||||
workPath,
|
||||
'node_modules/mdx-deck/lib/build.js',
|
||||
));
|
||||
|
||||
await build({
|
||||
html: true,
|
||||
dirname: workPath,
|
||||
outDir,
|
||||
globals: {
|
||||
FILENAME: JSON.stringify(entrypointFsPath),
|
||||
},
|
||||
});
|
||||
|
||||
return glob('**', outDir, mountpoint);
|
||||
};
|
||||
|
||||
exports.prepareCache = async ({ workPath }) => ({
|
||||
...(await glob('node_modules/**', workPath)),
|
||||
...(await glob('package-lock.json', workPath)),
|
||||
...(await glob('yarn.lock', workPath)),
|
||||
});
|
||||
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"name": "@now/mdx-deck",
|
||||
"version": "0.5.5",
|
||||
"license": "MIT",
|
||||
"homepage": "https://zeit.co/docs/v2/deployments/official-builders/mdx-deck-now-mdx-deck",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zeit/now-builders.git",
|
||||
"directory": "packages/now-mdx-deck"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jest"
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
# Testing Markdown
|
||||
---
|
||||
cow:RANDOMNESS_PLACEHOLDER
|
||||
---
|
||||
[Wow a link!](https://zeit.co)
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"version": 2,
|
||||
"builds": [
|
||||
{ "src": "index.mdx", "use": "@now/mdx-deck" },
|
||||
{ "src": "subdirectory/index.mdx", "use": "@now/mdx-deck" }
|
||||
],
|
||||
"probes": [
|
||||
{ "path": "/", "mustContain": "cow:RANDOMNESS_PLACEHOLDER" },
|
||||
{ "path": "/subdirectory/", "mustContain": "yoda:RANDOMNESS_PLACEHOLDER" }
|
||||
]
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
# Testing Markdown
|
||||
---
|
||||
yoda:RANDOMNESS_PLACEHOLDER
|
||||
---
|
||||
[Wow a link!](https://zeit.co)
|
||||
@@ -1,33 +0,0 @@
|
||||
/* global beforeAll, expect, it, jest */
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const {
|
||||
packAndDeploy,
|
||||
testDeployment,
|
||||
} = require('../../../test/lib/deployment/test-deployment.js');
|
||||
|
||||
jest.setTimeout(4 * 60 * 1000);
|
||||
const buildUtilsUrl = '@canary';
|
||||
let builderUrl;
|
||||
|
||||
beforeAll(async () => {
|
||||
const builderPath = path.resolve(__dirname, '..');
|
||||
builderUrl = await packAndDeploy(builderPath);
|
||||
console.log('builderUrl', builderUrl);
|
||||
});
|
||||
|
||||
const fixturesPath = path.resolve(__dirname, 'fixtures');
|
||||
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const fixture of fs.readdirSync(fixturesPath)) {
|
||||
// eslint-disable-next-line no-loop-func
|
||||
it(`should build ${fixture}`, async () => {
|
||||
await expect(
|
||||
testDeployment(
|
||||
{ builderUrl, buildUtilsUrl },
|
||||
path.join(fixturesPath, fixture),
|
||||
),
|
||||
).resolves.toBeDefined();
|
||||
});
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@now/next",
|
||||
"version": "0.5.3",
|
||||
"version": "0.5.5",
|
||||
"license": "MIT",
|
||||
"main": "./dist/index",
|
||||
"homepage": "https://zeit.co/docs/v2/deployments/official-builders/next-js-now-next",
|
||||
@@ -15,7 +15,7 @@
|
||||
"directory": "packages/now-next"
|
||||
},
|
||||
"dependencies": {
|
||||
"@now/node-bridge": "1.2.2",
|
||||
"@now/node-bridge": "1.2.3",
|
||||
"fs-extra": "^7.0.0",
|
||||
"get-port": "^5.0.0",
|
||||
"resolve-from": "^5.0.0",
|
||||
@@ -28,7 +28,6 @@
|
||||
"@types/next-server": "^8.0.0",
|
||||
"@types/resolve-from": "^5.0.1",
|
||||
"@types/semver": "^6.0.0",
|
||||
"jest": "^24.7.1",
|
||||
"typescript": "3.5.2"
|
||||
}
|
||||
}
|
||||
|
||||
51
packages/now-next/src/create-serverless-config.ts
Normal file
51
packages/now-next/src/create-serverless-config.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import path from 'path';
|
||||
import fs from 'fs-extra';
|
||||
|
||||
function getCustomData(importName: string) {
|
||||
return `
|
||||
module.exports = function(...args) {
|
||||
let original = require('./${importName}');
|
||||
|
||||
const finalConfig = {};
|
||||
const target = { target: 'serverless' };
|
||||
|
||||
if (typeof original === 'function' && original.constructor.name === 'AsyncFunction') {
|
||||
// AsyncFunctions will become promises
|
||||
original = original(...args);
|
||||
}
|
||||
|
||||
if (original instanceof Promise) {
|
||||
// Special case for promises, as it's currently not supported
|
||||
// and will just error later on
|
||||
return original
|
||||
.then((orignalConfig) => Object.assign(finalConfig, orignalConfig))
|
||||
.then((config) => Object.assign(config, target));
|
||||
} else if (typeof original === 'function') {
|
||||
Object.assign(finalConfig, original(...args));
|
||||
} else if (typeof original === 'object') {
|
||||
Object.assign(finalConfig, original);
|
||||
}
|
||||
|
||||
Object.assign(finalConfig, target);
|
||||
|
||||
return finalConfig;
|
||||
}
|
||||
`.trim();
|
||||
}
|
||||
|
||||
function getDefaultData() {
|
||||
return `module.exports = { target: 'serverless' };`;
|
||||
}
|
||||
|
||||
export default async function createServerlessConfig(workPath: string) {
|
||||
const configPath = path.join(workPath, 'next.config.js');
|
||||
const backupConfigName = `next.config.original.${Date.now()}.js`;
|
||||
const backupConfigPath = path.join(workPath, backupConfigName);
|
||||
|
||||
if (fs.existsSync(configPath)) {
|
||||
await fs.rename(configPath, backupConfigPath);
|
||||
await fs.writeFile(configPath, getCustomData(backupConfigName));
|
||||
} else {
|
||||
await fs.writeFile(configPath, getDefaultData());
|
||||
}
|
||||
}
|
||||
@@ -42,6 +42,7 @@ import {
|
||||
getDynamicRoutes,
|
||||
isDynamicRoute,
|
||||
} from './utils';
|
||||
import createServerlessConfig from './create-serverless-config';
|
||||
|
||||
interface BuildParamsMeta {
|
||||
isDev: boolean | undefined;
|
||||
@@ -150,10 +151,6 @@ function startDevServer(entryPath: string, runtimeEnv: EnvConfig) {
|
||||
return { forked, getUrl };
|
||||
}
|
||||
|
||||
export const config = {
|
||||
maxLambdaSize: '5mb',
|
||||
};
|
||||
|
||||
export const build = async ({
|
||||
files,
|
||||
workPath,
|
||||
@@ -165,8 +162,6 @@ export const build = async ({
|
||||
watch?: string[];
|
||||
childProcesses: ChildProcess[];
|
||||
}> => {
|
||||
process.env.__NEXT_BUILDER_EXPERIMENTAL_TARGET = 'serverless';
|
||||
|
||||
validateEntrypoint(entrypoint);
|
||||
|
||||
const entryDirectory = path.dirname(entrypoint);
|
||||
@@ -176,12 +171,16 @@ export const build = async ({
|
||||
console.log(`${name} Downloading user files...`);
|
||||
await download(files, workPath, meta);
|
||||
|
||||
const nodeVersion = await getNodeVersion(entryPath);
|
||||
const spawnOpts = getSpawnOptions(meta, nodeVersion);
|
||||
|
||||
const pkg = await readPackageJson(entryPath);
|
||||
const nextVersion = getNextVersion(pkg);
|
||||
|
||||
if (!meta.isDev) {
|
||||
await createServerlessConfig(workPath);
|
||||
}
|
||||
|
||||
const nodeVersion = await getNodeVersion(entryPath);
|
||||
const spawnOpts = getSpawnOptions(meta, nodeVersion);
|
||||
|
||||
if (!nextVersion) {
|
||||
throw new Error(
|
||||
'No Next.js version could be detected in "package.json". Make sure `"next"` is installed in "dependencies" or "devDependencies"'
|
||||
@@ -413,7 +412,8 @@ export const build = async ({
|
||||
const pathname = page.replace(/\.html$/, '');
|
||||
|
||||
if (isDynamicRoute(pathname)) {
|
||||
dynamicPages.push(pathname);
|
||||
dynamicPages.push(normalizePage(pathname));
|
||||
return;
|
||||
}
|
||||
|
||||
exportedPageRoutes.push({
|
||||
@@ -508,6 +508,8 @@ export const build = async ({
|
||||
}),
|
||||
{}
|
||||
);
|
||||
let dynamicPrefix = path.join('/', entryDirectory);
|
||||
dynamicPrefix = dynamicPrefix === '/' ? '' : dynamicPrefix;
|
||||
|
||||
let dynamicRoutes = getDynamicRoutes(
|
||||
entryPath,
|
||||
@@ -519,6 +521,7 @@ export const build = async ({
|
||||
if (staticPages[`${route.dest}.html`.substr(1)]) {
|
||||
route.dest = `${route.dest}.html`;
|
||||
}
|
||||
route.src = route.src.replace('^', `^${dynamicPrefix}`);
|
||||
return route;
|
||||
});
|
||||
|
||||
|
||||
@@ -236,6 +236,7 @@ function getRoutes(
|
||||
|
||||
if (isDynamicRoute(pageName)) {
|
||||
dynamicPages.push(normalizePage(pageName));
|
||||
continue;
|
||||
}
|
||||
|
||||
routes.push({
|
||||
@@ -257,7 +258,10 @@ function getRoutes(
|
||||
...getDynamicRoutes(entryPath, entryDirectory, dynamicPages).map(
|
||||
(route: { src: string; dest: string }) => {
|
||||
// convert to make entire RegExp match as one group
|
||||
route.src = route.src.replace('^', '^(').replace('$', ')$');
|
||||
route.src = route.src
|
||||
.replace('^', `^${prefix}(`)
|
||||
.replace('(\\/', '(')
|
||||
.replace('$', ')$');
|
||||
route.dest = `${url}/$1`;
|
||||
return route;
|
||||
}
|
||||
@@ -289,7 +293,8 @@ function getRoutes(
|
||||
export function getDynamicRoutes(
|
||||
entryPath: string,
|
||||
entryDirectory: string,
|
||||
dynamicPages: string[]
|
||||
dynamicPages: string[],
|
||||
isDev?: boolean
|
||||
): { src: string; dest: string }[] {
|
||||
if (!dynamicPages.length) {
|
||||
return [];
|
||||
@@ -324,9 +329,14 @@ export function getDynamicRoutes(
|
||||
|
||||
const routes: { src: string; dest: string }[] = [];
|
||||
pageMatchers.forEach(pageMatcher => {
|
||||
// in `now dev` we don't need to prefix the destination
|
||||
const dest = !isDev
|
||||
? path.join('/', entryDirectory, pageMatcher.pageName)
|
||||
: pageMatcher.pageName;
|
||||
|
||||
routes.push({
|
||||
src: pageMatcher.matcher.source,
|
||||
dest: path.join('/', entryDirectory, pageMatcher.pageName),
|
||||
dest,
|
||||
});
|
||||
});
|
||||
return routes;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/* global it, expect */
|
||||
const path = require('path');
|
||||
const fs = require('fs-extra');
|
||||
const runBuildLambda = require('../../../../test/lib/run-build-lambda');
|
||||
|
||||
const FOUR_MINUTES = 240000;
|
||||
@@ -111,3 +112,119 @@ it(
|
||||
},
|
||||
FOUR_MINUTES,
|
||||
);
|
||||
|
||||
it(
|
||||
'Should build the serverless-config example',
|
||||
async () => {
|
||||
const {
|
||||
workPath,
|
||||
buildResult: { output },
|
||||
} = await runBuildLambda(path.join(__dirname, 'serverless-config'));
|
||||
|
||||
expect(output.index).toBeDefined();
|
||||
expect(output.goodbye).toBeDefined();
|
||||
const filePaths = Object.keys(output);
|
||||
const serverlessError = filePaths.some(filePath => filePath.match(/_error/));
|
||||
const hasUnderScoreAppStaticFile = filePaths.some(filePath => filePath.match(/static.*\/pages\/_app\.js$/));
|
||||
const hasUnderScoreErrorStaticFile = filePaths.some(filePath => filePath.match(/static.*\/pages\/_error\.js$/));
|
||||
expect(hasUnderScoreAppStaticFile).toBeTruthy();
|
||||
expect(hasUnderScoreErrorStaticFile).toBeTruthy();
|
||||
expect(serverlessError).toBeTruthy();
|
||||
|
||||
const contents = await fs.readdir(workPath);
|
||||
|
||||
expect(contents.some(name => name === 'next.config.js')).toBeTruthy();
|
||||
expect(
|
||||
contents.some(name => name.includes('next.config.original.')),
|
||||
).toBeTruthy();
|
||||
},
|
||||
FOUR_MINUTES,
|
||||
);
|
||||
|
||||
it(
|
||||
'Should not build the serverless-config-async example',
|
||||
async () => {
|
||||
let error = null;
|
||||
|
||||
try {
|
||||
await runBuildLambda(path.join(__dirname, 'serverless-config-async'));
|
||||
} catch (err) {
|
||||
error = err;
|
||||
}
|
||||
|
||||
expect(error).not.toBe(null);
|
||||
},
|
||||
FOUR_MINUTES,
|
||||
);
|
||||
|
||||
it(
|
||||
'Should not build the serverless-config-promise example',
|
||||
async () => {
|
||||
let error = null;
|
||||
|
||||
try {
|
||||
await runBuildLambda(path.join(__dirname, 'serverless-config-promise'));
|
||||
} catch (err) {
|
||||
error = err;
|
||||
}
|
||||
|
||||
expect(error).not.toBe(null);
|
||||
},
|
||||
FOUR_MINUTES,
|
||||
);
|
||||
|
||||
it(
|
||||
'Should build the serverless-config-object example',
|
||||
async () => {
|
||||
const {
|
||||
workPath,
|
||||
buildResult: { output },
|
||||
} = await runBuildLambda(path.join(__dirname, 'serverless-config-object'));
|
||||
|
||||
expect(output['index.html']).toBeDefined();
|
||||
expect(output.goodbye).toBeDefined();
|
||||
const filePaths = Object.keys(output);
|
||||
const serverlessError = filePaths.some(filePath => filePath.match(/_error/));
|
||||
const hasUnderScoreAppStaticFile = filePaths.some(filePath => filePath.match(/static.*\/pages\/_app\.js$/));
|
||||
const hasUnderScoreErrorStaticFile = filePaths.some(filePath => filePath.match(/static.*\/pages\/_error\.js$/));
|
||||
expect(hasUnderScoreAppStaticFile).toBeTruthy();
|
||||
expect(hasUnderScoreErrorStaticFile).toBeTruthy();
|
||||
expect(serverlessError).toBeTruthy();
|
||||
|
||||
const contents = await fs.readdir(workPath);
|
||||
|
||||
expect(contents.some(name => name === 'next.config.js')).toBeTruthy();
|
||||
expect(
|
||||
contents.some(name => name.includes('next.config.original.')),
|
||||
).toBeTruthy();
|
||||
},
|
||||
FOUR_MINUTES,
|
||||
);
|
||||
|
||||
it(
|
||||
'Should build the serverless-no-config example',
|
||||
async () => {
|
||||
const {
|
||||
workPath,
|
||||
buildResult: { output },
|
||||
} = await runBuildLambda(path.join(__dirname, 'serverless-no-config'));
|
||||
|
||||
expect(output['index.html']).toBeDefined();
|
||||
expect(output.goodbye).toBeDefined();
|
||||
const filePaths = Object.keys(output);
|
||||
const serverlessError = filePaths.some(filePath => filePath.match(/_error/));
|
||||
const hasUnderScoreAppStaticFile = filePaths.some(filePath => filePath.match(/static.*\/pages\/_app\.js$/));
|
||||
const hasUnderScoreErrorStaticFile = filePaths.some(filePath => filePath.match(/static.*\/pages\/_error\.js$/));
|
||||
expect(hasUnderScoreAppStaticFile).toBeTruthy();
|
||||
expect(hasUnderScoreErrorStaticFile).toBeTruthy();
|
||||
expect(serverlessError).toBeTruthy();
|
||||
|
||||
const contents = await fs.readdir(workPath);
|
||||
|
||||
expect(contents.some(name => name === 'next.config.js')).toBeTruthy();
|
||||
expect(
|
||||
contents.some(name => name.includes('next.config.original.')),
|
||||
).toBeFalsy();
|
||||
},
|
||||
FOUR_MINUTES,
|
||||
);
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
module.exports = async function () {
|
||||
return {};
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"version": 2,
|
||||
"builds": [{ "src": "package.json", "use": "@now/next" }]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"next": "latest",
|
||||
"react": "latest",
|
||||
"react-dom": "latest"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
const F = () => 'Goodbye World!';
|
||||
F.getInitialProps = async () => ({});
|
||||
export default F;
|
||||
@@ -0,0 +1 @@
|
||||
export default () => 'Hello World!';
|
||||
@@ -0,0 +1 @@
|
||||
module.exports = {};
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"version": 2,
|
||||
"builds": [{ "src": "package.json", "use": "@now/next" }]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"next": "latest",
|
||||
"react": "latest",
|
||||
"react-dom": "latest"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
const F = () => 'Goodbye World!';
|
||||
F.getInitialProps = async () => ({});
|
||||
export default F;
|
||||
@@ -0,0 +1 @@
|
||||
export default () => 'Hello World!';
|
||||
@@ -0,0 +1 @@
|
||||
module.exports = new Promise(res => res({}));
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"version": 2,
|
||||
"builds": [{ "src": "package.json", "use": "@now/next" }]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"next": "latest",
|
||||
"react": "latest",
|
||||
"react-dom": "latest"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
const F = () => 'Goodbye World!';
|
||||
F.getInitialProps = async () => ({});
|
||||
export default F;
|
||||
@@ -0,0 +1 @@
|
||||
export default () => 'Hello World!';
|
||||
@@ -0,0 +1 @@
|
||||
module.exports = () => ({});
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"version": 2,
|
||||
"builds": [{ "src": "package.json", "use": "@now/next" }]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"next": "8.1.0",
|
||||
"react": "latest",
|
||||
"react-dom": "latest"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
const F = () => 'Goodbye World!';
|
||||
F.getInitialProps = async () => ({});
|
||||
export default F;
|
||||
@@ -0,0 +1 @@
|
||||
export default () => 'Hello World!';
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"version": 2,
|
||||
"builds": [{ "src": "package.json", "use": "@now/next", "config": { "zeroConfig": true } }]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"next": "latest",
|
||||
"react": "latest",
|
||||
"react-dom": "latest"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
const F = () => 'Goodbye World!';
|
||||
F.getInitialProps = async () => ({});
|
||||
export default F;
|
||||
@@ -0,0 +1 @@
|
||||
export default () => 'Hello World!';
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@now/node-bridge",
|
||||
"version": "1.2.2",
|
||||
"version": "1.2.3",
|
||||
"license": "MIT",
|
||||
"main": "./index.js",
|
||||
"repository": {
|
||||
@@ -19,8 +19,6 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/aws-lambda": "8.10.19",
|
||||
"@types/node": "11.9.4",
|
||||
"jest": "24.1.0",
|
||||
"typescript": "3.5.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ interface ServerLike {
|
||||
* error here and force the process to exit so that the lambda invocation
|
||||
* returns an Unhandled error quickly.
|
||||
*/
|
||||
process.on('unhandledRejection', (err: Error) => {
|
||||
process.on('unhandledRejection', err => {
|
||||
console.error('Unhandled rejection:', err);
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
/test
|
||||
@@ -1,178 +0,0 @@
|
||||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
const {
|
||||
FileBlob,
|
||||
FileFsRef,
|
||||
download,
|
||||
createLambda,
|
||||
glob,
|
||||
runNpmInstall,
|
||||
runPackageJsonScript,
|
||||
getNodeVersion,
|
||||
getSpawnOptions,
|
||||
shouldServe,
|
||||
} = require('@now/build-utils'); // eslint-disable-line import/no-extraneous-dependencies
|
||||
|
||||
/** @typedef { import('@now/build-utils/file-ref') } FileRef */
|
||||
/** @typedef {{[filePath: string]: FileRef}} Files */
|
||||
|
||||
/**
|
||||
* @typedef {Object} BuildParamsType
|
||||
* @property {Files} files - Files object
|
||||
* @property {string} entrypoint - Entrypoint specified for the builder
|
||||
* @property {Object} config - User-passed config from now.json
|
||||
* @property {string} workPath - Working directory for this build
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {BuildParamsType} buildParams
|
||||
* @param {Object} [options]
|
||||
* @param {string[]} [options.npmArguments]
|
||||
*/
|
||||
async function downloadInstallAndBundle(
|
||||
{
|
||||
files, entrypoint, workPath, meta,
|
||||
},
|
||||
{ npmArguments = [] } = {},
|
||||
) {
|
||||
console.log('downloading user files...');
|
||||
const downloadedFiles = await download(files, workPath, meta);
|
||||
|
||||
console.log("installing dependencies for user's code...");
|
||||
const entrypointFsDirname = path.join(workPath, path.dirname(entrypoint));
|
||||
const nodeVersion = await getNodeVersion(entrypointFsDirname);
|
||||
const spawnOpts = getSpawnOptions(meta, nodeVersion);
|
||||
await runNpmInstall(entrypointFsDirname, npmArguments, spawnOpts);
|
||||
return {
|
||||
downloadedFiles,
|
||||
entrypointFsDirname,
|
||||
spawnOpts,
|
||||
nodeVersion,
|
||||
};
|
||||
}
|
||||
|
||||
async function compile(workPath, downloadedFiles, entrypoint, config) {
|
||||
const input = downloadedFiles[entrypoint].fsPath;
|
||||
const inputDir = path.dirname(input);
|
||||
const ncc = require('@zeit/ncc');
|
||||
const { code, map, assets } = await ncc(input, {
|
||||
sourceMap: true,
|
||||
sourceMapRegister: true,
|
||||
});
|
||||
|
||||
if (config && config.includeFiles) {
|
||||
const includeFiles = typeof config.includeFiles === 'string'
|
||||
? [config.includeFiles]
|
||||
: config.includeFiles;
|
||||
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const pattern of includeFiles) {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
const files = await glob(pattern, inputDir);
|
||||
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const assetName of Object.keys(files)) {
|
||||
const stream = files[assetName].toStream();
|
||||
const { mode } = files[assetName];
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
const { data } = await FileBlob.fromStream({ stream });
|
||||
|
||||
assets[assetName] = {
|
||||
source: data,
|
||||
permissions: mode,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const preparedFiles = {};
|
||||
// move all user code to 'user' subdirectory
|
||||
preparedFiles[entrypoint] = new FileBlob({ data: code });
|
||||
preparedFiles[`${entrypoint.replace('.ts', '.js')}.map`] = new FileBlob({
|
||||
data: map,
|
||||
});
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const assetName of Object.keys(assets)) {
|
||||
const { source: data, permissions: mode } = assets[assetName];
|
||||
const blob2 = new FileBlob({ data, mode });
|
||||
preparedFiles[path.join(path.dirname(entrypoint), assetName)] = blob2;
|
||||
}
|
||||
|
||||
return preparedFiles;
|
||||
}
|
||||
|
||||
exports.config = {
|
||||
maxLambdaSize: '15mb',
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {BuildParamsType} buildParams
|
||||
* @returns {Promise<Files>}
|
||||
*/
|
||||
exports.build = async ({
|
||||
files, entrypoint, config, workPath, meta = {},
|
||||
}) => {
|
||||
const {
|
||||
downloadedFiles,
|
||||
entrypointFsDirname,
|
||||
spawnOptions,
|
||||
nodeVersion,
|
||||
} = await downloadInstallAndBundle(
|
||||
{
|
||||
files,
|
||||
entrypoint,
|
||||
workPath,
|
||||
meta,
|
||||
},
|
||||
{ npmArguments: ['--prefer-offline'] },
|
||||
);
|
||||
|
||||
console.log('running user script...');
|
||||
await runPackageJsonScript(entrypointFsDirname, 'now-build', spawnOptions);
|
||||
|
||||
console.log('preparing lambda files...');
|
||||
let preparedFiles;
|
||||
|
||||
if (config && config.bundle === false) {
|
||||
preparedFiles = await glob('**', workPath);
|
||||
} else {
|
||||
console.log('compiling entrypoint with ncc...');
|
||||
preparedFiles = await compile(
|
||||
workPath,
|
||||
downloadedFiles,
|
||||
entrypoint,
|
||||
config,
|
||||
);
|
||||
}
|
||||
|
||||
const launcherPath = path.join(__dirname, 'launcher.js');
|
||||
let launcherData = await fs.readFile(launcherPath, 'utf8');
|
||||
launcherData = launcherData.replace(
|
||||
'// PLACEHOLDER',
|
||||
[`require("./${entrypoint}");`].join(' '),
|
||||
);
|
||||
|
||||
const launcherFiles = {
|
||||
'launcher.js': new FileBlob({ data: launcherData }),
|
||||
'bridge.js': new FileFsRef({ fsPath: require('@now/node-bridge') }),
|
||||
};
|
||||
|
||||
// Use the system-installed version of `node` when running via `now dev`
|
||||
const runtime = meta.isDev ? 'nodejs' : nodeVersion.runtime;
|
||||
|
||||
const lambda = await createLambda({
|
||||
files: { ...preparedFiles, ...launcherFiles },
|
||||
handler: 'launcher.launcher',
|
||||
runtime,
|
||||
});
|
||||
|
||||
return { [entrypoint]: lambda };
|
||||
};
|
||||
|
||||
exports.prepareCache = async ({ workPath }) => ({
|
||||
...(await glob('node_modules/**', workPath)),
|
||||
...(await glob('package-lock.json', workPath)),
|
||||
...(await glob('yarn.lock', workPath)),
|
||||
});
|
||||
|
||||
exports.shouldServe = shouldServe;
|
||||
@@ -1,32 +0,0 @@
|
||||
const { Server } = require('http');
|
||||
const { Bridge } = require('./bridge.js');
|
||||
|
||||
const bridge = new Bridge();
|
||||
|
||||
const saveListen = Server.prototype.listen;
|
||||
Server.prototype.listen = function listen() {
|
||||
bridge.setServer(this);
|
||||
Server.prototype.listen = saveListen;
|
||||
return bridge.listen();
|
||||
};
|
||||
|
||||
if (!process.env.NODE_ENV) {
|
||||
process.env.NODE_ENV = process.env.NOW_REGION === 'dev1' ? 'development' : 'production';
|
||||
}
|
||||
|
||||
try {
|
||||
// PLACEHOLDER
|
||||
} catch (err) {
|
||||
if (err.code === 'MODULE_NOT_FOUND') {
|
||||
console.error(err.message);
|
||||
console.error(
|
||||
'Did you forget to add it to "dependencies" in `package.json`?',
|
||||
);
|
||||
process.exit(1);
|
||||
} else {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
exports.launcher = bridge.launcher;
|
||||
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"name": "@now/node-server",
|
||||
"version": "0.8.2",
|
||||
"license": "MIT",
|
||||
"homepage": "https://zeit.co/docs/v2/deployments/official-builders/node-js-server-now-node-server",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zeit/now-builders.git",
|
||||
"directory": "packages/now-node-server"
|
||||
},
|
||||
"dependencies": {
|
||||
"@now/node-bridge": "1.2.2",
|
||||
"@zeit/ncc": "0.18.5",
|
||||
"fs-extra": "7.0.1"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jest"
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
const cowsay = require('cowsay').say;
|
||||
const http = require('http');
|
||||
|
||||
// test that process.env is not replaced by webpack
|
||||
process.env.NODE_ENV = 'development';
|
||||
|
||||
const server = http.createServer((req, resp) => {
|
||||
resp.end(cowsay({ text: 'cow:RANDOMNESS_PLACEHOLDER' }));
|
||||
});
|
||||
|
||||
server.listen();
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"version": 2,
|
||||
"builds": [
|
||||
{ "src": "index.js", "use": "@now/node-server" },
|
||||
{ "src": "subdirectory/index.js", "use": "@now/node-server" }
|
||||
],
|
||||
"probes": [
|
||||
{ "path": "/", "mustContain": "cow:RANDOMNESS_PLACEHOLDER" },
|
||||
{ "path": "/subdirectory/", "mustContain": "yoda:RANDOMNESS_PLACEHOLDER" }
|
||||
]
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
const yodasay = require('yodasay').say;
|
||||
const http = require('http');
|
||||
|
||||
// test that process.env is not replaced by webpack
|
||||
process.env.NODE_ENV = 'development';
|
||||
|
||||
const server = http.createServer((req, resp) => {
|
||||
resp.end(yodasay({ text: 'yoda:RANDOMNESS_PLACEHOLDER' }));
|
||||
});
|
||||
|
||||
server.listen();
|
||||
@@ -1,10 +0,0 @@
|
||||
const assert = require('assert');
|
||||
const http = require('http');
|
||||
|
||||
const server = http.createServer((req, resp) => {
|
||||
assert(!process.env.RANDOMNESS_BUILD_ENV_VAR);
|
||||
assert(process.env.RANDOMNESS_ENV_VAR);
|
||||
resp.end('BUILD_TIME_PLACEHOLDER:build-env');
|
||||
});
|
||||
|
||||
server.listen();
|
||||
@@ -1,12 +0,0 @@
|
||||
const assert = require('assert');
|
||||
const fs = require('fs');
|
||||
|
||||
assert(process.env.RANDOMNESS_BUILD_ENV_VAR);
|
||||
assert(!process.env.RANDOMNESS_ENV_VAR);
|
||||
|
||||
fs.writeFileSync(
|
||||
'index.js',
|
||||
fs
|
||||
.readFileSync('index.js', 'utf8')
|
||||
.replace('BUILD_TIME_PLACEHOLDER', process.env.RANDOMNESS_BUILD_ENV_VAR),
|
||||
);
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"scripts": {
|
||||
"now-build": "node now-build.js"
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
const assert = require('assert');
|
||||
const http = require('http');
|
||||
|
||||
const server = http.createServer((req, resp) => {
|
||||
assert(!process.env.RANDOMNESS_BUILD_ENV_VAR);
|
||||
assert(process.env.RANDOMNESS_ENV_VAR);
|
||||
resp.end(`${process.env.RANDOMNESS_ENV_VAR}:env`);
|
||||
});
|
||||
|
||||
server.listen();
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"version": 2,
|
||||
"builds": [
|
||||
{ "src": "build-env/index.js", "use": "@now/node-server" },
|
||||
{ "src": "env/index.js", "use": "@now/node-server" }
|
||||
],
|
||||
"probes": [
|
||||
{ "path": "/build-env", "mustContain": "RANDOMNESS_PLACEHOLDER:build-env" },
|
||||
{ "path": "/env", "mustContain": "RANDOMNESS_PLACEHOLDER:env" }
|
||||
]
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
const http = require('http');
|
||||
|
||||
const server = http.createServer((req, resp) => {
|
||||
resp.end('RANDOMNESS_PLACEHOLDER');
|
||||
});
|
||||
|
||||
server.listen();
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"version": 2,
|
||||
"builds": [{ "src": "index.js", "use": "@now/node-server" }]
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
const assert = require('assert');
|
||||
|
||||
module.exports = async ({ deploymentUrl, fetch, randomness }) => {
|
||||
const resp = await fetch(`https://${deploymentUrl}/`);
|
||||
assert.equal(resp.headers.get('content-type'), null);
|
||||
assert.equal(await resp.text(), randomness);
|
||||
};
|
||||
@@ -1,15 +0,0 @@
|
||||
const fs = require('fs');
|
||||
const http = require('http');
|
||||
const path = require('path');
|
||||
|
||||
const server = http.createServer((req, resp) => {
|
||||
const asset1 = fs.readFileSync(
|
||||
path.join(__dirname, 'subdirectory1/asset.txt'),
|
||||
);
|
||||
const asset2 = fs.readFileSync(
|
||||
path.join(__dirname, 'subdirectory2/asset.txt'),
|
||||
);
|
||||
resp.end(`${asset1},${asset2}`);
|
||||
});
|
||||
|
||||
server.listen();
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"version": 2,
|
||||
"builds": [{ "src": "index.js", "use": "@now/node-server" }],
|
||||
"probes": [
|
||||
{
|
||||
"path": "/",
|
||||
"mustContain": "asset1:RANDOMNESS_PLACEHOLDER,asset2:RANDOMNESS_PLACEHOLDER"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
asset1:RANDOMNESS_PLACEHOLDER
|
||||
@@ -1 +0,0 @@
|
||||
asset2:RANDOMNESS_PLACEHOLDER
|
||||
@@ -1,21 +0,0 @@
|
||||
{
|
||||
"version": 2,
|
||||
"builds": [
|
||||
{ "src": "with-bundle/index.js", "use": "@now/node-server" },
|
||||
{
|
||||
"src": "without-bundle/index.js",
|
||||
"use": "@now/node-server",
|
||||
"config": { "bundle": false }
|
||||
}
|
||||
],
|
||||
"probes": [
|
||||
{
|
||||
"path": "/with-bundle",
|
||||
"mustContain": "RANDOMNESS_PLACEHOLDER:with-bundle"
|
||||
},
|
||||
{
|
||||
"path": "/without-bundle",
|
||||
"mustContain": "RANDOMNESS_PLACEHOLDER:without-bundle"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
const http = require('http');
|
||||
const isBundled = require('./is-bundled.js');
|
||||
|
||||
const server = http.createServer((req, resp) => {
|
||||
resp.end(
|
||||
isBundled()
|
||||
? 'RANDOMNESS_PLACEHOLDER:with-bundle'
|
||||
: 'WITHOUT-BUNDLE-THAT-IS-WRONG',
|
||||
);
|
||||
});
|
||||
|
||||
server.listen();
|
||||
@@ -1,4 +0,0 @@
|
||||
const path = require('path');
|
||||
|
||||
// eslint-disable-next-line no-eval
|
||||
module.exports = () => path.basename(eval('__filename')) === 'index.js';
|
||||
@@ -1,12 +0,0 @@
|
||||
const http = require('http');
|
||||
const isBundled = require('./is-bundled.js');
|
||||
|
||||
const server = http.createServer((req, resp) => {
|
||||
resp.end(
|
||||
isBundled()
|
||||
? 'WITH-BUNDLE-THAT-IS-WRONG'
|
||||
: 'RANDOMNESS_PLACEHOLDER:without-bundle',
|
||||
);
|
||||
});
|
||||
|
||||
server.listen();
|
||||
@@ -1,4 +0,0 @@
|
||||
const path = require('path');
|
||||
|
||||
// eslint-disable-next-line no-eval
|
||||
module.exports = () => path.basename(eval('__filename')) === 'index.js';
|
||||
@@ -1,24 +0,0 @@
|
||||
const express = require('express');
|
||||
const { ApolloServer, gql } = require('apollo-server-express');
|
||||
|
||||
const typeDefs = gql`
|
||||
type Query {
|
||||
hello: String
|
||||
}
|
||||
`;
|
||||
|
||||
const resolvers = {
|
||||
Query: {
|
||||
hello: () => 'apollo:RANDOMNESS_PLACEHOLDER',
|
||||
},
|
||||
};
|
||||
|
||||
const server = new ApolloServer({ typeDefs, resolvers, introspection: true });
|
||||
|
||||
const app = express();
|
||||
server.applyMiddleware({ app });
|
||||
app.get('/', (req, resp) => {
|
||||
resp.redirect('/graphql');
|
||||
});
|
||||
|
||||
app.listen({ port: 4000 });
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"apollo-server-express": "^2.2.2",
|
||||
"express": "^4.16.4",
|
||||
"graphql": "^14.0.2"
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
{
|
||||
"version": 2,
|
||||
"builds": [{ "src": "apollo/index.js", "use": "@now/node-server" }],
|
||||
"routes": [{ "src": "/.*", "dest": "apollo/index.js" }],
|
||||
"probes": [
|
||||
{
|
||||
"path": "/graphql",
|
||||
"method": "POST",
|
||||
"body": { "query": "{hello}" },
|
||||
"mustContain": "apollo:RANDOMNESS_PLACEHOLDER"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
const express = require('express');
|
||||
|
||||
const app = express();
|
||||
|
||||
app.listen();
|
||||
@@ -1,6 +0,0 @@
|
||||
const express = require('express');
|
||||
|
||||
const app = express();
|
||||
app.use(express.static('templates'));
|
||||
|
||||
app.listen();
|
||||
@@ -1,25 +0,0 @@
|
||||
{
|
||||
"version": 2,
|
||||
"builds": [
|
||||
{
|
||||
"src": "index.js",
|
||||
"use": "@now/node-server",
|
||||
"config": {
|
||||
"includeFiles": ["templates/**"]
|
||||
}
|
||||
},
|
||||
{
|
||||
"src": "accepts-string/index.js",
|
||||
"use": "@now/node-server",
|
||||
"config": {
|
||||
"includeFiles": "templates/**"
|
||||
}
|
||||
}
|
||||
],
|
||||
"probes": [
|
||||
{
|
||||
"path": "/",
|
||||
"mustContain": "Hello Now!"
|
||||
}
|
||||
]
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user