isomorphic-region-loader 18.0.19 → 18.0.21
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/assets/shared/shared_folder_info.txt +1 -1
- package/browser/README.md +24 -24
- package/client/README.md +24 -24
- package/index.js +16 -3
- package/index.js.map +1 -1
- package/lib/build-info._auto-generated_.js.map +1 -1
- package/lib/index._auto-generated_.d.ts +1 -0
- package/lib/index._auto-generated_.js.map +1 -1
- package/lib/index.js +18 -5
- package/lib/index.js.map +1 -1
- package/lib/models.js.map +1 -1
- package/lib/region-remover.js +44 -45
- package/lib/region-remover.js.map +1 -1
- package/lib/region.js +89 -111
- package/lib/region.js.map +1 -1
- package/migrations/index.js +15 -2
- package/migrations/index.js.map +1 -1
- package/migrations/migrations_index._auto-generated_.d.ts +1 -0
- package/migrations/migrations_index._auto-generated_.js.map +1 -1
- package/package.json +6 -40
- package/src.d.ts +1 -1
- package/tmp-environment.json +8 -370
- package/websql/README.md +24 -24
- package/browser/package.json +0 -25
- package/taon.jsonc +0 -33
- package/websql/package.json +0 -25
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
THIS FILE IS GENERATED. THIS FILE IS GENERATED. THIS FILE IS GENERATED.
|
|
2
2
|
|
|
3
|
-
Assets from this folder are being shipped with this npm package (isomorphic-region-loader@18.0.
|
|
3
|
+
Assets from this folder are being shipped with this npm package (isomorphic-region-loader@18.0.20)
|
|
4
4
|
created from this project.
|
|
5
5
|
|
|
6
6
|
THIS FILE IS GENERATED.THIS FILE IS GENERATED. THIS FILE IS GENERATED.
|
package/browser/README.md
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
# MyLib
|
|
2
|
-
|
|
3
|
-
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 13.2.0.
|
|
4
|
-
|
|
5
|
-
## Code scaffolding
|
|
6
|
-
|
|
7
|
-
Run `ng generate component component-name --project my-lib` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project my-lib`.
|
|
8
|
-
> Note: Don't forget to add `--project my-lib` or else it will be added to the default project in your `angular.json` file.
|
|
9
|
-
|
|
10
|
-
## Build
|
|
11
|
-
|
|
12
|
-
Run `ng build my-lib` to build the project. The build artifacts will be stored in the `dist/` directory.
|
|
13
|
-
|
|
14
|
-
## Publishing
|
|
15
|
-
|
|
16
|
-
After building your library with `ng build my-lib`, go to the dist folder `cd dist/my-lib` and run `npm publish`.
|
|
17
|
-
|
|
18
|
-
## Running unit tests
|
|
19
|
-
|
|
20
|
-
Run `ng test my-lib` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
|
21
|
-
|
|
22
|
-
## Further help
|
|
23
|
-
|
|
24
|
-
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
|
|
1
|
+
# MyLib
|
|
2
|
+
|
|
3
|
+
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 13.2.0.
|
|
4
|
+
|
|
5
|
+
## Code scaffolding
|
|
6
|
+
|
|
7
|
+
Run `ng generate component component-name --project my-lib` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project my-lib`.
|
|
8
|
+
> Note: Don't forget to add `--project my-lib` or else it will be added to the default project in your `angular.json` file.
|
|
9
|
+
|
|
10
|
+
## Build
|
|
11
|
+
|
|
12
|
+
Run `ng build my-lib` to build the project. The build artifacts will be stored in the `dist/` directory.
|
|
13
|
+
|
|
14
|
+
## Publishing
|
|
15
|
+
|
|
16
|
+
After building your library with `ng build my-lib`, go to the dist folder `cd dist/my-lib` and run `npm publish`.
|
|
17
|
+
|
|
18
|
+
## Running unit tests
|
|
19
|
+
|
|
20
|
+
Run `ng test my-lib` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
|
21
|
+
|
|
22
|
+
## Further help
|
|
23
|
+
|
|
24
|
+
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
|
package/client/README.md
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
# MyLib
|
|
2
|
-
|
|
3
|
-
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 13.2.0.
|
|
4
|
-
|
|
5
|
-
## Code scaffolding
|
|
6
|
-
|
|
7
|
-
Run `ng generate component component-name --project my-lib` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project my-lib`.
|
|
8
|
-
> Note: Don't forget to add `--project my-lib` or else it will be added to the default project in your `angular.json` file.
|
|
9
|
-
|
|
10
|
-
## Build
|
|
11
|
-
|
|
12
|
-
Run `ng build my-lib` to build the project. The build artifacts will be stored in the `dist/` directory.
|
|
13
|
-
|
|
14
|
-
## Publishing
|
|
15
|
-
|
|
16
|
-
After building your library with `ng build my-lib`, go to the dist folder `cd dist/my-lib` and run `npm publish`.
|
|
17
|
-
|
|
18
|
-
## Running unit tests
|
|
19
|
-
|
|
20
|
-
Run `ng test my-lib` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
|
21
|
-
|
|
22
|
-
## Further help
|
|
23
|
-
|
|
24
|
-
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
|
|
1
|
+
# MyLib
|
|
2
|
+
|
|
3
|
+
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 13.2.0.
|
|
4
|
+
|
|
5
|
+
## Code scaffolding
|
|
6
|
+
|
|
7
|
+
Run `ng generate component component-name --project my-lib` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project my-lib`.
|
|
8
|
+
> Note: Don't forget to add `--project my-lib` or else it will be added to the default project in your `angular.json` file.
|
|
9
|
+
|
|
10
|
+
## Build
|
|
11
|
+
|
|
12
|
+
Run `ng build my-lib` to build the project. The build artifacts will be stored in the `dist/` directory.
|
|
13
|
+
|
|
14
|
+
## Publishing
|
|
15
|
+
|
|
16
|
+
After building your library with `ng build my-lib`, go to the dist folder `cd dist/my-lib` and run `npm publish`.
|
|
17
|
+
|
|
18
|
+
## Running unit tests
|
|
19
|
+
|
|
20
|
+
Run `ng test my-lib` to execute the unit tests via [Karma](https://karma-runner.github.io).
|
|
21
|
+
|
|
22
|
+
## Further help
|
|
23
|
+
|
|
24
|
+
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
|
package/index.js
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
tslib_1.__exportStar(require("./lib"), exports);
|
|
17
|
+
const lib_1 = require("./lib");
|
|
18
|
+
__exportStar(require("./lib"), exports);
|
|
6
19
|
exports.default = lib_1.default;
|
|
7
20
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":[""],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["/Users/dfilipiak/projects/npm/taon-dev/isomorphic-region-loader/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+BAAwB;AACxB,wCAAsB;AACtB,kBAAe,aAAG,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-info._auto-generated_.js","sourceRoot":"","sources":[""],"names":[],"mappings":";;;AACa,QAAA,wBAAwB,GAAG,KAAK,CAAC"}
|
|
1
|
+
{"version":3,"file":"build-info._auto-generated_.js","sourceRoot":"","sources":["/Users/dfilipiak/projects/npm/taon-dev/isomorphic-region-loader/src/lib/build-info._auto-generated_.ts"],"names":[],"mappings":";;;AACa,QAAA,wBAAwB,GAAG,KAAK,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index._auto-generated_.js","sourceRoot":"","sources":[""],"names":[],"mappings":"AAAA,cAAc;AACd,8CAA8C;AAC9C,2BAA2B;AAC3B,uDAAuD;AACvD,2CAA2C"}
|
|
1
|
+
{"version":3,"file":"index._auto-generated_.js","sourceRoot":"","sources":["/Users/dfilipiak/projects/npm/taon-dev/isomorphic-region-loader/src/lib/index._auto-generated_.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,8CAA8C;AAC9C,2BAA2B;AAC3B,uDAAuD;AACvD,2CAA2C"}
|
package/lib/index.js
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
17
|
exports.StripBlockLoader = StripBrowserCode;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
tslib_1.__exportStar(require("./models"), exports);
|
|
18
|
+
const region_remover_1 = require("./region-remover");
|
|
19
|
+
__exportStar(require("./models"), exports);
|
|
7
20
|
function StripBrowserCode(content) {
|
|
8
21
|
// @ts-ignore
|
|
9
22
|
content = region_remover_1.RegionRemover.from(this.resourcePath, content, ['@browser']).output + '\n';
|
|
@@ -12,7 +25,7 @@ function StripBrowserCode(content) {
|
|
|
12
25
|
}
|
|
13
26
|
return content;
|
|
14
27
|
}
|
|
15
|
-
|
|
16
|
-
|
|
28
|
+
__exportStar(require("./region-remover"), exports);
|
|
29
|
+
__exportStar(require("./region"), exports);
|
|
17
30
|
exports.default = StripBrowserCode;
|
|
18
31
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":[""],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["/Users/dfilipiak/projects/npm/taon-dev/isomorphic-region-loader/src/lib/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAkB6B,4CAAgB;AAjB7C,qDAAiD;AAEjD,2CAAyB;AAEzB,SAAS,gBAAgB,CAAC,OAAO;IAG/B,aAAa;IACb,OAAO,GAAG,8BAAa,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,GAAG,IAAI,CAAC;IAErF,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;QACnB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAID,mDAAiC;AACjC,2CAAyB;AAEzB,kBAAe,gBAAgB,CAAC"}
|
package/lib/models.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.js","sourceRoot":"","sources":[""],"names":[],"mappings":";;;AACa,QAAA,oBAAoB,GAAG;IAClC,WAAW,EAAE,OAAO,EAAC,wBAAwB;IAC7C,WAAW,EAAE,OAAO,EAAC,wBAAwB;IAC7C,aAAa,EAAE,OAAO,EAAC,+BAA+B;IACtD,iBAAiB,EAAE,OAAO,EAAC,gCAAgC;IAC3D,yBAAyB,EAAE,OAAO,EAAC,gCAAgC;CACpE,CAAC;AAGW,QAAA,oBAAoB,GAAG;IAClC,UAAU,EAAE,cAAc,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,YAAY;CACvD,CAAC"}
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["/Users/dfilipiak/projects/npm/taon-dev/isomorphic-region-loader/src/lib/models.ts"],"names":[],"mappings":";;;AACa,QAAA,oBAAoB,GAAG;IAClC,WAAW,EAAE,OAAO,EAAC,wBAAwB;IAC7C,WAAW,EAAE,OAAO,EAAC,wBAAwB;IAC7C,aAAa,EAAE,OAAO,EAAC,+BAA+B;IACtD,iBAAiB,EAAE,OAAO,EAAC,gCAAgC;IAC3D,yBAAyB,EAAE,OAAO,EAAC,gCAAgC;CACpE,CAAC;AAGW,QAAA,oBAAoB,GAAG;IAClC,UAAU,EAAE,cAAc,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,YAAY;CACvD,CAAC"}
|
package/lib/region-remover.js
CHANGED
|
@@ -1,17 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RegionRemover = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
const tnp_core_1 = require("tnp-core");
|
|
5
|
+
const region_1 = require("./region");
|
|
6
|
+
const tnp_config_1 = require("tnp-config");
|
|
7
|
+
class RegionRemover {
|
|
8
|
+
realtiveOrAbsFilePAth;
|
|
9
|
+
content;
|
|
10
|
+
project;
|
|
11
|
+
root;
|
|
12
|
+
START_REGION = [];
|
|
13
|
+
END_REGION = [];
|
|
14
|
+
static from(realtiveOrAbsFilePAth, content, replacementss, // Models.dev.Replacement[],
|
|
15
|
+
project) {
|
|
16
|
+
let fileExtension = tnp_core_1.path.extname(realtiveOrAbsFilePAth);
|
|
17
|
+
if (!replacementss) {
|
|
18
|
+
replacementss = [
|
|
19
|
+
[tnp_config_1.TAGS.BACKEND_FUNC, `return (void 0);`],
|
|
20
|
+
tnp_config_1.TAGS.BACKEND,
|
|
21
|
+
];
|
|
22
|
+
}
|
|
23
|
+
return new RegionRemover(realtiveOrAbsFilePAth, fileExtension, content, replacementss, project);
|
|
24
|
+
}
|
|
25
|
+
matchStartRegion(l) {
|
|
26
|
+
const res = !tnp_core_1._.isUndefined(this.START_REGION.find(r => l.match(r)));
|
|
27
|
+
return res;
|
|
28
|
+
}
|
|
29
|
+
matchEndRegion(l) {
|
|
30
|
+
const res = !tnp_core_1._.isUndefined(this.END_REGION.find(r => l.match(r)));
|
|
31
|
+
return res;
|
|
32
|
+
}
|
|
33
|
+
constructor(realtiveOrAbsFilePAth, fileExtension, content, replacementss, // Models.dev.Replacement[],
|
|
9
34
|
project) {
|
|
10
35
|
this.realtiveOrAbsFilePAth = realtiveOrAbsFilePAth;
|
|
11
36
|
this.content = content;
|
|
12
37
|
this.project = project;
|
|
13
|
-
this.START_REGION = [];
|
|
14
|
-
this.END_REGION = [];
|
|
15
38
|
if ((tnp_config_1.REGEX_REGION.TS_JS_SCSS_SASS.EXT).includes(fileExtension)) {
|
|
16
39
|
this.START_REGION.push(tnp_config_1.REGEX_REGION.TS_JS_SCSS_SASS.START);
|
|
17
40
|
this.END_REGION.push(tnp_config_1.REGEX_REGION.TS_JS_SCSS_SASS.END);
|
|
@@ -24,40 +47,21 @@ var RegionRemover = /** @class */ (function () {
|
|
|
24
47
|
this.START_REGION.push(tnp_config_1.REGEX_REGION.CSS.START);
|
|
25
48
|
this.END_REGION.push(tnp_config_1.REGEX_REGION.CSS.END);
|
|
26
49
|
}
|
|
27
|
-
|
|
50
|
+
const lines = this.content.split('\n');
|
|
28
51
|
this.root = new region_1.Region(this, replacementss, void 0, 0, (lines.length - 1), tnp_core_1._.first(lines), tnp_core_1._.last(lines), lines);
|
|
29
52
|
this.tree(this.root);
|
|
30
53
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
var fileExtension = tnp_core_1.path.extname(realtiveOrAbsFilePAth);
|
|
34
|
-
if (!replacementss) {
|
|
35
|
-
replacementss = [
|
|
36
|
-
[tnp_config_1.TAGS.BACKEND_FUNC, "return (void 0);"],
|
|
37
|
-
tnp_config_1.TAGS.BACKEND,
|
|
38
|
-
];
|
|
39
|
-
}
|
|
40
|
-
return new RegionRemover(realtiveOrAbsFilePAth, fileExtension, content, replacementss, project);
|
|
41
|
-
};
|
|
42
|
-
RegionRemover.prototype.matchStartRegion = function (l) {
|
|
43
|
-
var res = !tnp_core_1._.isUndefined(this.START_REGION.find(function (r) { return l.match(r); }));
|
|
44
|
-
return res;
|
|
45
|
-
};
|
|
46
|
-
RegionRemover.prototype.matchEndRegion = function (l) {
|
|
47
|
-
var res = !tnp_core_1._.isUndefined(this.END_REGION.find(function (r) { return l.match(r); }));
|
|
48
|
-
return res;
|
|
49
|
-
};
|
|
50
|
-
RegionRemover.prototype.tree = function (node) {
|
|
51
|
-
var contentLines = node.contentLines;
|
|
54
|
+
tree(node) {
|
|
55
|
+
const contentLines = node.contentLines;
|
|
52
56
|
// if (contentLines.length <= 3) {
|
|
53
57
|
// for (let i = 0; i < contentLines.length; i++) {
|
|
54
58
|
// const l = contentLines[i];
|
|
55
59
|
// node.addNormalLine(l, i);
|
|
56
60
|
// }
|
|
57
61
|
// } else {
|
|
58
|
-
|
|
59
|
-
for (
|
|
60
|
-
|
|
62
|
+
let stack = 0;
|
|
63
|
+
for (let i = 0; i < contentLines.length; i++) {
|
|
64
|
+
const l = contentLines[i];
|
|
61
65
|
if (!node.isRoot) {
|
|
62
66
|
if (i === 0) {
|
|
63
67
|
node.addNormalLine(l, 0);
|
|
@@ -105,22 +109,17 @@ var RegionRemover = /** @class */ (function () {
|
|
|
105
109
|
}
|
|
106
110
|
}
|
|
107
111
|
// }
|
|
108
|
-
|
|
112
|
+
const children = node.regions;
|
|
109
113
|
if (children.length > 0) {
|
|
110
|
-
for (
|
|
111
|
-
|
|
114
|
+
for (let index = 0; index < children.length; index++) {
|
|
115
|
+
const child = children[index];
|
|
112
116
|
this.tree(child);
|
|
113
117
|
}
|
|
114
118
|
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
enumerable: false,
|
|
121
|
-
configurable: true
|
|
122
|
-
});
|
|
123
|
-
return RegionRemover;
|
|
124
|
-
}());
|
|
119
|
+
}
|
|
120
|
+
get output() {
|
|
121
|
+
return this.root.toString();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
125
124
|
exports.RegionRemover = RegionRemover;
|
|
126
125
|
//# sourceMappingURL=region-remover.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"region-remover.js","sourceRoot":"","sources":[""],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"region-remover.js","sourceRoot":"","sources":["/Users/dfilipiak/projects/npm/taon-dev/isomorphic-region-loader/src/lib/region-remover.ts"],"names":[],"mappings":";;;AAAA,uCAAmC;AAGnC,qCAAkC;AAGlC,2CAAgD;AAGhD,MAAa,aAAa;IAiCN;IAER;IAEQ;IApCV,IAAI,CAAS;IACJ,YAAY,GAAa,EAAE,CAAC;IAC5B,UAAU,GAAa,EAAE,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
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Region = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
const tnp_core_1 = require("tnp-core");
|
|
5
|
+
const models_1 = require("./models");
|
|
6
|
+
const tnp_config_1 = require("tnp-config");
|
|
7
|
+
class Region {
|
|
8
|
+
context;
|
|
9
|
+
replacementss;
|
|
10
|
+
parent;
|
|
11
|
+
startIndex;
|
|
12
|
+
endIndex;
|
|
13
|
+
lineStart;
|
|
14
|
+
lineEnd;
|
|
15
|
+
contentLines;
|
|
16
|
+
constructor(context, replacementss, parent, startIndex, endIndex, lineStart, lineEnd, contentLines = []) {
|
|
10
17
|
this.context = context;
|
|
11
18
|
this.replacementss = replacementss;
|
|
12
19
|
this.parent = parent;
|
|
@@ -15,138 +22,118 @@ var Region = /** @class */ (function () {
|
|
|
15
22
|
this.lineStart = lineStart;
|
|
16
23
|
this.lineEnd = lineEnd;
|
|
17
24
|
this.contentLines = contentLines;
|
|
18
|
-
this.regionsOrStrings = [];
|
|
19
25
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
configurable: true
|
|
37
|
-
});
|
|
38
|
-
Object.defineProperty(Region.prototype, "regions", {
|
|
39
|
-
get: function () {
|
|
40
|
-
return this.regionsOrStrings.filter(function (f) { return f instanceof Region; });
|
|
41
|
-
},
|
|
42
|
-
enumerable: false,
|
|
43
|
-
configurable: true
|
|
44
|
-
});
|
|
45
|
-
Region.prototype.setEnd = function (endIndex, lineEnd) {
|
|
26
|
+
tmpOutput;
|
|
27
|
+
get hasEnd() {
|
|
28
|
+
return this.endIndex !== void 0;
|
|
29
|
+
}
|
|
30
|
+
get lastRegionWithoutEnd() {
|
|
31
|
+
const last = tnp_core_1._.last(this.regionsOrStrings);
|
|
32
|
+
if (last instanceof Region && !last.hasEnd) {
|
|
33
|
+
return last;
|
|
34
|
+
}
|
|
35
|
+
return void 0;
|
|
36
|
+
}
|
|
37
|
+
regionsOrStrings = [];
|
|
38
|
+
get regions() {
|
|
39
|
+
return this.regionsOrStrings.filter(f => f instanceof Region);
|
|
40
|
+
}
|
|
41
|
+
setEnd(endIndex, lineEnd) {
|
|
46
42
|
this.endIndex = endIndex;
|
|
47
43
|
this.lineEnd = lineEnd;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
enumerable: false,
|
|
54
|
-
configurable: true
|
|
55
|
-
});
|
|
56
|
-
Region.prototype.addNormalLine = function (l, lineIndex) {
|
|
44
|
+
}
|
|
45
|
+
get isRoot() {
|
|
46
|
+
return !this.parent;
|
|
47
|
+
}
|
|
48
|
+
addNormalLine(l, lineIndex) {
|
|
57
49
|
this.contentLines[lineIndex] = void 0;
|
|
58
50
|
this.regionsOrStrings.push(l);
|
|
59
|
-
}
|
|
60
|
-
|
|
51
|
+
}
|
|
52
|
+
addNormalLineToLastRegion(l, lineIndex) {
|
|
61
53
|
this.contentLines[lineIndex] = void 0;
|
|
62
54
|
this.lastRegionWithoutEnd.contentLines.push(l);
|
|
63
|
-
}
|
|
64
|
-
|
|
55
|
+
}
|
|
56
|
+
addRegion(context, parent, startIndex, lineStart) {
|
|
65
57
|
this.contentLines[startIndex] = void 0;
|
|
66
|
-
|
|
58
|
+
const newReg = new Region(context, this.replacementss, parent, startIndex, void 0, lineStart, void 0, [lineStart]);
|
|
67
59
|
this.regionsOrStrings.push(newReg);
|
|
68
|
-
}
|
|
69
|
-
|
|
60
|
+
}
|
|
61
|
+
endLastRegion(endIndex, lineEnd) {
|
|
70
62
|
this.contentLines[endIndex] = void 0;
|
|
71
|
-
|
|
63
|
+
const regionWithoutEnd = this.regionsOrStrings.find(r => r instanceof Region && !r.hasEnd);
|
|
72
64
|
regionWithoutEnd.contentLines.push(lineEnd);
|
|
73
65
|
regionWithoutEnd.setEnd(endIndex, lineEnd);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
66
|
+
}
|
|
67
|
+
containsTitle(s) {
|
|
68
|
+
const res = (this.titleString.search(s) !== -1);
|
|
77
69
|
// Helpers.log(`checking tag (${res}): "${s}" in line: "${this.titleString}"`)
|
|
78
70
|
return res;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
enumerable: false,
|
|
91
|
-
configurable: true
|
|
92
|
-
});
|
|
93
|
-
Region.prototype.toString = function () {
|
|
94
|
-
var _this = this;
|
|
71
|
+
}
|
|
72
|
+
get titleString() {
|
|
73
|
+
let line = this.lineStart;
|
|
74
|
+
const regionWord = '#region';
|
|
75
|
+
const indexOfRegion = line.search(regionWord);
|
|
76
|
+
line = line.replace(line.slice(0, indexOfRegion + regionWord.length), '');
|
|
77
|
+
return line
|
|
78
|
+
.replace('-->', '')
|
|
79
|
+
.replace('<!--', ''); // TODO not necessery ?
|
|
80
|
+
}
|
|
81
|
+
toString() {
|
|
95
82
|
if (this.tmpOutput !== void 0) {
|
|
96
83
|
return this.tmpOutput;
|
|
97
84
|
}
|
|
98
|
-
|
|
85
|
+
let previous = '';
|
|
99
86
|
this.tmpOutput = this.regionsOrStrings
|
|
100
|
-
.map(
|
|
87
|
+
.map(regionOrString => {
|
|
101
88
|
if (regionOrString instanceof Region) {
|
|
102
89
|
//#region handle region
|
|
103
|
-
|
|
104
|
-
for (
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
90
|
+
const replacements = this.replacementss;
|
|
91
|
+
for (let index = 0; index < replacements.length; index++) {
|
|
92
|
+
const rep = replacements[index];
|
|
93
|
+
const isArr = tnp_core_1._.isArray(replacements[index]);
|
|
94
|
+
const regionTag = (isArr ? tnp_core_1._.first(rep) : rep);
|
|
95
|
+
let out = (isArr ? rep[1] : '');
|
|
96
|
+
const verticalLength = regionOrString.toString().split('\n').length - 1;
|
|
110
97
|
if (regionOrString.containsTitle(regionTag)) {
|
|
111
98
|
if (regionTag.toLowerCase() === tnp_config_1.TAGS.WEBSQL.toLowerCase()) {
|
|
112
|
-
out =
|
|
99
|
+
out = `${tnp_core_1._.times(verticalLength).map(() => models_1.labelReplacementCode.backendCode + '\n').join('')} ${out}`;
|
|
113
100
|
}
|
|
114
101
|
if (regionTag.toLowerCase() === tnp_config_1.TAGS.BACKEND.toLowerCase()) {
|
|
115
|
-
out =
|
|
102
|
+
out = `${tnp_core_1._.times(verticalLength).map(() => models_1.labelReplacementCode.backendCode + '\n').join('')} ${out}`;
|
|
116
103
|
}
|
|
117
104
|
if (regionTag.toLowerCase() === tnp_config_1.TAGS.NOT_FOR_NPM.toLowerCase()) {
|
|
118
|
-
out =
|
|
105
|
+
out = `${tnp_core_1._.times(verticalLength).map(() => models_1.labelReplacementCode.notForNpmCode + '\n').join('')} ${out}`;
|
|
119
106
|
}
|
|
120
107
|
if (regionTag.toLowerCase() === tnp_config_1.TAGS.BROWSER.toLowerCase()) {
|
|
121
|
-
out =
|
|
108
|
+
out = `${tnp_core_1._.times(verticalLength).map(() => models_1.labelReplacementCode.browserCode + '\n').join('')} ${out}`;
|
|
122
109
|
}
|
|
123
110
|
if (regionTag.toLowerCase() === tnp_config_1.TAGS.WEBSQL_ONLY.toLowerCase()) {
|
|
124
|
-
out =
|
|
111
|
+
out = `${tnp_core_1._.times(verticalLength).map(() => models_1.labelReplacementCode.backendCode + '\n').join('')} ${out}`;
|
|
125
112
|
}
|
|
126
113
|
if (regionTag.toLowerCase() === tnp_config_1.TAGS.BACKEND_FUNC.toLowerCase()) {
|
|
127
|
-
|
|
114
|
+
let spacesPrevious = previous.search(/\S/);
|
|
128
115
|
spacesPrevious = (spacesPrevious < 0 ? 0 : spacesPrevious);
|
|
129
|
-
out =
|
|
130
|
-
+
|
|
116
|
+
out = `${tnp_core_1._.times(verticalLength).map(() => models_1.labelReplacementCode.backendCode + '\n').join('')}`
|
|
117
|
+
+ `${tnp_core_1._.times(spacesPrevious).map(n => ' ').join('')} ${out}`;
|
|
131
118
|
}
|
|
132
119
|
if (regionTag.toLowerCase() === tnp_config_1.TAGS.WEBSQL_FUNC.toLowerCase()) {
|
|
133
|
-
|
|
120
|
+
let spacesPrevious = previous.search(/\S/);
|
|
134
121
|
spacesPrevious = (spacesPrevious < 0 ? 0 : spacesPrevious);
|
|
135
|
-
out =
|
|
136
|
-
+
|
|
122
|
+
out = `${tnp_core_1._.times(verticalLength).map(() => models_1.labelReplacementCode.backendCode + '\n').join('')}`
|
|
123
|
+
+ `${tnp_core_1._.times(spacesPrevious).map(n => ' ').join('')} ${out}`;
|
|
137
124
|
}
|
|
138
125
|
if (regionTag.toLowerCase() === tnp_config_1.TAGS.CUT_CODE_IF_TRUE.toLowerCase()
|
|
139
126
|
||
|
|
140
127
|
regionTag.toLowerCase() === tnp_config_1.TAGS.CUT_CODE_IF_FALSE.toLowerCase()) {
|
|
141
|
-
|
|
142
|
-
|
|
128
|
+
const fn = out; // as ReturnType<typeof codeCuttFn>;
|
|
129
|
+
let expressionToExecute = regionOrString.titleString;
|
|
143
130
|
// Helpers.log(`LINE: "${regionOrString.lineStart}"`);
|
|
144
131
|
expressionToExecute = expressionToExecute.replace(regionTag, '');
|
|
145
132
|
// Helpers.log(`Expresion to evaluate "${expressionToExecute}"`);
|
|
146
133
|
// Helpers.log(`this.project "${this.project.name}"`);
|
|
147
|
-
|
|
134
|
+
const configForProject = this.project && this.project.env.config;
|
|
148
135
|
// Helpers.log(`configForProject "${configForProject}"`);
|
|
149
|
-
|
|
136
|
+
const cutCode = fn(expressionToExecute, configForProject, this.realtiveOrAbsFilePAth);
|
|
150
137
|
// Helpers.info(`Cut code: "${cutCode}"`);
|
|
151
138
|
if (cutCode === null) {
|
|
152
139
|
continue;
|
|
@@ -166,27 +153,18 @@ var Region = /** @class */ (function () {
|
|
|
166
153
|
}
|
|
167
154
|
//#endregion
|
|
168
155
|
}
|
|
169
|
-
|
|
156
|
+
const res = regionOrString.toString();
|
|
170
157
|
previous = res;
|
|
171
158
|
return res;
|
|
172
159
|
}).join('\n');
|
|
173
160
|
return this.tmpOutput;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
Object.defineProperty(Region.prototype, "realtiveOrAbsFilePAth", {
|
|
183
|
-
get: function () {
|
|
184
|
-
return this.context.realtiveOrAbsFilePAth;
|
|
185
|
-
},
|
|
186
|
-
enumerable: false,
|
|
187
|
-
configurable: true
|
|
188
|
-
});
|
|
189
|
-
return Region;
|
|
190
|
-
}());
|
|
161
|
+
}
|
|
162
|
+
get project() {
|
|
163
|
+
return this.context.project;
|
|
164
|
+
}
|
|
165
|
+
get realtiveOrAbsFilePAth() {
|
|
166
|
+
return this.context.realtiveOrAbsFilePAth;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
191
169
|
exports.Region = Region;
|
|
192
170
|
//# sourceMappingURL=region.js.map
|