mirror of
https://github.com/ritz078/transform.git
synced 2026-11-21 00:32:56 +03:00
fixes
This commit is contained in:
1 parent
96923adae2
commit
0a04bed555
2 files changed
+1
-23
No files matched your search
+1
-5
@@ -73,11 +73,7 @@ const config = {
|
||||
|
||||
return config;
|
||||
},
|
||||
target: "serverless",
|
||||
|
||||
serverRuntimeConfig: {
|
||||
PROJECT_ROOT: __dirname
|
||||
}
|
||||
target: "serverless"
|
||||
};
|
||||
|
||||
module.exports = withBundleAnalyzer(withCSS(config));
|
||||
@@ -1,22 +1,6 @@
|
||||
import { NextApiRequest, NextApiResponse } from "next";
|
||||
import convert from "@khanacademy/flow-to-ts";
|
||||
import * as ts from "typescript";
|
||||
import * as fs from "fs";
|
||||
import * as path from "path";
|
||||
import getConfig from "next/config";
|
||||
const { serverRuntimeConfig } = getConfig();
|
||||
|
||||
const libSource = fs
|
||||
.readFileSync(
|
||||
path.join(
|
||||
serverRuntimeConfig.PROJECT_ROOT,
|
||||
"node_modules",
|
||||
"typescript",
|
||||
"lib",
|
||||
"lib.d.ts"
|
||||
)
|
||||
)
|
||||
.toString();
|
||||
|
||||
export default (req: NextApiRequest, res: NextApiResponse) => {
|
||||
try {
|
||||
@@ -47,8 +31,6 @@ export default (req: NextApiRequest, res: NextApiResponse) => {
|
||||
if (filename === "file.ts") {
|
||||
return ts.createSourceFile(filename, tsCode, undefined);
|
||||
}
|
||||
if (filename === "lib.d.ts")
|
||||
return ts.createSourceFile(filename, libSource, undefined);
|
||||
|
||||
return ts.createSourceFile(filename, "", undefined);
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user