Compare commits

...

3 Commits

Author SHA1 Message Date
Steven
703b2649bc Publish Stable
- @vercel/build-utils@2.10.1
 - @vercel/cgi@1.0.7
 - vercel@21.3.3
 - @vercel/client@9.0.8
 - @vercel/frameworks@0.3.1
 - @vercel/go@1.2.2
 - @vercel/node-bridge@1.3.3
 - @vercel/node@1.9.1
 - @vercel/python@2.0.1
 - @vercel/routing-utils@1.10.1
 - @vercel/ruby@1.2.6
2021-03-08 16:08:16 -05:00
Steven
2497909d9b Publish Canary
- vercel@21.3.3-canary.3
 - @vercel/node@1.9.1-canary.4
2021-03-08 13:40:30 -05:00
Steven
0ad45c8b13 [node] Fix tsCompile uninitialized error (#4275)
This PR fixes an error that happens when `includeFiles` has `.ts` files:

```
ReferenceError: Cannot access 'tsCompile' before initialization
```

~~However its not clear what the expected behavior is. Should the `.ts` files be compiled to `.js` or should they be considered assets and included as-is?~~

We will assume that `includeFiles` is only for assets and thus `.ts` files should not be compiled, they're included as-is.

[ch20529]
2021-03-08 18:11:51 +00:00
15 changed files with 42 additions and 34 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/build-utils",
"version": "2.10.1-canary.0",
"version": "2.10.1",
"license": "MIT",
"main": "./dist/index.js",
"types": "./dist/index.d.js",
@@ -29,7 +29,7 @@
"@types/node-fetch": "^2.1.6",
"@types/semver": "6.0.0",
"@types/yazl": "^2.4.1",
"@vercel/frameworks": "0.3.1-canary.0",
"@vercel/frameworks": "0.3.1",
"@vercel/ncc": "0.24.0",
"aggregate-error": "3.0.1",
"async-retry": "1.2.3",

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/cgi",
"version": "1.0.7-canary.1",
"version": "1.0.7",
"license": "MIT",
"repository": {
"type": "git",

View File

@@ -1,6 +1,6 @@
{
"name": "vercel",
"version": "21.3.3-canary.2",
"version": "21.3.3",
"preferGlobal": true,
"license": "Apache-2.0",
"description": "The command-line interface for Vercel",
@@ -61,11 +61,11 @@
"node": ">= 10"
},
"dependencies": {
"@vercel/build-utils": "2.10.1-canary.0",
"@vercel/go": "1.2.2-canary.0",
"@vercel/node": "1.9.1-canary.3",
"@vercel/python": "2.0.1-canary.0",
"@vercel/ruby": "1.2.6-canary.1",
"@vercel/build-utils": "2.10.1",
"@vercel/go": "1.2.2",
"@vercel/node": "1.9.1",
"@vercel/python": "2.0.1",
"@vercel/ruby": "1.2.6",
"update-notifier": "4.1.0"
},
"devDependencies": {
@@ -100,7 +100,7 @@
"@types/universal-analytics": "0.4.2",
"@types/which": "1.3.2",
"@types/write-json-file": "2.2.1",
"@vercel/frameworks": "0.3.1-canary.0",
"@vercel/frameworks": "0.3.1",
"@vercel/ncc": "0.24.0",
"@zeit/fun": "0.11.2",
"@zeit/source-map-support": "0.6.2",

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/client",
"version": "9.0.8-canary.0",
"version": "9.0.8",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"homepage": "https://vercel.com",
@@ -37,7 +37,7 @@
]
},
"dependencies": {
"@vercel/build-utils": "2.10.1-canary.0",
"@vercel/build-utils": "2.10.1",
"@zeit/fetch": "5.2.0",
"async-retry": "1.2.3",
"async-sema": "3.0.0",

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/frameworks",
"version": "0.3.1-canary.0",
"version": "0.3.1",
"main": "./dist/frameworks.js",
"types": "./dist/frameworks.d.ts",
"files": [
@@ -20,7 +20,7 @@
"@types/js-yaml": "3.12.1",
"@types/node": "12.0.4",
"@types/node-fetch": "2.5.8",
"@vercel/routing-utils": "1.10.1-canary.0",
"@vercel/routing-utils": "1.10.1",
"ajv": "6.12.2",
"jest": "24.9.0",
"ts-jest": "24.1.0",

View File

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

View File

@@ -1,6 +1,6 @@
{
"name": "@vercel/node-bridge",
"version": "1.3.3-canary.0",
"version": "1.3.3",
"license": "MIT",
"main": "./index.js",
"repository": {

View File

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

View File

@@ -129,7 +129,7 @@ async function compile(
watch: string[];
}> {
const inputFiles = new Set<string>([entrypointPath]);
const preparedFiles: Files = {};
const sourceCache = new Map<string, string | Buffer | null>();
const fsCache = new Map<string, File>();
const tsCompiled = new Set<string>();
@@ -149,17 +149,7 @@ async function compile(
const { fsPath } = entry;
const relPath = relative(baseDir, fsPath);
fsCache.set(relPath, entry);
const stream = entry.toStream();
const { data } = await FileBlob.fromStream({ stream });
if (relPath.endsWith('.ts') || relPath.endsWith('.tsx')) {
sourceCache.set(
relPath,
compileTypeScript(fsPath, data.toString())
);
} else {
sourceCache.set(relPath, data);
}
inputFiles.add(fsPath);
preparedFiles[relPath] = entry;
})
);
}
@@ -170,8 +160,6 @@ async function compile(
[...inputFiles].map(p => relative(workPath, p)).join(', ')
);
const preparedFiles: Files = {};
let tsCompile: Register;
function compileTypeScript(path: string, source: string): string {
const relPath = relative(baseDir, path);

View File

@@ -0,0 +1 @@
const foo = 'hello TS!';

View File

@@ -0,0 +1,8 @@
const { readFileSync } = require('fs');
const { join } = require('path');
module.exports = (req, res) => {
const file = join(__dirname, 'file.ts');
const content = readFileSync(file, 'utf8');
res.end(content);
};

View File

@@ -21,6 +21,13 @@
"config": {
"includeFiles": "templates/accepts-string.edge"
}
},
{
"src": "include-ts-file.js",
"use": "@vercel/node",
"config": {
"includeFiles": "file.ts"
}
}
],
"probes": [
@@ -35,6 +42,10 @@
{
"path": "/root.js",
"mustContain": "hello Root!"
},
{
"path": "/include-ts-file.js",
"mustContain": "hello TS!"
}
]
}

View File

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

View File

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

View File

@@ -1,7 +1,7 @@
{
"name": "@vercel/ruby",
"author": "Nathan Cahill <nathan@nathancahill.com>",
"version": "1.2.6-canary.1",
"version": "1.2.6",
"license": "MIT",
"main": "./dist/index",
"homepage": "https://vercel.com/docs/runtimes#official-runtimes/ruby",