From 7c76a568a05a24636878617a65059f1d5fb35052 Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Mon, 5 Nov 2018 11:26:15 +1100 Subject: [PATCH] Omit sources from source maps in bundle. --- package.json | 2 +- rollup.config.js | 23 ++++++++++++------- tests/error_004_missing_module.ts.out | 4 ++-- tests/error_005_missing_dynamic_import.ts.out | 4 ++-- tests/error_006_import_ext_failure.ts.out | 4 ++-- third_party | 2 +- 6 files changed, 23 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 56b32ceca2e43a..6f2fafb3a90ea0 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "flatbuffers": "^1.9.0", "magic-string": "^0.22.5", "prettier": "^1.14.0", - "rollup": "^0.63.2", + "rollup": "0.67.0", "rollup-plugin-alias": "^1.4.0", "rollup-plugin-analyzer": "^2.1.0", "rollup-plugin-commonjs": "^9.1.3", diff --git a/rollup.config.js b/rollup.config.js index a648c647048316..1996d2b3e5d2bd 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,5 +1,5 @@ // Copyright 2018 the Deno authors. All rights reserved. MIT license. -import assert from "assert"; +// @ts-check import * as fs from "fs"; import path from "path"; import alias from "rollup-plugin-alias"; @@ -30,10 +30,14 @@ const tsconfigOverride = { } }; -// this is a rollup plugin which will look for imports ending with `!string` and resolve -// them with a module that will inline the contents of the file as a string. Needed to -// support `js/assets.ts`. -function strings({ include, exclude } = {}) { +/** this is a rollup plugin which will look for imports ending with `!string` and resolve + * them with a module that will inline the contents of the file as a string. Needed to + * support `js/assets.ts`. + * @param {any} param0 + */ +function strings( + { include, exclude } = { include: undefined, exclude: undefined } +) { if (!include) { throw new Error("include option must be passed"); } @@ -85,7 +89,9 @@ const osNodeToDeno = { linux: "linux" }; -// Inject deno.platform.arch and deno.platform.os +/** Inject deno.platform.arch and deno.platform.os + * @param {any} param0 + */ function platform({ include, exclude } = {}) { if (!include) { throw new Error("include option must be passed"); @@ -132,7 +138,7 @@ function resolveGenerated() { } function generateDepFile({ outputFile, sourceFiles = [], configFiles = [] }) { - let timestamp = Date.now(); + let timestamp = new Date(); // Save the depfile just before the node process exits. process.once("beforeExit", () => @@ -209,7 +215,8 @@ export default function makeConfig(commandOptions) { output: { format: "iife", name: "denoMain", - sourcemap: true + sourcemap: true, + sourcemapExcludeSources: true }, plugins: [ diff --git a/tests/error_004_missing_module.ts.out b/tests/error_004_missing_module.ts.out index 64932ddd0138a7..22207250dc5808 100644 --- a/tests/error_004_missing_module.ts.out +++ b/tests/error_004_missing_module.ts.out @@ -7,5 +7,5 @@ NotFound: Cannot resolve module "bad-module.ts" from "[WILDCARD]/tests/error_004 at moduleNames.map.name ([WILDCARD]/js/compiler.ts:[WILDCARD]) at Array.map () at DenoCompiler.resolveModuleNames ([WILDCARD]/js/compiler.ts:[WILDCARD]) - at Object.compilerHost.resolveModuleNames ([WILDCARD]/third_party/node_modules/typescript/lib/typescript.js:[WILDCARD]) - at resolveModuleNamesWorker ([WILDCARD]/third_party/node_modules/typescript/lib/typescript.js:[WILDCARD]) + at Object.compilerHost.resolveModuleNames () + at resolveModuleNamesWorker () diff --git a/tests/error_005_missing_dynamic_import.ts.out b/tests/error_005_missing_dynamic_import.ts.out index eb991de9db31a3..a0f17cf8124779 100644 --- a/tests/error_005_missing_dynamic_import.ts.out +++ b/tests/error_005_missing_dynamic_import.ts.out @@ -7,5 +7,5 @@ NotFound: Cannot resolve module "bad-module.ts" from "[WILDCARD]/tests/error_005 at moduleNames.map.name ([WILDCARD]/js/compiler.ts:[WILDCARD]) at Array.map () at DenoCompiler.resolveModuleNames ([WILDCARD]/js/compiler.ts:[WILDCARD]) - at Object.compilerHost.resolveModuleNames ([WILDCARD]/third_party/node_modules/typescript/lib/typescript.js:[WILDCARD]) - at resolveModuleNamesWorker ([WILDCARD]/third_party/node_modules/typescript/lib/typescript.js:[WILDCARD]) + at Object.compilerHost.resolveModuleNames () + at resolveModuleNamesWorker () diff --git a/tests/error_006_import_ext_failure.ts.out b/tests/error_006_import_ext_failure.ts.out index f2b6aa599116ca..f5f76af0f51f50 100644 --- a/tests/error_006_import_ext_failure.ts.out +++ b/tests/error_006_import_ext_failure.ts.out @@ -7,5 +7,5 @@ NotFound: Cannot resolve module "./non-existent" from "[WILDCARD]/tests/error_00 at moduleNames.map.name ([WILDCARD]/js/compiler.ts:[WILDCARD]) at Array.map () at DenoCompiler.resolveModuleNames ([WILDCARD]/js/compiler.ts:[WILDCARD]) - at Object.compilerHost.resolveModuleNames ([WILDCARD]/third_party/node_modules/typescript/lib/typescript.js:[WILDCARD]) - at resolveModuleNamesWorker ([WILDCARD]/third_party/node_modules/typescript/lib/typescript.js:[WILDCARD]) + at Object.compilerHost.resolveModuleNames () + at resolveModuleNamesWorker () diff --git a/third_party b/third_party index d1447e6375ebdd..d2dc0456c23c77 160000 --- a/third_party +++ b/third_party @@ -1 +1 @@ -Subproject commit d1447e6375ebddf590f1cd87219dadeca51cfec1 +Subproject commit d2dc0456c23c771781d77c40f8e2c21ba9f5abe7