This commit is contained in:
Martin Aeschlimann 2019-06-12 09:20:19 +02:00
Родитель 6536e68169
Коммит 2c1ef2a248
3 изменённых файлов: 35 добавлений и 2 удалений

Просмотреть файл

@ -0,0 +1,32 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
const fs = require('fs');
const path = require('path');
function deleteRefs(dir) {
const files = fs.readdirSync(dir);
for (let file of files) {
const filePath = path.join(dir, file);
const stat = fs.statSync(filePath);
if (stat.isDirectory()) {
deleteRefs(filePath);
} else if (path.extname(file) === '.js') {
const content = fs.readFileSync(filePath, 'utf8');
const newContent = content.replace(/\/\/\# sourceMappingURL=[^]+.js.map/, '')
if (content.length !== newContent.length) {
console.log('remove sourceMappingURL in ' + filePath);
fs.writeFileSync(filePath, newContent);
}
} else if (path.extname(file) === '.map') {
fs.unlinkSync(filePath)
console.log('remove ' + filePath);
}
}
}
let location = path.join(__dirname, '..', 'lib');
console.log('process ' + location);
deleteRefs(location);

Просмотреть файл

@ -29,11 +29,12 @@
"vscode-uri": "1.0.6"
},
"scripts": {
"prepublishOnly": "npm run clean && npm run compile-esm && npm run test",
"prepublishOnly": "npm run clean && npm run compile-esm && npm run test && npm run remove-sourcemap-refs",
"postpublish": "node ./build/post-publish.js",
"compile": "tsc -p ./src",
"compile-esm": "tsc -p ./src/tsconfig.esm.json",
"clean": "rimraf lib",
"remove-sourcemap-refs": "node ./build/remove-sourcemap-refs.js",
"watch": "tsc -w -p ./src",
"test": "npm run compile && mocha && npm run lint",
"lint": "tslint src/**/*.ts",

Просмотреть файл

@ -3,7 +3,7 @@
"target": "es5",
"module": "es6",
"moduleResolution": "node",
"sourceMap": false,
"sourceMap": true,
"declaration": true,
"stripInternal": true,
"outDir": "../lib/esm",