isomorphic-region-loader 21.0.25 → 21.0.27

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.
Files changed (54) hide show
  1. package/browser/package.json +1 -1
  2. package/browser-prod/package.json +1 -1
  3. package/lib/build-info._auto-generated_.d.ts +1 -1
  4. package/lib/build-info._auto-generated_.js +1 -1
  5. package/lib/package.json +1 -1
  6. package/lib-prod/build-info._auto-generated_.js +14 -30
  7. package/lib-prod/env/env.angular-node-app.js +130 -71
  8. package/lib-prod/env/env.docs-webapp.js +130 -71
  9. package/lib-prod/env/env.electron-app.js +130 -71
  10. package/lib-prod/env/env.mobile-app.js +130 -71
  11. package/lib-prod/env/env.npm-lib-and-cli-tool.js +130 -71
  12. package/lib-prod/env/env.vscode-plugin.js +130 -71
  13. package/lib-prod/env/index.js +6 -23
  14. package/lib-prod/index._auto-generated_.js +0 -6
  15. package/lib-prod/index.js +14 -32
  16. package/lib-prod/migrations/index.js +1 -19
  17. package/lib-prod/migrations/migrations_index._auto-generated_.js +0 -4
  18. package/lib-prod/models.js +21 -16
  19. package/lib-prod/package.json +1 -1
  20. package/lib-prod/region-remover.js +115 -119
  21. package/lib-prod/region.js +155 -189
  22. package/package.json +1 -1
  23. package/websql/package.json +1 -1
  24. package/websql-prod/package.json +1 -1
  25. package/lib-prod/build-info._auto-generated_.d.ts +0 -24
  26. package/lib-prod/build-info._auto-generated_.js.map +0 -1
  27. package/lib-prod/env/env.angular-node-app.d.ts +0 -64
  28. package/lib-prod/env/env.angular-node-app.js.map +0 -1
  29. package/lib-prod/env/env.docs-webapp.d.ts +0 -64
  30. package/lib-prod/env/env.docs-webapp.js.map +0 -1
  31. package/lib-prod/env/env.electron-app.d.ts +0 -64
  32. package/lib-prod/env/env.electron-app.js.map +0 -1
  33. package/lib-prod/env/env.mobile-app.d.ts +0 -64
  34. package/lib-prod/env/env.mobile-app.js.map +0 -1
  35. package/lib-prod/env/env.npm-lib-and-cli-tool.d.ts +0 -64
  36. package/lib-prod/env/env.npm-lib-and-cli-tool.js.map +0 -1
  37. package/lib-prod/env/env.vscode-plugin.d.ts +0 -64
  38. package/lib-prod/env/env.vscode-plugin.js.map +0 -1
  39. package/lib-prod/env/index.d.ts +0 -6
  40. package/lib-prod/env/index.js.map +0 -1
  41. package/lib-prod/index._auto-generated_.d.ts +0 -0
  42. package/lib-prod/index._auto-generated_.js.map +0 -1
  43. package/lib-prod/index.d.ts +0 -6
  44. package/lib-prod/index.js.map +0 -1
  45. package/lib-prod/migrations/index.d.ts +0 -1
  46. package/lib-prod/migrations/index.js.map +0 -1
  47. package/lib-prod/migrations/migrations_index._auto-generated_.d.ts +0 -0
  48. package/lib-prod/migrations/migrations_index._auto-generated_.js.map +0 -1
  49. package/lib-prod/models.d.ts +0 -14
  50. package/lib-prod/models.js.map +0 -1
  51. package/lib-prod/region-remover.d.ts +0 -15
  52. package/lib-prod/region-remover.js.map +0 -1
  53. package/lib-prod/region.d.ts +0 -29
  54. package/lib-prod/region.js.map +0 -1
@@ -1,130 +1,126 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RegionRemover = void 0;
4
- //#region imports
5
- const lib_prod_1 = require("tnp-core/lib-prod");
6
- const lib_prod_2 = require("tnp-core/lib-prod");
7
- const lib_prod_3 = require("tnp-helpers/lib-prod");
8
- const region_1 = require("./region");
9
- //#endregion
1
+ import { REGEX_REGION, TAGS } from "tnp-core/lib-prod";
2
+ import { path, ___NS__first, ___NS__isUndefined, ___NS__last } from "tnp-core/lib-prod";
3
+ import { UtilsTypescript__NS__removeTaggedImportExport } from "tnp-helpers/lib-prod";
4
+ import { Region } from "./region";
10
5
  class RegionRemover {
11
- realtiveOrAbsFilePAth;
12
- content;
13
- project;
14
- root;
15
- START_REGION = [];
16
- END_REGION = [];
17
- static from(realtiveOrAbsFilePAth, content, replacementss, // Models.dev.Replacement[],
18
- project) {
19
- let fileExtension = lib_prod_2.path.extname(realtiveOrAbsFilePAth);
20
- if (!replacementss) {
21
- replacementss = [
22
- [lib_prod_1.TAGS.BACKEND_FUNC, `return (void 0);`],
23
- lib_prod_1.TAGS.BACKEND,
24
- ];
25
- }
26
- return new RegionRemover(realtiveOrAbsFilePAth, fileExtension, content, replacementss, project);
6
+ constructor(realtiveOrAbsFilePAth, fileExtension, content, replacementss, project) {
7
+ this.realtiveOrAbsFilePAth = realtiveOrAbsFilePAth;
8
+ this.content = content;
9
+ this.project = project;
10
+ if (REGEX_REGION.TS_JS_SCSS_SASS.EXT.includes(fileExtension)) {
11
+ this.START_REGION.push(REGEX_REGION.TS_JS_SCSS_SASS.START);
12
+ this.END_REGION.push(REGEX_REGION.TS_JS_SCSS_SASS.END);
27
13
  }
28
- matchStartRegion(l) {
29
- const res = !(0, lib_prod_2.___NS__isUndefined)(this.START_REGION.find(r => l.match(r)));
30
- return res;
14
+ if (REGEX_REGION.HTML.EXT.includes(fileExtension)) {
15
+ this.START_REGION.push(REGEX_REGION.HTML.START);
16
+ this.END_REGION.push(REGEX_REGION.HTML.END);
31
17
  }
32
- matchEndRegion(l) {
33
- const res = !(0, lib_prod_2.___NS__isUndefined)(this.END_REGION.find(r => l.match(r)));
34
- return res;
18
+ if (REGEX_REGION.CSS.EXT.includes(fileExtension)) {
19
+ this.START_REGION.push(REGEX_REGION.CSS.START);
20
+ this.END_REGION.push(REGEX_REGION.CSS.END);
35
21
  }
36
- constructor(realtiveOrAbsFilePAth, fileExtension, content, replacementss, // Models.dev.Replacement[],
37
- project) {
38
- this.realtiveOrAbsFilePAth = realtiveOrAbsFilePAth;
39
- this.content = content;
40
- this.project = project;
41
- if (lib_prod_1.REGEX_REGION.TS_JS_SCSS_SASS.EXT.includes(fileExtension)) {
42
- this.START_REGION.push(lib_prod_1.REGEX_REGION.TS_JS_SCSS_SASS.START);
43
- this.END_REGION.push(lib_prod_1.REGEX_REGION.TS_JS_SCSS_SASS.END);
44
- }
45
- if (lib_prod_1.REGEX_REGION.HTML.EXT.includes(fileExtension)) {
46
- this.START_REGION.push(lib_prod_1.REGEX_REGION.HTML.START);
47
- this.END_REGION.push(lib_prod_1.REGEX_REGION.HTML.END);
22
+ this.content = UtilsTypescript__NS__removeTaggedImportExport(
23
+ this.content,
24
+ replacementss
25
+ // debug,
26
+ ) || "";
27
+ const lines = this.content.split("\n");
28
+ this.root = new Region(
29
+ this,
30
+ replacementss,
31
+ void 0,
32
+ 0,
33
+ lines.length - 1,
34
+ ___NS__first(lines),
35
+ ___NS__last(lines),
36
+ lines
37
+ );
38
+ this.tree(this.root);
39
+ }
40
+ root;
41
+ START_REGION = [];
42
+ END_REGION = [];
43
+ static from(realtiveOrAbsFilePAth, content, replacementss, project) {
44
+ let fileExtension = path.extname(realtiveOrAbsFilePAth);
45
+ if (!replacementss) {
46
+ replacementss = [
47
+ [TAGS.BACKEND_FUNC, `return (void 0);`],
48
+ TAGS.BACKEND
49
+ ];
50
+ }
51
+ return new RegionRemover(
52
+ realtiveOrAbsFilePAth,
53
+ fileExtension,
54
+ content,
55
+ replacementss,
56
+ project
57
+ // debug,
58
+ );
59
+ }
60
+ matchStartRegion(l) {
61
+ const res = !___NS__isUndefined(this.START_REGION.find((r) => l.match(r)));
62
+ return res;
63
+ }
64
+ matchEndRegion(l) {
65
+ const res = !___NS__isUndefined(this.END_REGION.find((r) => l.match(r)));
66
+ return res;
67
+ }
68
+ tree(node) {
69
+ const contentLines = node.contentLines;
70
+ let stack = 0;
71
+ for (let i = 0; i < contentLines.length; i++) {
72
+ const l = contentLines[i];
73
+ if (!node.isRoot) {
74
+ if (i === 0) {
75
+ node.addNormalLine(l, 0);
76
+ continue;
48
77
  }
49
- if (lib_prod_1.REGEX_REGION.CSS.EXT.includes(fileExtension)) {
50
- this.START_REGION.push(lib_prod_1.REGEX_REGION.CSS.START);
51
- this.END_REGION.push(lib_prod_1.REGEX_REGION.CSS.END);
78
+ if (i === node.contentLines.length - 1) {
79
+ node.addNormalLine(l, i);
80
+ continue;
52
81
  }
53
- this.content =
54
- (0, lib_prod_3.UtilsTypescript__NS__removeTaggedImportExport)(this.content, replacementss) || '';
55
- const lines = this.content.split('\n');
56
- this.root = new region_1.Region(this, replacementss, void 0, 0, lines.length - 1, (0, lib_prod_2.___NS__first)(lines), (0, lib_prod_2.___NS__last)(lines), lines);
57
- this.tree(this.root);
58
- }
59
- tree(node) {
60
- const contentLines = node.contentLines;
61
- // if (contentLines.length <= 3) {
62
- // for (let i = 0; i < contentLines.length; i++) {
63
- // const l = contentLines[i];
64
- // node.addNormalLine(l, i);
65
- // }
66
- // } else {
67
- let stack = 0;
68
- for (let i = 0; i < contentLines.length; i++) {
69
- const l = contentLines[i];
70
- if (!node.isRoot) {
71
- if (i === 0) {
72
- node.addNormalLine(l, 0);
73
- continue;
74
- }
75
- if (i === node.contentLines.length - 1) {
76
- node.addNormalLine(l, i);
77
- continue;
78
- }
79
- }
80
- if (node.lastRegionWithoutEnd) {
81
- if (this.matchStartRegion(l)) {
82
- node.addNormalLineToLastRegion(l, i);
83
- stack++;
84
- }
85
- else if (this.matchEndRegion(l)) {
86
- if (stack === 0) {
87
- node.endLastRegion(i, l);
88
- }
89
- else if (stack > 0) {
90
- node.addNormalLineToLastRegion(l, i);
91
- stack--;
92
- }
93
- }
94
- else {
95
- if (i === node.contentLines.length - (node.isRoot ? 1 : 2)) {
96
- stack = 0;
97
- node.endLastRegion(i, l);
98
- }
99
- else {
100
- node.addNormalLineToLastRegion(l, i);
101
- }
102
- }
103
- }
104
- else {
105
- if (this.matchStartRegion(l)) {
106
- node.addRegion(this, node, i, l);
107
- }
108
- else if (this.matchEndRegion(l)) {
109
- node.addNormalLine(l, i);
110
- }
111
- else {
112
- node.addNormalLine(l, i);
113
- }
114
- }
82
+ }
83
+ if (node.lastRegionWithoutEnd) {
84
+ if (this.matchStartRegion(l)) {
85
+ node.addNormalLineToLastRegion(l, i);
86
+ stack++;
87
+ } else if (this.matchEndRegion(l)) {
88
+ if (stack === 0) {
89
+ node.endLastRegion(i, l);
90
+ } else if (stack > 0) {
91
+ node.addNormalLineToLastRegion(l, i);
92
+ stack--;
93
+ }
94
+ } else {
95
+ if (i === node.contentLines.length - (node.isRoot ? 1 : 2)) {
96
+ stack = 0;
97
+ node.endLastRegion(i, l);
98
+ } else {
99
+ node.addNormalLineToLastRegion(l, i);
100
+ }
115
101
  }
116
- // }
117
- const children = node.regions;
118
- if (children.length > 0) {
119
- for (let index = 0; index < children.length; index++) {
120
- const child = children[index];
121
- this.tree(child);
122
- }
102
+ } else {
103
+ if (this.matchStartRegion(l)) {
104
+ node.addRegion(this, node, i, l);
105
+ } else if (this.matchEndRegion(l)) {
106
+ node.addNormalLine(l, i);
107
+ } else {
108
+ node.addNormalLine(l, i);
123
109
  }
110
+ }
124
111
  }
125
- get output() {
126
- return this.root.toString();
112
+ const children = node.regions;
113
+ if (children.length > 0) {
114
+ for (let index = 0; index < children.length; index++) {
115
+ const child = children[index];
116
+ this.tree(child);
117
+ }
127
118
  }
119
+ }
120
+ get output() {
121
+ return this.root.toString();
122
+ }
128
123
  }
129
- exports.RegionRemover = RegionRemover;
130
- //# sourceMappingURL=region-remover.js.map
124
+ export {
125
+ RegionRemover
126
+ };
@@ -1,194 +1,160 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Region = void 0;
4
- //#region imports
5
- const lib_prod_1 = require("tnp-core/lib-prod");
6
- const lib_prod_2 = require("tnp-core/lib-prod");
7
- const models_1 = require("./models");
8
- //#endregion
1
+ import { ___NS__first, ___NS__isArray, ___NS__last, ___NS__times } from "tnp-core/lib-prod";
2
+ import { TAGS } from "tnp-core/lib-prod";
3
+ import { labelReplacementCode } from "./models";
9
4
  class Region {
10
- context;
11
- replacementss;
12
- parent;
13
- startIndex;
14
- endIndex;
15
- lineStart;
16
- lineEnd;
17
- contentLines;
18
- constructor(context, replacementss, parent, startIndex, endIndex, lineStart, lineEnd, contentLines = []) {
19
- this.context = context;
20
- this.replacementss = replacementss;
21
- this.parent = parent;
22
- this.startIndex = startIndex;
23
- this.endIndex = endIndex;
24
- this.lineStart = lineStart;
25
- this.lineEnd = lineEnd;
26
- this.contentLines = contentLines;
5
+ constructor(context, replacementss, parent, startIndex, endIndex, lineStart, lineEnd, contentLines = []) {
6
+ this.context = context;
7
+ this.replacementss = replacementss;
8
+ this.parent = parent;
9
+ this.startIndex = startIndex;
10
+ this.endIndex = endIndex;
11
+ this.lineStart = lineStart;
12
+ this.lineEnd = lineEnd;
13
+ this.contentLines = contentLines;
14
+ }
15
+ tmpOutput;
16
+ get hasEnd() {
17
+ return this.endIndex !== void 0;
18
+ }
19
+ get lastRegionWithoutEnd() {
20
+ const last = ___NS__last(this.regionsOrStrings);
21
+ if (last instanceof Region && !last.hasEnd) {
22
+ return last;
27
23
  }
28
- tmpOutput;
29
- get hasEnd() {
30
- return this.endIndex !== void 0;
24
+ return void 0;
25
+ }
26
+ regionsOrStrings = [];
27
+ get regions() {
28
+ return this.regionsOrStrings.filter((f) => f instanceof Region);
29
+ }
30
+ setEnd(endIndex, lineEnd) {
31
+ this.endIndex = endIndex;
32
+ this.lineEnd = lineEnd;
33
+ }
34
+ get isRoot() {
35
+ return !this.parent;
36
+ }
37
+ addNormalLine(l, lineIndex) {
38
+ this.contentLines[lineIndex] = void 0;
39
+ this.regionsOrStrings.push(l);
40
+ }
41
+ addNormalLineToLastRegion(l, lineIndex) {
42
+ this.contentLines[lineIndex] = void 0;
43
+ this.lastRegionWithoutEnd.contentLines.push(l);
44
+ }
45
+ addRegion(context, parent, startIndex, lineStart) {
46
+ this.contentLines[startIndex] = void 0;
47
+ const newReg = new Region(
48
+ context,
49
+ this.replacementss,
50
+ parent,
51
+ startIndex,
52
+ void 0,
53
+ lineStart,
54
+ void 0,
55
+ [lineStart]
56
+ );
57
+ this.regionsOrStrings.push(newReg);
58
+ }
59
+ endLastRegion(endIndex, lineEnd) {
60
+ this.contentLines[endIndex] = void 0;
61
+ const regionWithoutEnd = this.regionsOrStrings.find(
62
+ (r) => r instanceof Region && !r.hasEnd
63
+ );
64
+ regionWithoutEnd.contentLines.push(lineEnd);
65
+ regionWithoutEnd.setEnd(endIndex, lineEnd);
66
+ }
67
+ containsTitle(s) {
68
+ const res = this.titleString.search(s) !== -1;
69
+ return res;
70
+ }
71
+ get titleString() {
72
+ let line = this.lineStart;
73
+ const regionWord = "#region";
74
+ const indexOfRegion = line.search(regionWord);
75
+ line = line.replace(line.slice(0, indexOfRegion + regionWord.length), "");
76
+ return line.replace("-->", "").replace("<!--", "");
77
+ }
78
+ toString() {
79
+ if (this.tmpOutput !== void 0) {
80
+ return this.tmpOutput;
31
81
  }
32
- get lastRegionWithoutEnd() {
33
- const last = (0, lib_prod_1.___NS__last)(this.regionsOrStrings);
34
- if (last instanceof Region && !last.hasEnd) {
35
- return last;
36
- }
37
- return void 0;
38
- }
39
- regionsOrStrings = [];
40
- get regions() {
41
- return this.regionsOrStrings.filter(f => f instanceof Region);
42
- }
43
- setEnd(endIndex, lineEnd) {
44
- this.endIndex = endIndex;
45
- this.lineEnd = lineEnd;
46
- }
47
- get isRoot() {
48
- return !this.parent;
49
- }
50
- addNormalLine(l, lineIndex) {
51
- this.contentLines[lineIndex] = void 0;
52
- this.regionsOrStrings.push(l);
53
- }
54
- addNormalLineToLastRegion(l, lineIndex) {
55
- this.contentLines[lineIndex] = void 0;
56
- this.lastRegionWithoutEnd.contentLines.push(l);
57
- }
58
- addRegion(context, parent, startIndex, lineStart) {
59
- this.contentLines[startIndex] = void 0;
60
- const newReg = new Region(context, this.replacementss, parent, startIndex, void 0, lineStart, void 0, [lineStart]);
61
- this.regionsOrStrings.push(newReg);
62
- }
63
- endLastRegion(endIndex, lineEnd) {
64
- this.contentLines[endIndex] = void 0;
65
- const regionWithoutEnd = this.regionsOrStrings.find(r => r instanceof Region && !r.hasEnd);
66
- regionWithoutEnd.contentLines.push(lineEnd);
67
- regionWithoutEnd.setEnd(endIndex, lineEnd);
68
- }
69
- containsTitle(s) {
70
- const res = this.titleString.search(s) !== -1;
71
- // Helpers__NS__log(`checking tag (${res}): "${s}" in line: "${this.titleString}"`)
72
- return res;
73
- }
74
- get titleString() {
75
- let line = this.lineStart;
76
- const regionWord = '#region';
77
- const indexOfRegion = line.search(regionWord);
78
- line = line.replace(line.slice(0, indexOfRegion + regionWord.length), '');
79
- return line.replace('-->', '').replace('<!--', ''); // TODO not necessery ?
80
- }
81
- toString() {
82
- if (this.tmpOutput !== void 0) {
83
- return this.tmpOutput;
84
- }
85
- let previous = '';
86
- this.tmpOutput = this.regionsOrStrings
87
- .map(regionOrString => {
88
- if (regionOrString instanceof Region) {
89
- //#region handle region
90
- const replacements = this.replacementss;
91
- for (let index = 0; index < replacements.length; index++) {
92
- const rep = replacements[index];
93
- const isArr = (0, lib_prod_1.___NS__isArray)(replacements[index]);
94
- const regionTag = (isArr ? (0, lib_prod_1.___NS__first)(rep) : rep);
95
- let out = (isArr ? rep[1] : '');
96
- const verticalLength = regionOrString.toString().split('\n').length - 1;
97
- if (regionOrString.containsTitle(regionTag)) {
98
- if (regionTag.toLowerCase() === lib_prod_2.TAGS.WEBSQL.toLowerCase()) {
99
- out = `${(0, lib_prod_1.___NS__times)(verticalLength)
100
- .map(() => models_1.labelReplacementCode.backendCode + '\n')
101
- .join('')} ${out}`;
102
- }
103
- if (regionTag.toLowerCase() === lib_prod_2.TAGS.BACKEND.toLowerCase()) {
104
- out = `${(0, lib_prod_1.___NS__times)(verticalLength)
105
- .map(() => models_1.labelReplacementCode.backendCode + '\n')
106
- .join('')} ${out}`;
107
- }
108
- if (regionTag.toLowerCase() === lib_prod_2.TAGS.NOT_FOR_NPM.toLowerCase()) {
109
- out = `${(0, lib_prod_1.___NS__times)(verticalLength)
110
- .map(() => models_1.labelReplacementCode.notForNpmCode + '\n')
111
- .join('')} ${out}`;
112
- }
113
- if (regionTag.toLowerCase() === lib_prod_2.TAGS.BROWSER.toLowerCase()) {
114
- out = `${(0, lib_prod_1.___NS__times)(verticalLength)
115
- .map(() => models_1.labelReplacementCode.browserCode + '\n')
116
- .join('')} ${out}`;
117
- }
118
- if (regionTag.toLowerCase() === lib_prod_2.TAGS.WEBSQL_ONLY.toLowerCase()) {
119
- out = `${(0, lib_prod_1.___NS__times)(verticalLength)
120
- .map(() => models_1.labelReplacementCode.backendCode + '\n')
121
- .join('')} ${out}`;
122
- }
123
- if (regionTag.toLowerCase() === lib_prod_2.TAGS.BACKEND_FUNC.toLowerCase()) {
124
- let spacesPrevious = previous.search(/\S/);
125
- spacesPrevious = spacesPrevious < 0 ? 0 : spacesPrevious;
126
- out =
127
- `${(0, lib_prod_1.___NS__times)(verticalLength)
128
- .map(() => models_1.labelReplacementCode.backendCode + '\n')
129
- .join('')}` +
130
- `${(0, lib_prod_1.___NS__times)(spacesPrevious)
131
- .map(n => ' ')
132
- .join('')} ${out}`;
133
- }
134
- if (regionTag.toLowerCase() === lib_prod_2.TAGS.WEBSQL_FUNC.toLowerCase()) {
135
- let spacesPrevious = previous.search(/\S/);
136
- spacesPrevious = spacesPrevious < 0 ? 0 : spacesPrevious;
137
- out =
138
- `${(0, lib_prod_1.___NS__times)(verticalLength)
139
- .map(() => models_1.labelReplacementCode.backendCode + '\n')
140
- .join('')}` +
141
- `${(0, lib_prod_1.___NS__times)(spacesPrevious)
142
- .map(n => ' ')
143
- .join('')} ${out}`;
144
- }
145
- if (regionTag.toLowerCase() ===
146
- lib_prod_2.TAGS.CUT_CODE_IF_TRUE.toLowerCase() ||
147
- regionTag.toLowerCase() === lib_prod_2.TAGS.CUT_CODE_IF_FALSE.toLowerCase()) {
148
- const fn = out; // as ReturnType<typeof codeCuttFn>;
149
- let expressionToExecute = regionOrString.titleString;
150
- // Helpers__NS__log(`LINE: "${regionOrString.lineStart}"`);
151
- expressionToExecute = expressionToExecute.replace(regionTag, '');
152
- // Helpers__NS__log(`Expresion to evaluate "${expressionToExecute}"`);
153
- // Helpers__NS__log(`this.project "${this.project.name}"`);
154
- const configForProject = this.project && this.project.env.config;
155
- // Helpers__NS__log(`configForProject "${configForProject}"`);
156
- const cutCode = fn(expressionToExecute, configForProject, this.realtiveOrAbsFilePAth);
157
- // Helpers__NS__info(`Cut code: "${cutCode}"`);
158
- if (cutCode === null) {
159
- continue;
160
- }
161
- if ((cutCode &&
162
- regionTag.toLowerCase() ===
163
- lib_prod_2.TAGS.CUT_CODE_IF_TRUE.toLowerCase()) ||
164
- (!cutCode &&
165
- regionTag.toLowerCase() ===
166
- lib_prod_2.TAGS.CUT_CODE_IF_FALSE.toLowerCase())) {
167
- out = '';
168
- }
169
- else {
170
- continue;
171
- }
172
- }
173
- regionOrString.tmpOutput = out;
174
- break;
175
- }
176
- }
177
- //#endregion
82
+ let previous = "";
83
+ this.tmpOutput = this.regionsOrStrings.map((regionOrString) => {
84
+ if (regionOrString instanceof Region) {
85
+ const replacements = this.replacementss;
86
+ for (let index = 0; index < replacements.length; index++) {
87
+ const rep = replacements[index];
88
+ const isArr = ___NS__isArray(replacements[index]);
89
+ const regionTag = isArr ? ___NS__first(rep) : rep;
90
+ let out = isArr ? rep[1] : "";
91
+ const verticalLength = regionOrString.toString().split("\n").length - 1;
92
+ if (regionOrString.containsTitle(regionTag)) {
93
+ if (regionTag.toLowerCase() === TAGS.WEBSQL.toLowerCase()) {
94
+ out = `${___NS__times(verticalLength).map(() => labelReplacementCode.backendCode + "\n").join("")} ${out}`;
178
95
  }
179
- const res = regionOrString.toString();
180
- previous = res;
181
- return res;
182
- })
183
- .join('\n');
184
- return this.tmpOutput;
185
- }
186
- get project() {
187
- return this.context.project;
188
- }
189
- get realtiveOrAbsFilePAth() {
190
- return this.context.realtiveOrAbsFilePAth;
191
- }
96
+ if (regionTag.toLowerCase() === TAGS.BACKEND.toLowerCase()) {
97
+ out = `${___NS__times(verticalLength).map(() => labelReplacementCode.backendCode + "\n").join("")} ${out}`;
98
+ }
99
+ if (regionTag.toLowerCase() === TAGS.NOT_FOR_NPM.toLowerCase()) {
100
+ out = `${___NS__times(verticalLength).map(() => labelReplacementCode.notForNpmCode + "\n").join("")} ${out}`;
101
+ }
102
+ if (regionTag.toLowerCase() === TAGS.BROWSER.toLowerCase()) {
103
+ out = `${___NS__times(verticalLength).map(() => labelReplacementCode.browserCode + "\n").join("")} ${out}`;
104
+ }
105
+ if (regionTag.toLowerCase() === TAGS.WEBSQL_ONLY.toLowerCase()) {
106
+ out = `${___NS__times(verticalLength).map(() => labelReplacementCode.backendCode + "\n").join("")} ${out}`;
107
+ }
108
+ if (regionTag.toLowerCase() === TAGS.BACKEND_FUNC.toLowerCase()) {
109
+ let spacesPrevious = previous.search(/\S/);
110
+ spacesPrevious = spacesPrevious < 0 ? 0 : spacesPrevious;
111
+ out = `${___NS__times(verticalLength).map(() => labelReplacementCode.backendCode + "\n").join("")}${___NS__times(spacesPrevious).map((n) => " ").join("")} ${out}`;
112
+ }
113
+ if (regionTag.toLowerCase() === TAGS.WEBSQL_FUNC.toLowerCase()) {
114
+ let spacesPrevious = previous.search(/\S/);
115
+ spacesPrevious = spacesPrevious < 0 ? 0 : spacesPrevious;
116
+ out = `${___NS__times(verticalLength).map(() => labelReplacementCode.backendCode + "\n").join("")}${___NS__times(spacesPrevious).map((n) => " ").join("")} ${out}`;
117
+ }
118
+ if (regionTag.toLowerCase() === TAGS.CUT_CODE_IF_TRUE.toLowerCase() || regionTag.toLowerCase() === TAGS.CUT_CODE_IF_FALSE.toLowerCase()) {
119
+ const fn = out;
120
+ let expressionToExecute = regionOrString.titleString;
121
+ expressionToExecute = expressionToExecute.replace(
122
+ regionTag,
123
+ ""
124
+ );
125
+ const configForProject = this.project && this.project.env.config;
126
+ const cutCode = fn(
127
+ expressionToExecute,
128
+ configForProject,
129
+ this.realtiveOrAbsFilePAth
130
+ );
131
+ if (cutCode === null) {
132
+ continue;
133
+ }
134
+ if (cutCode && regionTag.toLowerCase() === TAGS.CUT_CODE_IF_TRUE.toLowerCase() || !cutCode && regionTag.toLowerCase() === TAGS.CUT_CODE_IF_FALSE.toLowerCase()) {
135
+ out = "";
136
+ } else {
137
+ continue;
138
+ }
139
+ }
140
+ regionOrString.tmpOutput = out;
141
+ break;
142
+ }
143
+ }
144
+ }
145
+ const res = regionOrString.toString();
146
+ previous = res;
147
+ return res;
148
+ }).join("\n");
149
+ return this.tmpOutput;
150
+ }
151
+ get project() {
152
+ return this.context.project;
153
+ }
154
+ get realtiveOrAbsFilePAth() {
155
+ return this.context.realtiveOrAbsFilePAth;
156
+ }
192
157
  }
193
- exports.Region = Region;
194
- //# sourceMappingURL=region.js.map
158
+ export {
159
+ Region
160
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isomorphic-region-loader",
3
- "version": "21.0.25",
3
+ "version": "21.0.27",
4
4
  "scripts": {
5
5
  "taon init": "taon init",
6
6
  "taon start": "taon start",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isomorphic-region-loader/websql",
3
- "version": "21.0.25",
3
+ "version": "21.0.27",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^21.0.0",
6
6
  "@angular/core": "^21.0.0"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isomorphic-region-loader/websql-prod",
3
- "version": "21.0.25",
3
+ "version": "21.0.27",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^21.0.0",
6
6
  "@angular/core": "^21.0.0"
@@ -1,24 +0,0 @@
1
- /**
2
- * Autogenerated by current cli tool
3
- */
4
- export declare const BUILD_FRAMEWORK_CLI_NAME = "tnp";
5
- /**
6
- * This value can be change in taon.jsonc (appId)
7
- */
8
- export declare const APP_ID = "com.domain.example.isomorphic-region-loader";
9
- /**
10
- * Autogenerated by current cli tool
11
- */
12
- export declare const BUILD_BASE_HREF = "";
13
- /**
14
- * This value can be change in taon.jsonc (overrideNpmName)
15
- */
16
- export declare const PROJECT_NPM_NAME = "isomorphic-region-loader";
17
- /**
18
- * Taon version from you project taon.json
19
- */
20
- export declare const CURRENT_PACKAGE_TAON_VERSION = "v21";
21
- /**
22
- * Autogenerated by current cli tool. Use *tnp release* to bump version.
23
- */
24
- export declare const CURRENT_PACKAGE_VERSION = "21.0.25";
@@ -1 +0,0 @@
1
- {"version":3,"file":"build-info._auto-generated_.js","sourceRoot":"","sources":[""],"names":[],"mappings":";;;AAAA,yCAAyC;AACzC;;GAEG;AACU,QAAA,wBAAwB,GAAG,KAAK,CAAC;AAC9C;;GAEG;AACU,QAAA,MAAM,GAAG,6CAA6C,CAAC;AACpE;;GAEG;AACU,QAAA,eAAe,GAAG,EAAE,CAAC;AAClC;;GAEG;AACU,QAAA,gBAAgB,GAAG,0BAA0B,CAAC;AAC3D;;GAEG;AACU,QAAA,4BAA4B,GAAG,KAAK,CAAC;AAClD;;GAEG;AACU,QAAA,uBAAuB,GAAG,SAAS,CAAC;AACjD,yCAAyC"}