isomorphic-region-loader 21.0.24 → 21.0.26
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/browser/package.json +1 -1
- package/browser-prod/fesm2022/isomorphic-region-loader-browser.mjs.map +1 -1
- package/browser-prod/package.json +1 -1
- package/lib/build-info._auto-generated_.d.ts +1 -1
- package/lib/build-info._auto-generated_.js +1 -1
- package/lib/package.json +1 -1
- package/lib-prod/build-info._auto-generated_.ts +27 -0
- package/lib-prod/env/env.angular-node-app.ts +66 -0
- package/lib-prod/env/env.docs-webapp.ts +66 -0
- package/lib-prod/env/env.electron-app.ts +66 -0
- package/lib-prod/env/env.mobile-app.ts +66 -0
- package/lib-prod/env/env.npm-lib-and-cli-tool.ts +66 -0
- package/lib-prod/env/env.vscode-plugin.ts +66 -0
- package/lib-prod/{index._auto-generated_.js → index._auto-generated_.ts} +0 -1
- package/lib-prod/index.ts +24 -0
- package/lib-prod/lib-info.md +8 -0
- package/lib-prod/migrations/index.ts +2 -0
- package/lib-prod/migrations/migrations-info.md +6 -0
- package/lib-prod/migrations/{migrations_index._auto-generated_.js → migrations_index._auto-generated_.ts} +2 -1
- package/lib-prod/models.ts +31 -0
- package/lib-prod/package.json +1 -1
- package/lib-prod/region-remover.ts +159 -0
- package/lib-prod/region.ts +235 -0
- package/package.json +1 -1
- package/websql/package.json +1 -1
- package/websql-prod/fesm2022/isomorphic-region-loader-websql.mjs.map +1 -1
- package/websql-prod/package.json +1 -1
- package/lib-prod/build-info._auto-generated_.d.ts +0 -24
- package/lib-prod/build-info._auto-generated_.js +0 -30
- package/lib-prod/build-info._auto-generated_.js.map +0 -1
- package/lib-prod/env/env.angular-node-app.d.ts +0 -64
- package/lib-prod/env/env.angular-node-app.js +0 -71
- package/lib-prod/env/env.angular-node-app.js.map +0 -1
- package/lib-prod/env/env.docs-webapp.d.ts +0 -64
- package/lib-prod/env/env.docs-webapp.js +0 -71
- package/lib-prod/env/env.docs-webapp.js.map +0 -1
- package/lib-prod/env/env.electron-app.d.ts +0 -64
- package/lib-prod/env/env.electron-app.js +0 -71
- package/lib-prod/env/env.electron-app.js.map +0 -1
- package/lib-prod/env/env.mobile-app.d.ts +0 -64
- package/lib-prod/env/env.mobile-app.js +0 -71
- package/lib-prod/env/env.mobile-app.js.map +0 -1
- package/lib-prod/env/env.npm-lib-and-cli-tool.d.ts +0 -64
- package/lib-prod/env/env.npm-lib-and-cli-tool.js +0 -71
- package/lib-prod/env/env.npm-lib-and-cli-tool.js.map +0 -1
- package/lib-prod/env/env.vscode-plugin.d.ts +0 -64
- package/lib-prod/env/env.vscode-plugin.js +0 -71
- package/lib-prod/env/env.vscode-plugin.js.map +0 -1
- package/lib-prod/env/index.js +0 -23
- package/lib-prod/env/index.js.map +0 -1
- package/lib-prod/index._auto-generated_.d.ts +0 -0
- package/lib-prod/index._auto-generated_.js.map +0 -1
- package/lib-prod/index.d.ts +0 -6
- package/lib-prod/index.js +0 -34
- package/lib-prod/index.js.map +0 -1
- package/lib-prod/migrations/index.d.ts +0 -1
- package/lib-prod/migrations/index.js +0 -19
- package/lib-prod/migrations/index.js.map +0 -1
- package/lib-prod/migrations/migrations_index._auto-generated_.d.ts +0 -0
- package/lib-prod/migrations/migrations_index._auto-generated_.js.map +0 -1
- package/lib-prod/models.d.ts +0 -14
- package/lib-prod/models.js +0 -18
- package/lib-prod/models.js.map +0 -1
- package/lib-prod/region-remover.d.ts +0 -15
- package/lib-prod/region-remover.js +0 -130
- package/lib-prod/region-remover.js.map +0 -1
- package/lib-prod/region.d.ts +0 -29
- package/lib-prod/region.js +0 -194
- package/lib-prod/region.js.map +0 -1
- /package/lib-prod/env/{index.d.ts → index.ts} +0 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// THIS FILE IS GENERATED - DO NOT MODIFY
|
|
2
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_WEBSITE_DOMAIN = 'isomorphic-region-loader.example.domain.com';
|
|
3
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_WEBSITE_TITLE = 'Isomorphic Region Loader';
|
|
4
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_TARGET_ARTIFACT = 'npm-lib-and-cli-tool';
|
|
5
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_ENV_NAME = '__';
|
|
6
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_CONTAINER_ONLY = undefined;
|
|
7
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_CONTAINER_END = undefined;
|
|
8
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_CONTAINER_START = undefined;
|
|
9
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_CONTAINER_SKIP_RELEASED = undefined;
|
|
10
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_CONTAINER_SKIP = undefined;
|
|
11
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_INIT_BRANDING = undefined;
|
|
12
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_INIT_STRUCT = undefined;
|
|
13
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_BUILD_PWA_DISABLE_SERVICE_WORKER = undefined;
|
|
14
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_BUILD_PWA_NAME = undefined;
|
|
15
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_BUILD_PWA_SHORT_NAME = undefined;
|
|
16
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_BUILD_PWA_START_URL = undefined;
|
|
17
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_BUILD_ELECTRON_SHOW_DEV_TOOLS = undefined;
|
|
18
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_BUILD_SSR = undefined;
|
|
19
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_BUILD_WEBSQL = undefined;
|
|
20
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_BUILD_PROD = undefined;
|
|
21
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_BUILD_OVERRIDE_OUTPUT_PATH = undefined;
|
|
22
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_BUILD_BASE_HREF = undefined;
|
|
23
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_BUILD_WATCH = undefined;
|
|
24
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_BUILD_GEN_ONLY_CLIENT_CODE = undefined;
|
|
25
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_LOADING_PRE_ANGULAR_BOOTSTRAP_LOADER = undefined;
|
|
26
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_LOADING_PRE_ANGULAR_BOOTSTRAP_BACKGROUND = undefined;
|
|
27
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_CLI_MINIFY = undefined;
|
|
28
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_CLI_INCLUDE_NODE_MODULES = undefined;
|
|
29
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_CLI_UGLIFY = undefined;
|
|
30
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_CLI_OBSCURE = undefined;
|
|
31
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_CLI_COMPRESS = undefined;
|
|
32
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_NODE_BACKEND_APP_MINIFY = undefined;
|
|
33
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_LIB_REMOVE_DTS = undefined;
|
|
34
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_LIB_OBSCURE_FILE_BY_FILE = undefined;
|
|
35
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_LIB_UGLIFY_FILE_BY_FILE = undefined;
|
|
36
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_LIB_INCLUDE_SOURCE_MAPS = undefined;
|
|
37
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_LIB_COMPRESS = undefined;
|
|
38
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_LIB_DO_NOT_INCLUDE_LIB_FILES = undefined;
|
|
39
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_RESOLVED_NEW_VERSION = undefined;
|
|
40
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_RELEASE_VERSION_BUMP_TYPE = undefined;
|
|
41
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_ENV_NUMBER = undefined;
|
|
42
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_INSTALL_LOCALLY = undefined;
|
|
43
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_REMOVE_RELEASE_OUTPUT_AFTER_LOCAL_INSTALL = undefined;
|
|
44
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_RELEASE_TYPE = undefined;
|
|
45
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_AUTO_RELEASE_USING_CONFIG = undefined;
|
|
46
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_AUTO_RELEASE_TASK_NAME = undefined;
|
|
47
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_TAON_INSTANCE_IP = undefined;
|
|
48
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_SKIP_NPM_PUBLISH = undefined;
|
|
49
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_SKIP_DEPLOY = undefined;
|
|
50
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_SKIP_TAG_GIT_PUSH = undefined;
|
|
51
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_SKIP_RELEASE_QUESTION = undefined;
|
|
52
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_SKIP_RESOLVING_GIT_CHANGES = undefined;
|
|
53
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_SKIP_CODE_CUTTING = undefined;
|
|
54
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_RELEASE_SKIP_BUILDING_ARTIFACTS = undefined;
|
|
55
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_COPY_TO_MANAGER_BEFORE_COPY_HOOK = undefined;
|
|
56
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_COPY_TO_MANAGER_COPY_TO_LOCATIONS = undefined;
|
|
57
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_COPY_TO_MANAGER_COPY_TO_PROJECTS = undefined;
|
|
58
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_COPY_TO_MANAGER_SKIP = undefined;
|
|
59
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_WEBSITE_USE_DOMAIN = undefined;
|
|
60
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_PURPOSE = undefined;
|
|
61
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_RECURSIVE_ACTION = undefined;
|
|
62
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_IS_CI_PROCESS = undefined;
|
|
63
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_DOCKER_ADDITIONAL_CONTAINER = undefined;
|
|
64
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_DOCKER_SKIP_START_IN_ORDER = undefined;
|
|
65
|
+
export const ENV_NPM_LIB_AND_CLI_TOOL_DOCKER_SKIP_USING_MYSQL_DB = undefined;
|
|
66
|
+
// THIS FILE IS GENERATED - DO NOT MODIFY
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// THIS FILE IS GENERATED - DO NOT MODIFY
|
|
2
|
+
export const ENV_VSCODE_PLUGIN_WEBSITE_DOMAIN = 'isomorphic-region-loader.example.domain.com';
|
|
3
|
+
export const ENV_VSCODE_PLUGIN_WEBSITE_TITLE = 'Isomorphic Region Loader';
|
|
4
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_TARGET_ARTIFACT = 'vscode-plugin';
|
|
5
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_ENV_NAME = '__';
|
|
6
|
+
export const ENV_VSCODE_PLUGIN_CONTAINER_ONLY = undefined;
|
|
7
|
+
export const ENV_VSCODE_PLUGIN_CONTAINER_END = undefined;
|
|
8
|
+
export const ENV_VSCODE_PLUGIN_CONTAINER_START = undefined;
|
|
9
|
+
export const ENV_VSCODE_PLUGIN_CONTAINER_SKIP_RELEASED = undefined;
|
|
10
|
+
export const ENV_VSCODE_PLUGIN_CONTAINER_SKIP = undefined;
|
|
11
|
+
export const ENV_VSCODE_PLUGIN_INIT_BRANDING = undefined;
|
|
12
|
+
export const ENV_VSCODE_PLUGIN_INIT_STRUCT = undefined;
|
|
13
|
+
export const ENV_VSCODE_PLUGIN_BUILD_PWA_DISABLE_SERVICE_WORKER = undefined;
|
|
14
|
+
export const ENV_VSCODE_PLUGIN_BUILD_PWA_NAME = undefined;
|
|
15
|
+
export const ENV_VSCODE_PLUGIN_BUILD_PWA_SHORT_NAME = undefined;
|
|
16
|
+
export const ENV_VSCODE_PLUGIN_BUILD_PWA_START_URL = undefined;
|
|
17
|
+
export const ENV_VSCODE_PLUGIN_BUILD_ELECTRON_SHOW_DEV_TOOLS = undefined;
|
|
18
|
+
export const ENV_VSCODE_PLUGIN_BUILD_SSR = undefined;
|
|
19
|
+
export const ENV_VSCODE_PLUGIN_BUILD_WEBSQL = undefined;
|
|
20
|
+
export const ENV_VSCODE_PLUGIN_BUILD_PROD = undefined;
|
|
21
|
+
export const ENV_VSCODE_PLUGIN_BUILD_OVERRIDE_OUTPUT_PATH = undefined;
|
|
22
|
+
export const ENV_VSCODE_PLUGIN_BUILD_BASE_HREF = undefined;
|
|
23
|
+
export const ENV_VSCODE_PLUGIN_BUILD_WATCH = undefined;
|
|
24
|
+
export const ENV_VSCODE_PLUGIN_BUILD_GEN_ONLY_CLIENT_CODE = undefined;
|
|
25
|
+
export const ENV_VSCODE_PLUGIN_LOADING_PRE_ANGULAR_BOOTSTRAP_LOADER = undefined;
|
|
26
|
+
export const ENV_VSCODE_PLUGIN_LOADING_PRE_ANGULAR_BOOTSTRAP_BACKGROUND = undefined;
|
|
27
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_CLI_MINIFY = undefined;
|
|
28
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_CLI_INCLUDE_NODE_MODULES = undefined;
|
|
29
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_CLI_UGLIFY = undefined;
|
|
30
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_CLI_OBSCURE = undefined;
|
|
31
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_CLI_COMPRESS = undefined;
|
|
32
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_NODE_BACKEND_APP_MINIFY = undefined;
|
|
33
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_LIB_REMOVE_DTS = undefined;
|
|
34
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_LIB_OBSCURE_FILE_BY_FILE = undefined;
|
|
35
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_LIB_UGLIFY_FILE_BY_FILE = undefined;
|
|
36
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_LIB_INCLUDE_SOURCE_MAPS = undefined;
|
|
37
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_LIB_COMPRESS = undefined;
|
|
38
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_LIB_DO_NOT_INCLUDE_LIB_FILES = undefined;
|
|
39
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_RESOLVED_NEW_VERSION = undefined;
|
|
40
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_RELEASE_VERSION_BUMP_TYPE = undefined;
|
|
41
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_ENV_NUMBER = undefined;
|
|
42
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_INSTALL_LOCALLY = undefined;
|
|
43
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_REMOVE_RELEASE_OUTPUT_AFTER_LOCAL_INSTALL = undefined;
|
|
44
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_RELEASE_TYPE = undefined;
|
|
45
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_AUTO_RELEASE_USING_CONFIG = undefined;
|
|
46
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_AUTO_RELEASE_TASK_NAME = undefined;
|
|
47
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_TAON_INSTANCE_IP = undefined;
|
|
48
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_SKIP_NPM_PUBLISH = undefined;
|
|
49
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_SKIP_DEPLOY = undefined;
|
|
50
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_SKIP_TAG_GIT_PUSH = undefined;
|
|
51
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_SKIP_RELEASE_QUESTION = undefined;
|
|
52
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_SKIP_RESOLVING_GIT_CHANGES = undefined;
|
|
53
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_SKIP_CODE_CUTTING = undefined;
|
|
54
|
+
export const ENV_VSCODE_PLUGIN_RELEASE_SKIP_BUILDING_ARTIFACTS = undefined;
|
|
55
|
+
export const ENV_VSCODE_PLUGIN_COPY_TO_MANAGER_BEFORE_COPY_HOOK = undefined;
|
|
56
|
+
export const ENV_VSCODE_PLUGIN_COPY_TO_MANAGER_COPY_TO_LOCATIONS = undefined;
|
|
57
|
+
export const ENV_VSCODE_PLUGIN_COPY_TO_MANAGER_COPY_TO_PROJECTS = undefined;
|
|
58
|
+
export const ENV_VSCODE_PLUGIN_COPY_TO_MANAGER_SKIP = undefined;
|
|
59
|
+
export const ENV_VSCODE_PLUGIN_WEBSITE_USE_DOMAIN = undefined;
|
|
60
|
+
export const ENV_VSCODE_PLUGIN_PURPOSE = undefined;
|
|
61
|
+
export const ENV_VSCODE_PLUGIN_RECURSIVE_ACTION = undefined;
|
|
62
|
+
export const ENV_VSCODE_PLUGIN_IS_CI_PROCESS = undefined;
|
|
63
|
+
export const ENV_VSCODE_PLUGIN_DOCKER_ADDITIONAL_CONTAINER = undefined;
|
|
64
|
+
export const ENV_VSCODE_PLUGIN_DOCKER_SKIP_START_IN_ORDER = undefined;
|
|
65
|
+
export const ENV_VSCODE_PLUGIN_DOCKER_SKIP_USING_MYSQL_DB = undefined;
|
|
66
|
+
// THIS FILE IS GENERATED - DO NOT MODIFY
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//#region imports
|
|
2
|
+
import { RegionRemover } from './region-remover';
|
|
3
|
+
//#endregion
|
|
4
|
+
|
|
5
|
+
export * from './models';
|
|
6
|
+
|
|
7
|
+
function StripBrowserCode(content) {
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
content =
|
|
10
|
+
RegionRemover.from(this.resourcePath, content, ['@browser']).output + '\n';
|
|
11
|
+
|
|
12
|
+
if (this.cacheable) {
|
|
13
|
+
this.cacheable(true);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return content;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { StripBrowserCode as StripBlockLoader };
|
|
20
|
+
|
|
21
|
+
export * from './region-remover';
|
|
22
|
+
export * from './region';
|
|
23
|
+
|
|
24
|
+
export default StripBrowserCode;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export const labelReplacementCode = {
|
|
2
|
+
browserCode: '/* */', // '/* browser code */',
|
|
3
|
+
backendCode: '/* */', // '/* backend code */',
|
|
4
|
+
notForNpmCode: '/* */', //'/* not for npm lib code */',
|
|
5
|
+
onlyForGithubDocs: '/* */', // '/* only for github docs */',
|
|
6
|
+
flatenImportExportRequred: '/* */', // '/* only for github docs */',
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export type ReplacementString =
|
|
10
|
+
| '@backend'
|
|
11
|
+
| '@backendFunc'
|
|
12
|
+
| '@cutCodeIfTrue'
|
|
13
|
+
| '@cutCodeIfFalse'
|
|
14
|
+
| '@notForNpm';
|
|
15
|
+
export const ReplacementStringArr = [
|
|
16
|
+
'@bac' + 'kend',
|
|
17
|
+
'@bac' + 'kendFunc',
|
|
18
|
+
'@cut' + 'CodeIfTrue',
|
|
19
|
+
'@cut' + 'CodeIfFalse',
|
|
20
|
+
"@not'+'ForNpm",
|
|
21
|
+
] as ReplacementString[];
|
|
22
|
+
|
|
23
|
+
export type Replacement<EnvConfig = any> =
|
|
24
|
+
| ReplacementString
|
|
25
|
+
| [ReplacementString, string]
|
|
26
|
+
| [ReplacementString, (expression: any, env: EnvConfig) => () => boolean];
|
|
27
|
+
|
|
28
|
+
export interface ReplaceOptionsExtended<EnvConfig = any> {
|
|
29
|
+
replacements: Replacement[];
|
|
30
|
+
env?: EnvConfig;
|
|
31
|
+
}
|
package/lib-prod/package.json
CHANGED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
//#region imports
|
|
2
|
+
import { REGEX_REGION, TAGS } from 'tnp-core/lib-prod';
|
|
3
|
+
import { path, ___NS__add, ___NS__after, ___NS__ary, ___NS__assign, ___NS__assignIn, ___NS__assignInWith, ___NS__assignWith, ___NS__at, ___NS__attempt, ___NS__before, ___NS__bind, ___NS__bindAll, ___NS__bindKey, ___NS__camelCase, ___NS__capitalize, ___NS__castArray, ___NS__ceil, ___NS__chain, ___NS__chunk, ___NS__clamp, ___NS__clone, ___NS__cloneDeep, ___NS__cloneDeepWith, ___NS__cloneWith, ___NS__compact, ___NS__concat, ___NS__cond, ___NS__conforms, ___NS__conformsTo, ___NS__constant, ___NS__countBy, ___NS__create, ___NS__curry, ___NS__curryRight, ___NS__debounce, ___NS__deburr, ___NS__defaults, ___NS__defaultsDeep, ___NS__defaultTo, ___NS__defer, ___NS__delay, ___NS__difference, ___NS__differenceBy, ___NS__differenceWith, ___NS__divide, ___NS__drop, ___NS__dropRight, ___NS__dropRightWhile, ___NS__dropWhile, ___NS__each, ___NS__eachRight, ___NS__endsWith, ___NS__entries, ___NS__entriesIn, ___NS__eq, ___NS__escape, ___NS__escapeRegExp, ___NS__every, ___NS__extend, ___NS__extendWith, ___NS__fill, ___NS__filter, ___NS__find, ___NS__findIndex, ___NS__findKey, ___NS__findLast, ___NS__findLastIndex, ___NS__findLastKey, ___NS__first, ___NS__flatMap, ___NS__flatMapDeep, ___NS__flatMapDepth, ___NS__flatten, ___NS__flattenDeep, ___NS__flattenDepth, ___NS__flip, ___NS__floor, ___NS__flow, ___NS__flowRight, ___NS__forEach, ___NS__forEachRight, ___NS__forIn, ___NS__forInRight, ___NS__forOwn, ___NS__forOwnRight, ___NS__fromPairs, ___NS__functions, ___NS__functionsIn, ___NS__get, ___NS__groupBy, ___NS__gt, ___NS__gte, ___NS__has, ___NS__hasIn, ___NS__head, ___NS__identity, ___NS__includes, ___NS__indexOf, ___NS__initial, ___NS__inRange, ___NS__intersection, ___NS__intersectionBy, ___NS__intersectionWith, ___NS__invert, ___NS__invertBy, ___NS__invoke, ___NS__invokeMap, ___NS__isArguments, ___NS__isArray, ___NS__isArrayBuffer, ___NS__isArrayLike, ___NS__isArrayLikeObject, ___NS__isBoolean, ___NS__isBuffer, ___NS__isDate, ___NS__isElement, ___NS__isEmpty, ___NS__isEqual, ___NS__isEqualWith, ___NS__isError, ___NS__isFinite, ___NS__isFunction, ___NS__isInteger, ___NS__isLength, ___NS__isMap, ___NS__isMatch, ___NS__isMatchWith, ___NS__isNaN, ___NS__isNative, ___NS__isNil, ___NS__isNull, ___NS__isNumber, ___NS__isObject, ___NS__isObjectLike, ___NS__isPlainObject, ___NS__isRegExp, ___NS__isSafeInteger, ___NS__isSet, ___NS__isString, ___NS__isSymbol, ___NS__isTypedArray, ___NS__isUndefined, ___NS__isWeakMap, ___NS__isWeakSet, ___NS__iteratee, ___NS__join, ___NS__kebabCase, ___NS__keyBy, ___NS__keys, ___NS__keysIn, ___NS__last, ___NS__lastIndexOf, ___NS__lowerCase, ___NS__lowerFirst, ___NS__lt, ___NS__lte, ___NS__map, ___NS__mapKeys, ___NS__mapValues, ___NS__matches, ___NS__matchesProperty, ___NS__max, ___NS__maxBy, ___NS__mean, ___NS__meanBy, ___NS__memoize, ___NS__merge, ___NS__mergeWith, ___NS__method, ___NS__methodOf, ___NS__min, ___NS__minBy, ___NS__mixin, ___NS__multiply, ___NS__negate, ___NS__noop, ___NS__now, ___NS__nth, ___NS__nthArg, ___NS__omit, ___NS__omitBy, ___NS__once, ___NS__orderBy, ___NS__over, ___NS__overArgs, ___NS__overEvery, ___NS__overSome, ___NS__pad, ___NS__padEnd, ___NS__padStart, ___NS__parseInt, ___NS__partial, ___NS__partialRight, ___NS__partition, ___NS__pick, ___NS__pickBy, ___NS__property, ___NS__propertyOf, ___NS__pull, ___NS__pullAll, ___NS__pullAllBy, ___NS__pullAllWith, ___NS__pullAt, ___NS__random, ___NS__range, ___NS__rangeRight, ___NS__rearg, ___NS__reduce, ___NS__reduceRight, ___NS__reject, ___NS__remove, ___NS__repeat, ___NS__replace, ___NS__rest, ___NS__result, ___NS__reverse, ___NS__round, ___NS__sample, ___NS__sampleSize, ___NS__set, ___NS__setWith, ___NS__shuffle, ___NS__size, ___NS__slice, ___NS__snakeCase, ___NS__some, ___NS__sortBy, ___NS__sortedIndex, ___NS__sortedIndexBy, ___NS__sortedIndexOf, ___NS__sortedLastIndex, ___NS__sortedLastIndexBy, ___NS__sortedLastIndexOf, ___NS__sortedUniq, ___NS__sortedUniqBy, ___NS__split, ___NS__spread, ___NS__startCase, ___NS__startsWith, ___NS__stubArray, ___NS__stubFalse, ___NS__stubObject, ___NS__stubString, ___NS__stubTrue, ___NS__subtract, ___NS__sum, ___NS__sumBy, ___NS__tail, ___NS__take, ___NS__takeRight, ___NS__takeRightWhile, ___NS__takeWhile, ___NS__tap, ___NS__template, ___NS__templateSettings, ___NS__throttle, ___NS__thru, ___NS__times, ___NS__toArray, ___NS__toFinite, ___NS__toInteger, ___NS__toLength, ___NS__toLower, ___NS__toNumber, ___NS__toPairs, ___NS__toPairsIn, ___NS__toPath, ___NS__toPlainObject, ___NS__toSafeInteger, ___NS__toString, ___NS__toUpper, ___NS__transform, ___NS__trim, ___NS__trimEnd, ___NS__trimStart, ___NS__truncate, ___NS__unary, ___NS__unescape, ___NS__union, ___NS__unionBy, ___NS__unionWith, ___NS__uniq, ___NS__uniqBy, ___NS__uniqueId, ___NS__uniqWith, ___NS__unset, ___NS__unzip, ___NS__unzipWith, ___NS__update, ___NS__updateWith, ___NS__upperCase, ___NS__upperFirst, ___NS__values, ___NS__valuesIn, ___NS__without, ___NS__words, ___NS__wrap, ___NS__xor, ___NS__xorBy, ___NS__xorWith, ___NS__zip, ___NS__zipObject, ___NS__zipObjectDeep, ___NS__zipWith } from 'tnp-core/lib-prod';
|
|
4
|
+
import { Helpers__NS___fixCommand, Helpers__NS__bigMaxBuffer, Helpers__NS__checkProcess, Helpers__NS__cleanExit, Helpers__NS__clearConsole, Helpers__NS__command, Helpers__NS__commandOutputAsString, Helpers__NS__commandOutputAsStringAsync, Helpers__NS__compilationWrapper, Helpers__NS__contain, Helpers__NS__createFolder, Helpers__NS__createSymLink, Helpers__NS__error, Helpers__NS__execute, Helpers__NS__exists, Helpers__NS__filesFrom, Helpers__NS__foldersFrom, Helpers__NS__getFilesFrom, Helpers__NS__getFoldersFrom, Helpers__NS__getIsBrowser, Helpers__NS__getIsElectron, Helpers__NS__getIsNode, Helpers__NS__getIsRunningInGitBash, Helpers__NS__getIsSupportedTaonTerminal, Helpers__NS__getIsVerboseMode, Helpers__NS__getIsWebSQL, Helpers__NS__getIsWsl, Helpers__NS__getStdio, Helpers__NS__hideNodeWarnings, Helpers__NS__info, Helpers__NS__isBlob, Helpers__NS__isBuffer, Helpers__NS__isClass, Helpers__NS__isExistedSymlink, Helpers__NS__isFile, Helpers__NS__isFolder, Helpers__NS__isRunningInDocker, Helpers__NS__isRunningInLinuxGraphicsCapableEnvironment, Helpers__NS__isSymlinkFileExitedOrUnexisted, Helpers__NS__isSymlinkThatMatchesUrl, Helpers__NS__isUnexistedLink, Helpers__NS__killOnPort, Helpers__NS__killProcess, Helpers__NS__killProcessByPort, Helpers__NS__linksToFolderFrom, Helpers__NS__linksToFoldersFrom, Helpers__NS__log, Helpers__NS__logError, Helpers__NS__logInfo, Helpers__NS__logProc, Helpers__NS__logSuccess, Helpers__NS__logWarn, Helpers__NS__mediaTypeFromSrc, Helpers__NS__mkdirp, Helpers__NS__modifyLineByLine, Helpers__NS__msgCacheClear, Helpers__NS__openFolderInFileExplorer, Helpers__NS__parse, Helpers__NS__pathContainLink, Helpers__NS__questionYesNo, Helpers__NS__readFile, Helpers__NS__readJson, Helpers__NS__readJson5, Helpers__NS__readJsonC, Helpers__NS__relative, Helpers__NS__remove, Helpers__NS__removeEmptyLineFromString, Helpers__NS__removeFileIfExists, Helpers__NS__removeFolderIfExists, Helpers__NS__removeIfExists, Helpers__NS__removeSlashAtBegin, Helpers__NS__removeSlashAtEnd, Helpers__NS__removeSymlinks, Helpers__NS__renderError, Helpers__NS__replaceLinesInFile, Helpers__NS__run, Helpers__NS__runAsyncIn, Helpers__NS__runSyncIn, Helpers__NS__runSyncOrAsync, Helpers__NS__sleep, Helpers__NS__stopApplication, Helpers__NS__stringify, Helpers__NS__success, Helpers__NS__taskDone, Helpers__NS__taskStarted, Helpers__NS__throwError, Helpers__NS__timeout, Helpers__NS__tryCatchError, Helpers__NS__tryReadFile, Helpers__NS__tryRemoveDir, Helpers__NS__values, Helpers__NS__wait, Helpers__NS__warn, Helpers__NS__writeFile, Helpers__NS__writeJson, Helpers__NS__writeJson5, Helpers__NS__writeJsonC } from 'tnp-core/lib-prod';
|
|
5
|
+
import { CoreModels__NS__BaseProjectType, CoreModels__NS__BaseProjectTypeArr, CoreModels__NS__CfontAlign, CoreModels__NS__CfontStyle, CoreModels__NS__ClassNameStaticProperty, CoreModels__NS__ContentType, CoreModels__NS__ContentTypeKeys, CoreModels__NS__CoreLibCategory, CoreModels__NS__CutableFileExt, CoreModels__NS__DatabaseType, CoreModels__NS__EnvironmentName, CoreModels__NS__EnvironmentNameTaon, CoreModels__NS__ExecuteOptions, CoreModels__NS__FileEvent, CoreModels__NS__FileExtension, CoreModels__NS__FrameworkVersion, CoreModels__NS__GlobalDependencies, CoreModels__NS__HttpMethod, CoreModels__NS__ImageFileExtension, CoreModels__NS__ImageFileExtensionArr, CoreModels__NS__InstalationType, CoreModels__NS__InstalationTypeArr, CoreModels__NS__LibType, CoreModels__NS__localhostDomain, CoreModels__NS__localhostIp127, CoreModels__NS__ManifestIcon, CoreModels__NS__MediaType, CoreModels__NS__MediaTypeAllArr, CoreModels__NS__MimeType, CoreModels__NS__mimeTypes, CoreModels__NS__MimeTypesObj, CoreModels__NS__NewFactoryType, CoreModels__NS__NpmInstallOptions, CoreModels__NS__NpmSpecialVersions, CoreModels__NS__OrignalClassKey, CoreModels__NS__OutFolder, CoreModels__NS__Package, CoreModels__NS__ParamType, CoreModels__NS__parentLocation, CoreModels__NS__pathToChildren, CoreModels__NS__Position, CoreModels__NS__PreReleaseVersionTag, CoreModels__NS__PROGRESS_DATA_TYPE, CoreModels__NS__PUSHTYPE, CoreModels__NS__PwaManifest, CoreModels__NS__ReleaseVersionType, CoreModels__NS__ReleaseVersionTypeEnum, CoreModels__NS__RunOptions, CoreModels__NS__Size, CoreModels__NS__SPECIAL_APP_READY_MESSAGE, CoreModels__NS__SPECIAL_WORKER_READY_MESSAGE, CoreModels__NS__tagForTaskName, CoreModels__NS__TaonHttpErrorCustomProp, CoreModels__NS__TsUsage, CoreModels__NS__UIFramework, CoreModels__NS__UploadedBackendFile, CoreModels__NS__VSCodeSettings } from 'tnp-core/lib-prod';
|
|
6
|
+
import { UtilsTypescript__NS__addBelowPlaceholder, UtilsTypescript__NS__addOrUpdateImportIfNotExists, UtilsTypescript__NS__calculateRelativeImportPath, UtilsTypescript__NS__clearRequireCacheRecursive, UtilsTypescript__NS__collapseFluentChains, UtilsTypescript__NS__DeepWritable, UtilsTypescript__NS__eslintFixAllFilesInsideFolder, UtilsTypescript__NS__eslintFixAllFilesInsideFolderAsync, UtilsTypescript__NS__eslintFixFile, UtilsTypescript__NS__ExportedThirdPartyNamespaces, UtilsTypescript__NS__ExportInfo, UtilsTypescript__NS__exportsFromContent, UtilsTypescript__NS__exportsFromFile, UtilsTypescript__NS__exportsRedefinedFromContent, UtilsTypescript__NS__exportsRedefinedFromFile, UtilsTypescript__NS__extractAngularComponentSelectors, UtilsTypescript__NS__extractClassNameFromString, UtilsTypescript__NS__extractClassNamesFromFile, UtilsTypescript__NS__extractDefaultClassNameFromFile, UtilsTypescript__NS__extractDefaultClassNameFromString, UtilsTypescript__NS__extractRenamedImportsOrExport, UtilsTypescript__NS__fixHtmlTemplatesInDir, UtilsTypescript__NS__FlattenMapping, UtilsTypescript__NS__formatAllFilesInsideFolder, UtilsTypescript__NS__formatFile, UtilsTypescript__NS__GatheredExportsMap, UtilsTypescript__NS__gatherExportsMapFromIndex, UtilsTypescript__NS__getCleanImport, UtilsTypescript__NS__getTaonContextFromContent, UtilsTypescript__NS__getTaonContextsNamesFromFile, UtilsTypescript__NS__hoistTrailingChainComments, UtilsTypescript__NS__injectImportsIntoImportsRegion, UtilsTypescript__NS__migrateFromNgModulesToStandaloneV21, UtilsTypescript__NS__normalizeBrokenLines, UtilsTypescript__NS__NSSPLITNAMESAPCE, UtilsTypescript__NS__ParsedTsDiagnostic, UtilsTypescript__NS__parseTsDiagnostic, UtilsTypescript__NS__recognizeImportsFromContent, UtilsTypescript__NS__recognizeImportsFromFile, UtilsTypescript__NS__RedefinedExportInfo, UtilsTypescript__NS__refactorClassToNamespace, UtilsTypescript__NS__removeRegionByName, UtilsTypescript__NS__removeTaggedArrayObjects, UtilsTypescript__NS__removeTaggedImportExport, UtilsTypescript__NS__removeTaggedLines, UtilsTypescript__NS__RenamedImportOrExport, UtilsTypescript__NS__replaceImportNamespaceWithWithExplodedNamespace, UtilsTypescript__NS__replaceNamespaceWithLongNames, UtilsTypescript__NS__setValueToVariableInTsFile, UtilsTypescript__NS__splitNamespaceForContent, UtilsTypescript__NS__splitNamespaceForFile, UtilsTypescript__NS__SplitNamespaceResult, UtilsTypescript__NS__transformComponentStandaloneOption, UtilsTypescript__NS__transformFlatImports, UtilsTypescript__NS__TsImportExport, UtilsTypescript__NS__updateSplitNamespaceReExports, UtilsTypescript__NS__updateSplitNamespaceResultMapReplaceObj, UtilsTypescript__NS__wrapContentClassMembersDecoratorsWithRegion, UtilsTypescript__NS__wrapFirstImportsInImportsRegion, UtilsTypescript__NS__wrapWithComment } from 'tnp-helpers/lib-prod';
|
|
7
|
+
|
|
8
|
+
import { Region } from './region';
|
|
9
|
+
//#endregion
|
|
10
|
+
|
|
11
|
+
export class RegionRemover {
|
|
12
|
+
private root: Region;
|
|
13
|
+
|
|
14
|
+
private readonly START_REGION: RegExp[] = [];
|
|
15
|
+
|
|
16
|
+
private readonly END_REGION: RegExp[] = [];
|
|
17
|
+
|
|
18
|
+
public static from(
|
|
19
|
+
realtiveOrAbsFilePAth: string,
|
|
20
|
+
content: string,
|
|
21
|
+
replacementss?: any, // Models.dev.Replacement[],
|
|
22
|
+
project?: any, // Project,
|
|
23
|
+
// debug = false,
|
|
24
|
+
) {
|
|
25
|
+
let fileExtension = path.extname(realtiveOrAbsFilePAth);
|
|
26
|
+
|
|
27
|
+
if (!replacementss) {
|
|
28
|
+
replacementss = [
|
|
29
|
+
[TAGS.BACKEND_FUNC, `return (void 0);`],
|
|
30
|
+
TAGS.BACKEND as any,
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
return new RegionRemover(
|
|
34
|
+
realtiveOrAbsFilePAth,
|
|
35
|
+
fileExtension as any,
|
|
36
|
+
content,
|
|
37
|
+
replacementss,
|
|
38
|
+
project,
|
|
39
|
+
// debug,
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
private matchStartRegion(l: string) {
|
|
44
|
+
const res = !___NS__isUndefined(this.START_REGION.find(r => l.match(r)));
|
|
45
|
+
return res;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
private matchEndRegion(l: string) {
|
|
49
|
+
const res = !___NS__isUndefined(this.END_REGION.find(r => l.match(r)));
|
|
50
|
+
return res;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
private constructor(
|
|
54
|
+
public readonly realtiveOrAbsFilePAth: string,
|
|
55
|
+
fileExtension: CoreModels__NS__CutableFileExt,
|
|
56
|
+
private content: string,
|
|
57
|
+
replacementss?: any, // Models.dev.Replacement[],
|
|
58
|
+
public readonly project?: any, // Project
|
|
59
|
+
// public readonly debug = false,
|
|
60
|
+
) {
|
|
61
|
+
if (REGEX_REGION.TS_JS_SCSS_SASS.EXT.includes(fileExtension)) {
|
|
62
|
+
this.START_REGION.push(REGEX_REGION.TS_JS_SCSS_SASS.START);
|
|
63
|
+
this.END_REGION.push(REGEX_REGION.TS_JS_SCSS_SASS.END);
|
|
64
|
+
}
|
|
65
|
+
if (REGEX_REGION.HTML.EXT.includes(fileExtension)) {
|
|
66
|
+
this.START_REGION.push(REGEX_REGION.HTML.START);
|
|
67
|
+
this.END_REGION.push(REGEX_REGION.HTML.END);
|
|
68
|
+
}
|
|
69
|
+
if (REGEX_REGION.CSS.EXT.includes(fileExtension)) {
|
|
70
|
+
this.START_REGION.push(REGEX_REGION.CSS.START);
|
|
71
|
+
this.END_REGION.push(REGEX_REGION.CSS.END);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
this.content =
|
|
75
|
+
UtilsTypescript__NS__removeTaggedImportExport(
|
|
76
|
+
this.content,
|
|
77
|
+
replacementss,
|
|
78
|
+
// debug,
|
|
79
|
+
) || '';
|
|
80
|
+
|
|
81
|
+
const lines = this.content.split('\n');
|
|
82
|
+
this.root = new Region(
|
|
83
|
+
this,
|
|
84
|
+
replacementss,
|
|
85
|
+
void 0,
|
|
86
|
+
0,
|
|
87
|
+
lines.length - 1,
|
|
88
|
+
___NS__first(lines),
|
|
89
|
+
___NS__last(lines),
|
|
90
|
+
lines,
|
|
91
|
+
);
|
|
92
|
+
this.tree(this.root);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
private tree(node: Region) {
|
|
96
|
+
const contentLines = node.contentLines;
|
|
97
|
+
// if (contentLines.length <= 3) {
|
|
98
|
+
// for (let i = 0; i < contentLines.length; i++) {
|
|
99
|
+
// const l = contentLines[i];
|
|
100
|
+
// node.addNormalLine(l, i);
|
|
101
|
+
// }
|
|
102
|
+
// } else {
|
|
103
|
+
let stack = 0;
|
|
104
|
+
for (let i = 0; i < contentLines.length; i++) {
|
|
105
|
+
const l = contentLines[i];
|
|
106
|
+
if (!node.isRoot) {
|
|
107
|
+
if (i === 0) {
|
|
108
|
+
node.addNormalLine(l, 0);
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
if (i === node.contentLines.length - 1) {
|
|
112
|
+
node.addNormalLine(l, i);
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
if (node.lastRegionWithoutEnd) {
|
|
117
|
+
if (this.matchStartRegion(l)) {
|
|
118
|
+
node.addNormalLineToLastRegion(l, i);
|
|
119
|
+
stack++;
|
|
120
|
+
} else if (this.matchEndRegion(l)) {
|
|
121
|
+
if (stack === 0) {
|
|
122
|
+
node.endLastRegion(i, l);
|
|
123
|
+
} else if (stack > 0) {
|
|
124
|
+
node.addNormalLineToLastRegion(l, i);
|
|
125
|
+
stack--;
|
|
126
|
+
}
|
|
127
|
+
} else {
|
|
128
|
+
if (i === node.contentLines.length - (node.isRoot ? 1 : 2)) {
|
|
129
|
+
stack = 0;
|
|
130
|
+
node.endLastRegion(i, l);
|
|
131
|
+
} else {
|
|
132
|
+
node.addNormalLineToLastRegion(l, i);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
} else {
|
|
136
|
+
if (this.matchStartRegion(l)) {
|
|
137
|
+
node.addRegion(this, node, i, l);
|
|
138
|
+
} else if (this.matchEndRegion(l)) {
|
|
139
|
+
node.addNormalLine(l, i);
|
|
140
|
+
} else {
|
|
141
|
+
node.addNormalLine(l, i);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
// }
|
|
146
|
+
|
|
147
|
+
const children = node.regions;
|
|
148
|
+
if (children.length > 0) {
|
|
149
|
+
for (let index = 0; index < children.length; index++) {
|
|
150
|
+
const child = children[index] as Region;
|
|
151
|
+
this.tree(child);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
get output() {
|
|
157
|
+
return this.root.toString();
|
|
158
|
+
}
|
|
159
|
+
}
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
//#region imports
|
|
2
|
+
import { ___NS__add, ___NS__after, ___NS__ary, ___NS__assign, ___NS__assignIn, ___NS__assignInWith, ___NS__assignWith, ___NS__at, ___NS__attempt, ___NS__before, ___NS__bind, ___NS__bindAll, ___NS__bindKey, ___NS__camelCase, ___NS__capitalize, ___NS__castArray, ___NS__ceil, ___NS__chain, ___NS__chunk, ___NS__clamp, ___NS__clone, ___NS__cloneDeep, ___NS__cloneDeepWith, ___NS__cloneWith, ___NS__compact, ___NS__concat, ___NS__cond, ___NS__conforms, ___NS__conformsTo, ___NS__constant, ___NS__countBy, ___NS__create, ___NS__curry, ___NS__curryRight, ___NS__debounce, ___NS__deburr, ___NS__defaults, ___NS__defaultsDeep, ___NS__defaultTo, ___NS__defer, ___NS__delay, ___NS__difference, ___NS__differenceBy, ___NS__differenceWith, ___NS__divide, ___NS__drop, ___NS__dropRight, ___NS__dropRightWhile, ___NS__dropWhile, ___NS__each, ___NS__eachRight, ___NS__endsWith, ___NS__entries, ___NS__entriesIn, ___NS__eq, ___NS__escape, ___NS__escapeRegExp, ___NS__every, ___NS__extend, ___NS__extendWith, ___NS__fill, ___NS__filter, ___NS__find, ___NS__findIndex, ___NS__findKey, ___NS__findLast, ___NS__findLastIndex, ___NS__findLastKey, ___NS__first, ___NS__flatMap, ___NS__flatMapDeep, ___NS__flatMapDepth, ___NS__flatten, ___NS__flattenDeep, ___NS__flattenDepth, ___NS__flip, ___NS__floor, ___NS__flow, ___NS__flowRight, ___NS__forEach, ___NS__forEachRight, ___NS__forIn, ___NS__forInRight, ___NS__forOwn, ___NS__forOwnRight, ___NS__fromPairs, ___NS__functions, ___NS__functionsIn, ___NS__get, ___NS__groupBy, ___NS__gt, ___NS__gte, ___NS__has, ___NS__hasIn, ___NS__head, ___NS__identity, ___NS__includes, ___NS__indexOf, ___NS__initial, ___NS__inRange, ___NS__intersection, ___NS__intersectionBy, ___NS__intersectionWith, ___NS__invert, ___NS__invertBy, ___NS__invoke, ___NS__invokeMap, ___NS__isArguments, ___NS__isArray, ___NS__isArrayBuffer, ___NS__isArrayLike, ___NS__isArrayLikeObject, ___NS__isBoolean, ___NS__isBuffer, ___NS__isDate, ___NS__isElement, ___NS__isEmpty, ___NS__isEqual, ___NS__isEqualWith, ___NS__isError, ___NS__isFinite, ___NS__isFunction, ___NS__isInteger, ___NS__isLength, ___NS__isMap, ___NS__isMatch, ___NS__isMatchWith, ___NS__isNaN, ___NS__isNative, ___NS__isNil, ___NS__isNull, ___NS__isNumber, ___NS__isObject, ___NS__isObjectLike, ___NS__isPlainObject, ___NS__isRegExp, ___NS__isSafeInteger, ___NS__isSet, ___NS__isString, ___NS__isSymbol, ___NS__isTypedArray, ___NS__isUndefined, ___NS__isWeakMap, ___NS__isWeakSet, ___NS__iteratee, ___NS__join, ___NS__kebabCase, ___NS__keyBy, ___NS__keys, ___NS__keysIn, ___NS__last, ___NS__lastIndexOf, ___NS__lowerCase, ___NS__lowerFirst, ___NS__lt, ___NS__lte, ___NS__map, ___NS__mapKeys, ___NS__mapValues, ___NS__matches, ___NS__matchesProperty, ___NS__max, ___NS__maxBy, ___NS__mean, ___NS__meanBy, ___NS__memoize, ___NS__merge, ___NS__mergeWith, ___NS__method, ___NS__methodOf, ___NS__min, ___NS__minBy, ___NS__mixin, ___NS__multiply, ___NS__negate, ___NS__noop, ___NS__now, ___NS__nth, ___NS__nthArg, ___NS__omit, ___NS__omitBy, ___NS__once, ___NS__orderBy, ___NS__over, ___NS__overArgs, ___NS__overEvery, ___NS__overSome, ___NS__pad, ___NS__padEnd, ___NS__padStart, ___NS__parseInt, ___NS__partial, ___NS__partialRight, ___NS__partition, ___NS__pick, ___NS__pickBy, ___NS__property, ___NS__propertyOf, ___NS__pull, ___NS__pullAll, ___NS__pullAllBy, ___NS__pullAllWith, ___NS__pullAt, ___NS__random, ___NS__range, ___NS__rangeRight, ___NS__rearg, ___NS__reduce, ___NS__reduceRight, ___NS__reject, ___NS__remove, ___NS__repeat, ___NS__replace, ___NS__rest, ___NS__result, ___NS__reverse, ___NS__round, ___NS__sample, ___NS__sampleSize, ___NS__set, ___NS__setWith, ___NS__shuffle, ___NS__size, ___NS__slice, ___NS__snakeCase, ___NS__some, ___NS__sortBy, ___NS__sortedIndex, ___NS__sortedIndexBy, ___NS__sortedIndexOf, ___NS__sortedLastIndex, ___NS__sortedLastIndexBy, ___NS__sortedLastIndexOf, ___NS__sortedUniq, ___NS__sortedUniqBy, ___NS__split, ___NS__spread, ___NS__startCase, ___NS__startsWith, ___NS__stubArray, ___NS__stubFalse, ___NS__stubObject, ___NS__stubString, ___NS__stubTrue, ___NS__subtract, ___NS__sum, ___NS__sumBy, ___NS__tail, ___NS__take, ___NS__takeRight, ___NS__takeRightWhile, ___NS__takeWhile, ___NS__tap, ___NS__template, ___NS__templateSettings, ___NS__throttle, ___NS__thru, ___NS__times, ___NS__toArray, ___NS__toFinite, ___NS__toInteger, ___NS__toLength, ___NS__toLower, ___NS__toNumber, ___NS__toPairs, ___NS__toPairsIn, ___NS__toPath, ___NS__toPlainObject, ___NS__toSafeInteger, ___NS__toString, ___NS__toUpper, ___NS__transform, ___NS__trim, ___NS__trimEnd, ___NS__trimStart, ___NS__truncate, ___NS__unary, ___NS__unescape, ___NS__union, ___NS__unionBy, ___NS__unionWith, ___NS__uniq, ___NS__uniqBy, ___NS__uniqueId, ___NS__uniqWith, ___NS__unset, ___NS__unzip, ___NS__unzipWith, ___NS__update, ___NS__updateWith, ___NS__upperCase, ___NS__upperFirst, ___NS__values, ___NS__valuesIn, ___NS__without, ___NS__words, ___NS__wrap, ___NS__xor, ___NS__xorBy, ___NS__xorWith, ___NS__zip, ___NS__zipObject, ___NS__zipObjectDeep, ___NS__zipWith, Helpers__NS___fixCommand, Helpers__NS__bigMaxBuffer, Helpers__NS__checkProcess, Helpers__NS__cleanExit, Helpers__NS__clearConsole, Helpers__NS__command, Helpers__NS__commandOutputAsString, Helpers__NS__commandOutputAsStringAsync, Helpers__NS__compilationWrapper, Helpers__NS__contain, Helpers__NS__createFolder, Helpers__NS__createSymLink, Helpers__NS__error, Helpers__NS__execute, Helpers__NS__exists, Helpers__NS__filesFrom, Helpers__NS__foldersFrom, Helpers__NS__getFilesFrom, Helpers__NS__getFoldersFrom, Helpers__NS__getIsBrowser, Helpers__NS__getIsElectron, Helpers__NS__getIsNode, Helpers__NS__getIsRunningInGitBash, Helpers__NS__getIsSupportedTaonTerminal, Helpers__NS__getIsVerboseMode, Helpers__NS__getIsWebSQL, Helpers__NS__getIsWsl, Helpers__NS__getStdio, Helpers__NS__hideNodeWarnings, Helpers__NS__info, Helpers__NS__isBlob, Helpers__NS__isBuffer, Helpers__NS__isClass, Helpers__NS__isExistedSymlink, Helpers__NS__isFile, Helpers__NS__isFolder, Helpers__NS__isRunningInDocker, Helpers__NS__isRunningInLinuxGraphicsCapableEnvironment, Helpers__NS__isSymlinkFileExitedOrUnexisted, Helpers__NS__isSymlinkThatMatchesUrl, Helpers__NS__isUnexistedLink, Helpers__NS__killOnPort, Helpers__NS__killProcess, Helpers__NS__killProcessByPort, Helpers__NS__linksToFolderFrom, Helpers__NS__linksToFoldersFrom, Helpers__NS__log, Helpers__NS__logError, Helpers__NS__logInfo, Helpers__NS__logProc, Helpers__NS__logSuccess, Helpers__NS__logWarn, Helpers__NS__mediaTypeFromSrc, Helpers__NS__mkdirp, Helpers__NS__modifyLineByLine, Helpers__NS__msgCacheClear, Helpers__NS__openFolderInFileExplorer, Helpers__NS__parse, Helpers__NS__pathContainLink, Helpers__NS__questionYesNo, Helpers__NS__readFile, Helpers__NS__readJson, Helpers__NS__readJson5, Helpers__NS__readJsonC, Helpers__NS__relative, Helpers__NS__remove, Helpers__NS__removeEmptyLineFromString, Helpers__NS__removeFileIfExists, Helpers__NS__removeFolderIfExists, Helpers__NS__removeIfExists, Helpers__NS__removeSlashAtBegin, Helpers__NS__removeSlashAtEnd, Helpers__NS__removeSymlinks, Helpers__NS__renderError, Helpers__NS__replaceLinesInFile, Helpers__NS__run, Helpers__NS__runAsyncIn, Helpers__NS__runSyncIn, Helpers__NS__runSyncOrAsync, Helpers__NS__sleep, Helpers__NS__stopApplication, Helpers__NS__stringify, Helpers__NS__success, Helpers__NS__taskDone, Helpers__NS__taskStarted, Helpers__NS__throwError, Helpers__NS__timeout, Helpers__NS__tryCatchError, Helpers__NS__tryReadFile, Helpers__NS__tryRemoveDir, Helpers__NS__values, Helpers__NS__wait, Helpers__NS__warn, Helpers__NS__writeFile, Helpers__NS__writeJson, Helpers__NS__writeJson5, Helpers__NS__writeJsonC } from 'tnp-core/lib-prod';
|
|
3
|
+
import { TAGS } from 'tnp-core/lib-prod';
|
|
4
|
+
|
|
5
|
+
import { Replacement, ReplacementString, labelReplacementCode } from './models';
|
|
6
|
+
// import { codeCuttFn } from '../code-cut';
|
|
7
|
+
import type { RegionRemover } from './region-remover';
|
|
8
|
+
//#endregion
|
|
9
|
+
|
|
10
|
+
export class Region {
|
|
11
|
+
constructor(
|
|
12
|
+
private context: RegionRemover,
|
|
13
|
+
public replacementss: Replacement[],
|
|
14
|
+
public parent: Region,
|
|
15
|
+
public startIndex: number,
|
|
16
|
+
public endIndex: number,
|
|
17
|
+
public lineStart: string,
|
|
18
|
+
public lineEnd: string,
|
|
19
|
+
public contentLines: string[] = [],
|
|
20
|
+
) {}
|
|
21
|
+
|
|
22
|
+
private tmpOutput: string;
|
|
23
|
+
|
|
24
|
+
public get hasEnd() {
|
|
25
|
+
return this.endIndex !== void 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
public get lastRegionWithoutEnd() {
|
|
29
|
+
const last = ___NS__last(this.regionsOrStrings);
|
|
30
|
+
if (last instanceof Region && !last.hasEnd) {
|
|
31
|
+
return last;
|
|
32
|
+
}
|
|
33
|
+
return void 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
private regionsOrStrings: (Region | string)[] = [];
|
|
37
|
+
|
|
38
|
+
get regions() {
|
|
39
|
+
return this.regionsOrStrings.filter(f => f instanceof Region);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
private setEnd(endIndex: number, lineEnd: string) {
|
|
43
|
+
this.endIndex = endIndex;
|
|
44
|
+
this.lineEnd = lineEnd;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
get isRoot() {
|
|
48
|
+
return !this.parent;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
addNormalLine(l: string, lineIndex: number) {
|
|
52
|
+
this.contentLines[lineIndex] = void 0;
|
|
53
|
+
this.regionsOrStrings.push(l);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
addNormalLineToLastRegion(l: string, lineIndex: number) {
|
|
57
|
+
this.contentLines[lineIndex] = void 0;
|
|
58
|
+
this.lastRegionWithoutEnd.contentLines.push(l);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
addRegion(
|
|
62
|
+
context: RegionRemover,
|
|
63
|
+
parent: Region,
|
|
64
|
+
startIndex: number,
|
|
65
|
+
lineStart: string,
|
|
66
|
+
) {
|
|
67
|
+
this.contentLines[startIndex] = void 0;
|
|
68
|
+
const newReg = new Region(
|
|
69
|
+
context,
|
|
70
|
+
this.replacementss,
|
|
71
|
+
parent,
|
|
72
|
+
startIndex,
|
|
73
|
+
void 0,
|
|
74
|
+
lineStart,
|
|
75
|
+
void 0,
|
|
76
|
+
[lineStart],
|
|
77
|
+
);
|
|
78
|
+
this.regionsOrStrings.push(newReg);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
endLastRegion(endIndex: number, lineEnd: string) {
|
|
82
|
+
this.contentLines[endIndex] = void 0;
|
|
83
|
+
const regionWithoutEnd = this.regionsOrStrings.find(
|
|
84
|
+
r => r instanceof Region && !r.hasEnd,
|
|
85
|
+
) as Region;
|
|
86
|
+
regionWithoutEnd.contentLines.push(lineEnd);
|
|
87
|
+
regionWithoutEnd.setEnd(endIndex, lineEnd);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
private containsTitle(s: ReplacementString) {
|
|
91
|
+
const res = this.titleString.search(s) !== -1;
|
|
92
|
+
// Helpers__NS__log(`checking tag (${res}): "${s}" in line: "${this.titleString}"`)
|
|
93
|
+
return res;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
private get titleString() {
|
|
97
|
+
let line = this.lineStart;
|
|
98
|
+
const regionWord = '#region';
|
|
99
|
+
const indexOfRegion = line.search(regionWord);
|
|
100
|
+
line = line.replace(line.slice(0, indexOfRegion + regionWord.length), '');
|
|
101
|
+
return line.replace('-->', '').replace('<!--', ''); // TODO not necessery ?
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
public toString() {
|
|
105
|
+
if (this.tmpOutput !== void 0) {
|
|
106
|
+
return this.tmpOutput;
|
|
107
|
+
}
|
|
108
|
+
let previous = '';
|
|
109
|
+
this.tmpOutput = this.regionsOrStrings
|
|
110
|
+
.map(regionOrString => {
|
|
111
|
+
if (regionOrString instanceof Region) {
|
|
112
|
+
//#region handle region
|
|
113
|
+
const replacements = this.replacementss;
|
|
114
|
+
for (let index = 0; index < replacements.length; index++) {
|
|
115
|
+
const rep = replacements[index];
|
|
116
|
+
const isArr = ___NS__isArray(replacements[index]);
|
|
117
|
+
|
|
118
|
+
const regionTag = (
|
|
119
|
+
isArr ? ___NS__first(rep as string[]) : rep
|
|
120
|
+
) as ReplacementString;
|
|
121
|
+
|
|
122
|
+
let out = (isArr ? rep[1] : '') as string;
|
|
123
|
+
|
|
124
|
+
const verticalLength =
|
|
125
|
+
regionOrString.toString().split('\n').length - 1;
|
|
126
|
+
|
|
127
|
+
if (regionOrString.containsTitle(regionTag)) {
|
|
128
|
+
if (regionTag.toLowerCase() === TAGS.WEBSQL.toLowerCase()) {
|
|
129
|
+
out = `${___NS__times(verticalLength)
|
|
130
|
+
.map(() => labelReplacementCode.backendCode + '\n')
|
|
131
|
+
.join('')} ${out}`;
|
|
132
|
+
}
|
|
133
|
+
if (regionTag.toLowerCase() === TAGS.BACKEND.toLowerCase()) {
|
|
134
|
+
out = `${___NS__times(verticalLength)
|
|
135
|
+
.map(() => labelReplacementCode.backendCode + '\n')
|
|
136
|
+
.join('')} ${out}`;
|
|
137
|
+
}
|
|
138
|
+
if (regionTag.toLowerCase() === TAGS.NOT_FOR_NPM.toLowerCase()) {
|
|
139
|
+
out = `${___NS__times(verticalLength)
|
|
140
|
+
.map(() => labelReplacementCode.notForNpmCode + '\n')
|
|
141
|
+
.join('')} ${out}`;
|
|
142
|
+
}
|
|
143
|
+
if (regionTag.toLowerCase() === TAGS.BROWSER.toLowerCase()) {
|
|
144
|
+
out = `${___NS__times(verticalLength)
|
|
145
|
+
.map(() => labelReplacementCode.browserCode + '\n')
|
|
146
|
+
.join('')} ${out}`;
|
|
147
|
+
}
|
|
148
|
+
if (regionTag.toLowerCase() === TAGS.WEBSQL_ONLY.toLowerCase()) {
|
|
149
|
+
out = `${___NS__times(verticalLength)
|
|
150
|
+
.map(() => labelReplacementCode.backendCode + '\n')
|
|
151
|
+
.join('')} ${out}`;
|
|
152
|
+
}
|
|
153
|
+
if (regionTag.toLowerCase() === TAGS.BACKEND_FUNC.toLowerCase()) {
|
|
154
|
+
let spacesPrevious = previous.search(/\S/);
|
|
155
|
+
spacesPrevious = spacesPrevious < 0 ? 0 : spacesPrevious;
|
|
156
|
+
out =
|
|
157
|
+
`${___NS__times(verticalLength)
|
|
158
|
+
.map(() => labelReplacementCode.backendCode + '\n')
|
|
159
|
+
.join('')}` +
|
|
160
|
+
`${___NS__times(spacesPrevious)
|
|
161
|
+
.map(n => ' ')
|
|
162
|
+
.join('')} ${out}`;
|
|
163
|
+
}
|
|
164
|
+
if (regionTag.toLowerCase() === TAGS.WEBSQL_FUNC.toLowerCase()) {
|
|
165
|
+
let spacesPrevious = previous.search(/\S/);
|
|
166
|
+
spacesPrevious = spacesPrevious < 0 ? 0 : spacesPrevious;
|
|
167
|
+
out =
|
|
168
|
+
`${___NS__times(verticalLength)
|
|
169
|
+
.map(() => labelReplacementCode.backendCode + '\n')
|
|
170
|
+
.join('')}` +
|
|
171
|
+
`${___NS__times(spacesPrevious)
|
|
172
|
+
.map(n => ' ')
|
|
173
|
+
.join('')} ${out}`;
|
|
174
|
+
}
|
|
175
|
+
if (
|
|
176
|
+
regionTag.toLowerCase() ===
|
|
177
|
+
TAGS.CUT_CODE_IF_TRUE.toLowerCase() ||
|
|
178
|
+
regionTag.toLowerCase() === TAGS.CUT_CODE_IF_FALSE.toLowerCase()
|
|
179
|
+
) {
|
|
180
|
+
const fn = out as any; // as ReturnType<typeof codeCuttFn>;
|
|
181
|
+
let expressionToExecute = regionOrString.titleString;
|
|
182
|
+
// Helpers__NS__log(`LINE: "${regionOrString.lineStart}"`);
|
|
183
|
+
expressionToExecute = expressionToExecute.replace(
|
|
184
|
+
regionTag,
|
|
185
|
+
'',
|
|
186
|
+
);
|
|
187
|
+
// Helpers__NS__log(`Expresion to evaluate "${expressionToExecute}"`);
|
|
188
|
+
// Helpers__NS__log(`this.project "${this.project.name}"`);
|
|
189
|
+
const configForProject =
|
|
190
|
+
this.project && this.project.env.config;
|
|
191
|
+
// Helpers__NS__log(`configForProject "${configForProject}"`);
|
|
192
|
+
const cutCode = fn(
|
|
193
|
+
expressionToExecute,
|
|
194
|
+
configForProject,
|
|
195
|
+
this.realtiveOrAbsFilePAth,
|
|
196
|
+
);
|
|
197
|
+
// Helpers__NS__info(`Cut code: "${cutCode}"`);
|
|
198
|
+
if (cutCode === null) {
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
if (
|
|
202
|
+
(cutCode &&
|
|
203
|
+
regionTag.toLowerCase() ===
|
|
204
|
+
TAGS.CUT_CODE_IF_TRUE.toLowerCase()) ||
|
|
205
|
+
(!cutCode &&
|
|
206
|
+
regionTag.toLowerCase() ===
|
|
207
|
+
TAGS.CUT_CODE_IF_FALSE.toLowerCase())
|
|
208
|
+
) {
|
|
209
|
+
out = '';
|
|
210
|
+
} else {
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
regionOrString.tmpOutput = out;
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
//#endregion
|
|
219
|
+
}
|
|
220
|
+
const res = regionOrString.toString();
|
|
221
|
+
previous = res;
|
|
222
|
+
return res;
|
|
223
|
+
})
|
|
224
|
+
.join('\n');
|
|
225
|
+
return this.tmpOutput;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
private get project() {
|
|
229
|
+
return this.context.project;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
private get realtiveOrAbsFilePAth() {
|
|
233
|
+
return this.context.realtiveOrAbsFilePAth;
|
|
234
|
+
}
|
|
235
|
+
}
|