app-bundler 0.2.11 → 0.2.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/bundler.js +20 -1
- package/lib/cli.js +20 -1
- package/package.json +1 -1
- package/tsconfig.json +2 -2
package/lib/bundler.js
CHANGED
|
@@ -7877,7 +7877,7 @@ class DataInliner extends BaseRewriter_1.BaseRewriter {
|
|
|
7877
7877
|
await this.rewriteImport(resource, res);
|
|
7878
7878
|
continue;
|
|
7879
7879
|
}
|
|
7880
|
-
|
|
7880
|
+
await this.rewriteRequire(resource, res);
|
|
7881
7881
|
}
|
|
7882
7882
|
}
|
|
7883
7883
|
accepts(type) {
|
|
@@ -7902,6 +7902,25 @@ class DataInliner extends BaseRewriter_1.BaseRewriter {
|
|
|
7902
7902
|
resource.dependencies.splice(i, 1);
|
|
7903
7903
|
this.solution.outputResources.remove(dep.resource);
|
|
7904
7904
|
}
|
|
7905
|
+
rewriteRequire(resource, dep) {
|
|
7906
|
+
let rgx = new RegExp(`require\\s*\\(\\s*['"]${dep.url}['"]\\s*\\)\\s*;?`);
|
|
7907
|
+
let match = rgx.exec(resource.content);
|
|
7908
|
+
if (match == null) {
|
|
7909
|
+
console.error(`No require found for ${dep.url} in ${resource.filename}`);
|
|
7910
|
+
return;
|
|
7911
|
+
}
|
|
7912
|
+
let name = match.groups.name;
|
|
7913
|
+
let json = dep.resource.content;
|
|
7914
|
+
if (typeof json !== 'string') {
|
|
7915
|
+
json = JSON.stringify(json);
|
|
7916
|
+
}
|
|
7917
|
+
let code = `${json}`;
|
|
7918
|
+
let content = resource.content.replace(match[0], code);
|
|
7919
|
+
resource.content = content;
|
|
7920
|
+
let i = resource.dependencies.indexOf(dep);
|
|
7921
|
+
resource.dependencies.splice(i, 1);
|
|
7922
|
+
this.solution.outputResources.remove(dep.resource);
|
|
7923
|
+
}
|
|
7905
7924
|
}
|
|
7906
7925
|
exports.DataInliner = DataInliner;
|
|
7907
7926
|
;
|
package/lib/cli.js
CHANGED
|
@@ -7879,7 +7879,7 @@ class DataInliner extends BaseRewriter_1.BaseRewriter {
|
|
|
7879
7879
|
await this.rewriteImport(resource, res);
|
|
7880
7880
|
continue;
|
|
7881
7881
|
}
|
|
7882
|
-
|
|
7882
|
+
await this.rewriteRequire(resource, res);
|
|
7883
7883
|
}
|
|
7884
7884
|
}
|
|
7885
7885
|
accepts(type) {
|
|
@@ -7904,6 +7904,25 @@ class DataInliner extends BaseRewriter_1.BaseRewriter {
|
|
|
7904
7904
|
resource.dependencies.splice(i, 1);
|
|
7905
7905
|
this.solution.outputResources.remove(dep.resource);
|
|
7906
7906
|
}
|
|
7907
|
+
rewriteRequire(resource, dep) {
|
|
7908
|
+
let rgx = new RegExp(`require\\s*\\(\\s*['"]${dep.url}['"]\\s*\\)\\s*;?`);
|
|
7909
|
+
let match = rgx.exec(resource.content);
|
|
7910
|
+
if (match == null) {
|
|
7911
|
+
console.error(`No require found for ${dep.url} in ${resource.filename}`);
|
|
7912
|
+
return;
|
|
7913
|
+
}
|
|
7914
|
+
let name = match.groups.name;
|
|
7915
|
+
let json = dep.resource.content;
|
|
7916
|
+
if (typeof json !== 'string') {
|
|
7917
|
+
json = JSON.stringify(json);
|
|
7918
|
+
}
|
|
7919
|
+
let code = `${json}`;
|
|
7920
|
+
let content = resource.content.replace(match[0], code);
|
|
7921
|
+
resource.content = content;
|
|
7922
|
+
let i = resource.dependencies.indexOf(dep);
|
|
7923
|
+
resource.dependencies.splice(i, 1);
|
|
7924
|
+
this.solution.outputResources.remove(dep.resource);
|
|
7925
|
+
}
|
|
7907
7926
|
}
|
|
7908
7927
|
exports.DataInliner = DataInliner;
|
|
7909
7928
|
;
|
package/package.json
CHANGED
package/tsconfig.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
},
|
|
8
8
|
|
|
9
9
|
"outDir": "ts-temp",
|
|
10
|
-
"lib": ["
|
|
10
|
+
"lib": ["es2018", "dom"],
|
|
11
11
|
"typeRoots": [
|
|
12
12
|
"node_modules/@types",
|
|
13
13
|
"typings",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
],
|
|
17
17
|
"types": ["node", "assertion", "atma-utest", "jquery"],
|
|
18
18
|
"declaration": true,
|
|
19
|
-
"target": "
|
|
19
|
+
"target": "ES2018",
|
|
20
20
|
"module": "commonjs",
|
|
21
21
|
"sourceMap": false,
|
|
22
22
|
"experimentalDecorators": true
|