Skip to content

Commit 5dd2516

Browse files
authored
Merge pull request #336 from finale-lua/bundle-remove-comments
Rollback #334 and #335
2 parents 4073449 + 3cb9a73 commit 5dd2516

File tree

3 files changed

+4
-26
lines changed

3 files changed

+4
-26
lines changed

.github/actions/bundle/dist/index.js

+1-21
Original file line numberDiff line numberDiff line change
@@ -4501,7 +4501,6 @@ const fs_1 = __importDefault(__nccwpck_require__(7147));
45014501
const path_1 = __importDefault(__nccwpck_require__(1017));
45024502
const helpers_1 = __nccwpck_require__(8092);
45034503
const lua_require_1 = __nccwpck_require__(9083);
4504-
const remove_comments_1 = __nccwpck_require__(6236);
45054504
const wrap_import_1 = __nccwpck_require__(3494);
45064505
exports.files = {};
45074506
const importFileBase = (name, importedFiles, fetcher) => {
@@ -4548,7 +4547,7 @@ const bundleFileBase = (name, importedFiles, mixins, fetcher) => {
45484547
}
45494548
if (fileStack.length > 1)
45504549
fileStack.push((0, lua_require_1.generateLuaRequire)());
4551-
return fileStack.reverse().map(remove_comments_1.removeComments).join('\n\n');
4550+
return fileStack.reverse().join('\n\n');
45524551
};
45534552
exports.bundleFileBase = bundleFileBase;
45544553
const bundleFile = (name, sourcePath, mixins) => {
@@ -4677,25 +4676,6 @@ const resolveRequiredFile = (name) => {
46774676
exports.resolveRequiredFile = resolveRequiredFile;
46784677

46794678

4680-
/***/ }),
4681-
4682-
/***/ 6236:
4683-
/***/ ((__unused_webpack_module, exports) => {
4684-
4685-
"use strict";
4686-
4687-
Object.defineProperty(exports, "__esModule", ({ value: true }));
4688-
exports.removeComments = void 0;
4689-
const removeComments = (contents) => {
4690-
return contents
4691-
.replace(/--\[\[[^\]]*\]\]/giu, '')
4692-
.replace(/--.*$/gimu, '')
4693-
.replace(/\n\n+/gimu, '\n')
4694-
.replace(/ *$/gimu, '');
4695-
};
4696-
exports.removeComments = removeComments;
4697-
4698-
46994679
/***/ }),
47004680

47014681
/***/ 3494:

.github/actions/bundle/src/bundle.test.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { bundleFileBase, ImportedFiles, importFileBase } from './bundle'
22
import { generateLuaRequire } from './lua-require'
3-
import { removeComments } from './remove-comments'
43

54
describe('importFile', () => {
65
it('files can be imported', () => {
@@ -41,7 +40,7 @@ describe('bundle', () => {
4140
const bundle = bundleFileBase('a.lua', {}, [], fetcher)
4241
expect(bundle).toBe(
4342
[
44-
removeComments(generateLuaRequire()),
43+
generateLuaRequire(),
4544
'',
4645
'__imports["b"] = function()',
4746
" local b = require('b')",
@@ -71,7 +70,7 @@ describe('bundle', () => {
7170
const bundle = bundleFileBase('mixin.lua', {}, ['mixin.FCMControl', 'mixin.FCMString'], fetcher)
7271
expect(bundle).toBe(
7372
[
74-
removeComments(generateLuaRequire()),
73+
generateLuaRequire(),
7574
'',
7675
'__imports["mixin.FCMControl"] = function()',
7776
' return {}',

.github/actions/bundle/src/bundle.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import fs from 'fs'
22
import path from 'path'
33
import { getAllImports } from './helpers'
44
import { generateLuaRequire, resolveRequiredFile } from './lua-require'
5-
import { removeComments } from './remove-comments'
65
import { wrapImport } from './wrap-import'
76

87
export type ImportedFile = {
@@ -59,7 +58,7 @@ export const bundleFileBase = (
5958
}
6059

6160
if (fileStack.length > 1) fileStack.push(generateLuaRequire())
62-
return fileStack.reverse().map(removeComments).join('\n\n')
61+
return fileStack.reverse().join('\n\n')
6362
}
6463

6564
export const bundleFile = (name: string, sourcePath: string, mixins: string[]): string => {

0 commit comments

Comments
 (0)