1 /*---------------------------------------------------------------------------------------------
2 * Copyright (c) Microsoft Corporation. All rights reserved.
3 * Licensed under the MIT License. See License.txt in the project root for license information.
4 *--------------------------------------------------------------------------------------------*/
6 const fs = require('fs');
7 const path = require('path');
9 function deleteRefs(dir) {
10 const files = fs.readdirSync(dir);
11 for (let file of files) {
12 const filePath = path.join(dir, file);
13 const stat = fs.statSync(filePath);
14 if (stat.isDirectory()) {
16 } else if (path.extname(file) === '.js') {
17 const content = fs.readFileSync(filePath, 'utf8');
18 const newContent = content.replace(/\/\/\# sourceMappingURL=[^]+.js.map/, '')
19 if (content.length !== newContent.length) {
20 console.log('remove sourceMappingURL in ' + filePath);
21 fs.writeFileSync(filePath, newContent);
23 } else if (path.extname(file) === '.map') {
24 fs.unlinkSync(filePath)
25 console.log('remove ' + filePath);
30 let location = path.join(__dirname, '..', 'lib');
31 console.log('process ' + location);