Skip to content

Commit

Permalink
Exclude sources from bundle source map
Browse files Browse the repository at this point in the history
  • Loading branch information
kitsonk committed Oct 26, 2018
1 parent 376b851 commit 8b9473e
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 16 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"flatbuffers": "^1.9.0",
"magic-string": "^0.22.5",
"prettier": "^1.14.0",
"rollup": "^0.63.2",
"rollup": "A build of rollup that includes: https://github.com/rollup/rollup/pull/2531",
"rollup": "./third_party/rollup/rollup-0.66.6.patch.tgz",
"rollup-plugin-alias": "^1.4.0",
"rollup-plugin-analyzer": "^2.1.0",
"rollup-plugin-commonjs": "^9.1.3",
Expand Down
23 changes: 15 additions & 8 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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");
}
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -150,7 +156,7 @@ function generateDepFile({ outputFile, sourceFiles = [], configFiles = [] }) {
sourceFiles.push(sourceFile);
// Remember the time stamp that we last resolved a dependency.
// We'll set the last modified time of the depfile to that.
timestamp = new Date();
timestamp = Date.now();
}
};
}
Expand Down Expand Up @@ -209,7 +215,8 @@ export default function makeConfig(commandOptions) {
output: {
format: "iife",
name: "denoMain",
sourcemap: true
sourcemap: true,
sourcemapExcludeSources: true
},

plugins: [
Expand Down
4 changes: 2 additions & 2 deletions tests/error_004_missing_module.ts.out
Original file line number Diff line number Diff line change
Expand Up @@ -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 (<anonymous>)
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 (<anonymous>)
at resolveModuleNamesWorker (<anonymous>)
4 changes: 2 additions & 2 deletions tests/error_005_missing_dynamic_import.ts.out
Original file line number Diff line number Diff line change
Expand Up @@ -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 (<anonymous>)
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 (<anonymous>)
at resolveModuleNamesWorker (<anonymous>)
4 changes: 2 additions & 2 deletions tests/error_006_import_ext_failure.ts.out
Original file line number Diff line number Diff line change
Expand Up @@ -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 (<anonymous>)
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 (<anonymous>)
at resolveModuleNamesWorker (<anonymous>)

0 comments on commit 8b9473e

Please sign in to comment.