incremental-compiler 21.0.29 → 21.0.31

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 (38) 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/base-client-compiler.js +251 -0
  7. package/lib-prod/{build-info._auto-generated_.ts → build-info._auto-generated_.js} +1 -2
  8. package/lib-prod/compiler-manager.js +156 -0
  9. package/lib-prod/constants.js +6 -0
  10. package/lib-prod/env/{env.angular-node-app.ts → env.angular-node-app.js} +1 -1
  11. package/lib-prod/env/{env.docs-webapp.ts → env.docs-webapp.js} +1 -1
  12. package/lib-prod/env/{env.electron-app.ts → env.electron-app.js} +1 -1
  13. package/lib-prod/env/{env.mobile-app.ts → env.mobile-app.js} +1 -1
  14. package/lib-prod/env/{env.npm-lib-and-cli-tool.ts → env.npm-lib-and-cli-tool.js} +1 -1
  15. package/lib-prod/env/{env.vscode-plugin.ts → env.vscode-plugin.js} +1 -1
  16. package/lib-prod/helpers.js +101 -0
  17. package/lib-prod/incremental-watcher.js +26 -0
  18. package/lib-prod/{index._auto-generated_.ts → index._auto-generated_.js} +1 -1
  19. package/lib-prod/{index.ts → index.js} +1 -1
  20. package/lib-prod/migrations/index.js +2 -0
  21. package/lib-prod/migrations/{migrations_index._auto-generated_.ts → migrations_index._auto-generated_.js} +0 -2
  22. package/lib-prod/models.js +1 -0
  23. package/lib-prod/package.json +1 -1
  24. package/lib-prod/parcel-watcher-adapter.js +290 -0
  25. package/package.json +1 -1
  26. package/websql/package.json +1 -1
  27. package/websql-prod/package.json +1 -1
  28. package/lib-prod/base-client-compiler.ts +0 -341
  29. package/lib-prod/compiler-manager.ts +0 -226
  30. package/lib-prod/constants.ts +0 -6
  31. package/lib-prod/helpers.ts +0 -136
  32. package/lib-prod/incremental-watcher.ts +0 -41
  33. package/lib-prod/lib-info.md +0 -8
  34. package/lib-prod/migrations/index.ts +0 -2
  35. package/lib-prod/migrations/migrations-info.md +0 -6
  36. package/lib-prod/models.ts +0 -96
  37. package/lib-prod/parcel-watcher-adapter.ts +0 -396
  38. /package/lib-prod/env/{index.ts → index.js} +0 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "incremental-compiler/browser",
3
- "version": "21.0.29",
3
+ "version": "21.0.31",
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": "incremental-compiler/browser-prod",
3
- "version": "21.0.29",
3
+ "version": "21.0.31",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^21.0.0",
6
6
  "@angular/core": "^21.0.0"
@@ -21,4 +21,4 @@ export declare const CURRENT_PACKAGE_TAON_VERSION = "v21";
21
21
  /**
22
22
  * Autogenerated by current cli tool. Use *tnp release* to bump version.
23
23
  */
24
- export declare const CURRENT_PACKAGE_VERSION = "21.0.29";
24
+ export declare const CURRENT_PACKAGE_VERSION = "21.0.31";
@@ -25,6 +25,6 @@ exports.CURRENT_PACKAGE_TAON_VERSION = 'v21';
25
25
  /**
26
26
  * Autogenerated by current cli tool. Use *tnp release* to bump version.
27
27
  */
28
- exports.CURRENT_PACKAGE_VERSION = '21.0.29';
28
+ exports.CURRENT_PACKAGE_VERSION = '21.0.31';
29
29
  // THIS FILE IS GENERATED - DO NOT MODIFY
30
30
  //# sourceMappingURL=build-info._auto-generated_.js.map
package/lib/package.json CHANGED
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "incremental-compiler/lib",
3
- "version": "21.0.29"
3
+ "version": "21.0.31"
4
4
  }
@@ -0,0 +1,251 @@
1
+ //#region imports
2
+ import { fse } from 'tnp-core/lib-prod'; // @backend
3
+ import { path, crossPlatformPath, ___NS__cloneDeep, ___NS__isArray, ___NS__isFunction, ___NS__isString, ___NS__isUndefined, UtilsMessages__NS__compilationWrapper } from 'tnp-core/lib-prod';
4
+ import { Helpers__NS__error, Helpers__NS__log, Helpers__NS__logWarn, Helpers__NS__runSyncOrAsync } from 'tnp-core/lib-prod';
5
+ import { CLI } from 'tnp-core/lib-prod';
6
+ import { CompilerManager } from './compiler-manager';
7
+ import { mapForWatching } from './helpers';
8
+ //#endregion
9
+ export class BaseClientCompiler {
10
+ set folderPath(v) {
11
+ //#region @backend
12
+ if (___NS__isString(v)) {
13
+ v = [v];
14
+ }
15
+ this.__folderPath = v;
16
+ //#endregion
17
+ }
18
+ get folderPath() {
19
+ //#region @backendFunc
20
+ if (!this.pathResolve) {
21
+ this.pathResolve = true;
22
+ this.__folderPath
23
+ .map(p => {
24
+ if (fse.existsSync(p)) {
25
+ return crossPlatformPath(path.resolve(p));
26
+ }
27
+ else {
28
+ Helpers__NS__logWarn(`[BaseClientCompiler] Task "${this.taskName}" folderPath doesn't not exist ${this.folderPath}`);
29
+ return void 0;
30
+ }
31
+ })
32
+ .filter(f => !!f);
33
+ }
34
+ return this.__folderPath;
35
+ //#endregion
36
+ }
37
+ //#endregion
38
+ //#region constructor
39
+ //#region @backend
40
+ constructor(options) {
41
+ this.subscribeOnlyFor = [];
42
+ this.onlySingleRun = true;
43
+ this.pathResolve = false;
44
+ this.isInitedWithOptions = false;
45
+ this.__folderPath = [];
46
+ this.lastAsyncFiles = [];
47
+ this.isWatchCompilation = false;
48
+ this.folderPathContentCheck = [];
49
+ if (___NS__isUndefined(options)) {
50
+ this.isInitedWithOptions = false;
51
+ // setTimeout(() => {
52
+ // if (!this.isInitedWithOptions) {
53
+ // Helpers__NS__logInfo(
54
+ // `[incremental-compiler] Compiler class instace without init option, task name: "${this.taskName}"
55
+ // `,
56
+ // );
57
+ // }
58
+ // }, 1000);
59
+ }
60
+ else {
61
+ this.isInitedWithOptions = true;
62
+ this.fixAndAssignOptions(options);
63
+ }
64
+ }
65
+ //#endregion
66
+ //#endregion
67
+ //#region init options
68
+ /**
69
+ * manually init options (when no passing object to constructor super() )
70
+ */
71
+ initOptions(options) {
72
+ //#region @backendFunc
73
+ if (this.isInitedWithOptions === true) {
74
+ Helpers__NS__logWarn(`[incremental-compiler] You are reinit instance class again [task name: "${options?.taskName}"]`);
75
+ }
76
+ if (!options) {
77
+ Helpers__NS__error(`[incremental-compiler] Please init instance with options config`, false, true);
78
+ }
79
+ this.isInitedWithOptions = true;
80
+ this.fixAndAssignOptions(options);
81
+ //#endregion
82
+ }
83
+ //#endregion
84
+ //#region run task
85
+ /**
86
+ * do not override this
87
+ */
88
+ async runTask(options) {
89
+ //#region @backendFunc
90
+ // @ts-ignore
91
+ this.isWatchCompilation = options?.watch;
92
+ if (options?.watch) {
93
+ await this.startAndWatch(options);
94
+ }
95
+ else {
96
+ await this.start(options);
97
+ }
98
+ return this;
99
+ //#endregion
100
+ }
101
+ //#endregion
102
+ //#region start
103
+ /**
104
+ * @deprecated use runTask instead
105
+ * Do not override this
106
+ */
107
+ async start(options) {
108
+ //#region @backendFunc
109
+ let { taskName, afterInitCallBack, initialParams } = options || {};
110
+ CompilerManager.Instance.addClient(this);
111
+ if (!this.isInitedWithOptions) {
112
+ Helpers__NS__error(`[BaseClientCompiler] Please init client class intance with options`, false, true);
113
+ }
114
+ taskName = this.fixTaskName(taskName);
115
+ // @ts-ignore
116
+ this.taskName = taskName;
117
+ await UtilsMessages__NS__compilationWrapper(async () => {
118
+ await CompilerManager.Instance.syncInit(this, initialParams);
119
+ }, `${CLI.chalk.green('sync action')} for ${taskName}`, 'Event:');
120
+ if (___NS__isFunction(afterInitCallBack)) {
121
+ await Helpers__NS__runSyncOrAsync({
122
+ functionFn: afterInitCallBack,
123
+ arrayOfParams: [initialParams],
124
+ });
125
+ }
126
+ return this;
127
+ //#endregion
128
+ }
129
+ //#endregion
130
+ //#region start and watch
131
+ /**
132
+ * @deprecated use runTask instead
133
+ * Do not override this
134
+ */
135
+ async startAndWatch(options) {
136
+ //#region @backendFunc
137
+ let { taskName, watchOnly, initialParams } = options || {};
138
+ this.onlySingleRun = false;
139
+ if (!this.isInitedWithOptions) {
140
+ Helpers__NS__error(`[BaseClientCompiler] Please init client class intance with options`, false, true);
141
+ }
142
+ taskName = this.fixTaskName(taskName);
143
+ // @ts-ignore
144
+ this.taskName = taskName;
145
+ if (this.folderPath.length > 0) {
146
+ if (watchOnly) {
147
+ console.log(CLI.chalk.gray(`[incremental-compiler] Watch mode only for "${taskName}"`));
148
+ }
149
+ else {
150
+ await this.start(options);
151
+ }
152
+ if (___NS__isFunction(this.preAsyncAction)) {
153
+ await UtilsMessages__NS__compilationWrapper(async () => {
154
+ await this.preAsyncAction((initialParams || {}));
155
+ }, `${CLI.chalk.green('pre-async action')} for ${taskName}`, 'Event:');
156
+ }
157
+ await CompilerManager.Instance.asyncInit(this, initialParams || {});
158
+ }
159
+ else {
160
+ Helpers__NS__log(`No action for task: ${taskName}.. starting task`);
161
+ await this.start(options);
162
+ }
163
+ return this;
164
+ //#endregion
165
+ }
166
+ //#endregion
167
+ //#region sync action
168
+ /**
169
+ *
170
+ * @param absolteFilesPathes for each watched file
171
+ * @returns
172
+ */
173
+ syncAction(absolteFilesPathes, initialParams) {
174
+ return void 0;
175
+ }
176
+ //#endregion
177
+ //#region pre async action
178
+ async preAsyncAction(initialParams) { }
179
+ //#endregion
180
+ //#region async action
181
+ asyncAction(asyncEvents, initialParams) {
182
+ return void 0;
183
+ }
184
+ //#endregion
185
+ //#region get files to watch
186
+ getFilesFolderPatternsToWatch() {
187
+ //#region @backendFunc
188
+ const folders = [];
189
+ // this.clients.forEach(c => {
190
+ [this].forEach(c => {
191
+ // console.log("c.folderPath", c.folderPath)
192
+ c.folderPath.forEach(folderPath => {
193
+ // console.log(`fp`, fp)
194
+ if (___NS__isString(folderPath) && !folders.includes(folderPath)) {
195
+ const mapped = mapForWatching(folderPath);
196
+ folders.push(...mapped);
197
+ }
198
+ });
199
+ });
200
+ return ___NS__cloneDeep(folders);
201
+ //#endregion
202
+ }
203
+ //#endregion
204
+ //#region private methods
205
+ //#region private methods / fix and assign options
206
+ fixAndAssignOptions(options) {
207
+ //#region @backendFunc
208
+ if (!___NS__isArray(options.subscribeOnlyFor)) {
209
+ options.subscribeOnlyFor = [];
210
+ }
211
+ if (___NS__isUndefined(options.folderPath)) {
212
+ options.folderPath = [];
213
+ }
214
+ if (___NS__isUndefined(options.folderPathContentCheck)) {
215
+ options.folderPathContentCheck = [];
216
+ }
217
+ if (___NS__isUndefined(options.ignoreFolderPatter)) {
218
+ options.ignoreFolderPatter = [];
219
+ }
220
+ if (___NS__isString(options.folderPath)) {
221
+ options.folderPath = [options.folderPath];
222
+ }
223
+ if (___NS__isString(options.folderPathContentCheck)) {
224
+ options.folderPathContentCheck = [options.folderPathContentCheck];
225
+ }
226
+ if (!___NS__isString(options.folderPath) && !___NS__isArray(options.folderPath)) {
227
+ Helpers__NS__error(`Folder path shoudl be string or array`, false, true);
228
+ }
229
+ if (!___NS__isString(options.folderPathContentCheck) &&
230
+ !___NS__isArray(options.folderPathContentCheck)) {
231
+ Helpers__NS__error(`Folder path shoudl be string or array`, false, true);
232
+ }
233
+ if (___NS__isUndefined(options.followSymlinks)) {
234
+ options.followSymlinks = false;
235
+ }
236
+ if (___NS__isUndefined(options.notifyOnFileUnlink)) {
237
+ options.notifyOnFileUnlink = false;
238
+ }
239
+ // console.log('ASSIGNE', options)
240
+ Object.assign(this, options);
241
+ //#endregion
242
+ }
243
+ //#endregion
244
+ //#region private methods / fix task name
245
+ fixTaskName(taskName) {
246
+ if (!___NS__isString(taskName)) {
247
+ taskName = `task "${this.taskName}"`;
248
+ }
249
+ return taskName;
250
+ }
251
+ }
@@ -22,6 +22,5 @@ export const CURRENT_PACKAGE_TAON_VERSION = 'v21';
22
22
  /**
23
23
  * Autogenerated by current cli tool. Use *tnp release* to bump version.
24
24
  */
25
- export const CURRENT_PACKAGE_VERSION = '21.0.29';
25
+ export const CURRENT_PACKAGE_VERSION = '21.0.31';
26
26
  // THIS FILE IS GENERATED - DO NOT MODIFY
27
-
@@ -0,0 +1,156 @@
1
+ //#region imports
2
+ import { fse } from 'tnp-core/lib-prod'; // @backend
3
+ import { path, crossPlatformPath, ___NS__isArray, ___NS__isUndefined } from 'tnp-core/lib-prod';
4
+ import { Helpers__NS__log, Helpers__NS__readFile, Helpers__NS__tryReadFile } from 'tnp-core/lib-prod';
5
+ import { IGNORE_BY_DEFAULT } from './constants';
6
+ import { getFilesByPattern } from './helpers';
7
+ import { incrementalWatcher } from './incremental-watcher';
8
+ //#endregion
9
+ export class CompilerManager {
10
+ static get Instance() {
11
+ if (!this._instance) {
12
+ this._instance = new CompilerManager();
13
+ }
14
+ return this._instance;
15
+ }
16
+ //#endregion
17
+ //#region constructor
18
+ constructor() {
19
+ //#endregion
20
+ //#endregion
21
+ //#region fields
22
+ this.clients = [];
23
+ this.filesContentCache = {};
24
+ }
25
+ //#endregion
26
+ //#region methods / sync init
27
+ async syncInit(client, initialParams) {
28
+ //#region @backendFunc
29
+ let files = [];
30
+ if (___NS__isArray(client.folderPath) && client.folderPath.length > 0) {
31
+ files = client.folderPath
32
+ .reduce((folderOrFileA, folderOrFileB) => {
33
+ folderOrFileB = crossPlatformPath(folderOrFileB);
34
+ let filesFromB = [folderOrFileB];
35
+ if (fse.existsSync(folderOrFileB) &&
36
+ fse.lstatSync(folderOrFileB).isDirectory()) {
37
+ // search all files
38
+ filesFromB = getFilesByPattern({
39
+ followSymlinks: client.followSymlinks,
40
+ globPath: folderOrFileB,
41
+ ignorePatterns: [
42
+ ...IGNORE_BY_DEFAULT,
43
+ ...(client.ignoreFolderPatter || []),
44
+ ],
45
+ searchStrategy: 'folders-and-files',
46
+ taskName: client.taskName
47
+ });
48
+ }
49
+ return folderOrFileA.concat(filesFromB);
50
+ }, [])
51
+ .filter(f => {
52
+ if (client.subscribeOnlyFor.length > 0) {
53
+ return client.subscribeOnlyFor.includes(path.extname(f).replace('.', ''));
54
+ }
55
+ return true;
56
+ });
57
+ }
58
+ // console.log(`Files for client.folderPath: ${client.folderPath} client.followSymlinks: ${client.followSymlinks}`)
59
+ for (let index = 0; index < files.length; index++) {
60
+ const absFilePath = files[index];
61
+ const fileShouldBeCached = this.fileShouldBeChecked(absFilePath, client);
62
+ if (fileShouldBeCached) {
63
+ this.filesContentCache[absFilePath] = (Helpers__NS__readFile(absFilePath) || '').trim();
64
+ }
65
+ }
66
+ await client.syncAction(files, initialParams);
67
+ //#endregion
68
+ }
69
+ //#endregion
70
+ //#region methods / async init
71
+ async asyncInit(client, initialParams) {
72
+ //#region @backendFunc
73
+ // Helpers__NS__log(`this.clients: ${this.clients.map(c => c.key).join(',')} `)
74
+ // Helpers__NS__log(`this.firstFoldersToWatch: ${this.firstFoldersToWatch}`);
75
+ const watchers = [];
76
+ const watcher = incrementalWatcher(client.getFilesFolderPatternsToWatch(), {
77
+ name: `[incremental-compiler watcher for ${client.taskName}]`,
78
+ ignoreInitial: true,
79
+ followSymlinks: client.followSymlinks,
80
+ ignored: client.ignoreFolderPatter,
81
+ engine: client.engine,
82
+ }).on('all', async (event, absoluteFilePath) => {
83
+ // console.log(`[ic] event ${event}, path: ${absoluteFilePath}`);
84
+ await this.actionForAsyncEvent(event, absoluteFilePath, client, initialParams);
85
+ });
86
+ watchers.push(watcher);
87
+ //#endregion
88
+ }
89
+ async actionForAsyncEvent(event, absoluteFilePath, client, initialParams) {
90
+ //#region @backendFunc
91
+ absoluteFilePath = crossPlatformPath(absoluteFilePath);
92
+ if (event === 'addDir') {
93
+ return;
94
+ }
95
+ if (client.lastAsyncFiles.includes(absoluteFilePath)) {
96
+ return;
97
+ }
98
+ else {
99
+ client.lastAsyncFiles.push(absoluteFilePath);
100
+ }
101
+ // console.log(`[ic] final event ${event}, path: ${absoluteFilePath}`, 1);
102
+ // console.log('this.clients', this.clients.map(c => c.key))
103
+ if (event === 'unlink' && !client.notifyOnFileUnlink) {
104
+ return;
105
+ }
106
+ // console.log('toNotify', toNotify.map(c => c.key))
107
+ let proceedWithAsyncChange = true;
108
+ const fileShouldBeCached = this.fileShouldBeChecked(absoluteFilePath, client);
109
+ // console.log(`fileShouldBeCached ${fileShouldBeCached}: ${absoluteFilePath}`)
110
+ if (fileShouldBeCached && event === 'change') {
111
+ var currentContent = ((await Helpers__NS__tryReadFile(absoluteFilePath)) || '').trim();
112
+ if (currentContent === this.filesContentCache[absoluteFilePath]) {
113
+ // console.log('FILE THE SAME ' + absoluteFilePath)
114
+ proceedWithAsyncChange = false;
115
+ }
116
+ else {
117
+ this.filesContentCache[absoluteFilePath] = currentContent;
118
+ }
119
+ }
120
+ if (proceedWithAsyncChange) {
121
+ const change = {
122
+ datetime: new Date(),
123
+ fileAbsolutePath: absoluteFilePath,
124
+ eventName: event,
125
+ };
126
+ if (this.asyncEventScenario) {
127
+ await this.asyncEventScenario(change);
128
+ }
129
+ await client.asyncAction(change, initialParams);
130
+ }
131
+ client.lastAsyncFiles = client.lastAsyncFiles.filter(ef => ef !== absoluteFilePath);
132
+ //#endregion
133
+ }
134
+ //#endregion
135
+ //#region methods / add client
136
+ addClient(client) {
137
+ //#region @backendFunc
138
+ // console.log(`Cilent added "${client.key}" folders`, client.folderPath)
139
+ const existed = this.clients.find(c => c === client);
140
+ if (existed) {
141
+ Helpers__NS__log(`Task "${client.taskName}" alread added`); // TODO @LAST
142
+ }
143
+ this.clients.push(client);
144
+ //#endregion
145
+ }
146
+ //#endregion
147
+ //#region private methods / file should be checked
148
+ fileShouldBeChecked(absFilePath, client) {
149
+ //#region @backendFunc
150
+ const fileShouldBeCached = !___NS__isUndefined(client.folderPathContentCheck.find(patterFolder => {
151
+ return crossPlatformPath(absFilePath).startsWith(crossPlatformPath(patterFolder));
152
+ }));
153
+ return fileShouldBeCached;
154
+ //#endregion
155
+ }
156
+ }
@@ -0,0 +1,6 @@
1
+ export const IGNORE_BY_DEFAULT = [
2
+ '**/node_modules/**/*.*',
3
+ '**/node_modules',
4
+ '**/.git/**/*.*',
5
+ '**/.git',
6
+ ];
@@ -63,4 +63,4 @@ export const ENV_ANGULAR_NODE_APP_IS_CI_PROCESS = undefined;
63
63
  export const ENV_ANGULAR_NODE_APP_DOCKER_ADDITIONAL_CONTAINER = undefined;
64
64
  export const ENV_ANGULAR_NODE_APP_DOCKER_SKIP_START_IN_ORDER = undefined;
65
65
  export const ENV_ANGULAR_NODE_APP_DOCKER_SKIP_USING_MYSQL_DB = undefined;
66
- // THIS FILE IS GENERATED - DO NOT MODIFY
66
+ // THIS FILE IS GENERATED - DO NOT MODIFY
@@ -63,4 +63,4 @@ export const ENV_DOCS_WEBAPP_IS_CI_PROCESS = undefined;
63
63
  export const ENV_DOCS_WEBAPP_DOCKER_ADDITIONAL_CONTAINER = undefined;
64
64
  export const ENV_DOCS_WEBAPP_DOCKER_SKIP_START_IN_ORDER = undefined;
65
65
  export const ENV_DOCS_WEBAPP_DOCKER_SKIP_USING_MYSQL_DB = undefined;
66
- // THIS FILE IS GENERATED - DO NOT MODIFY
66
+ // THIS FILE IS GENERATED - DO NOT MODIFY
@@ -63,4 +63,4 @@ export const ENV_ELECTRON_APP_IS_CI_PROCESS = undefined;
63
63
  export const ENV_ELECTRON_APP_DOCKER_ADDITIONAL_CONTAINER = undefined;
64
64
  export const ENV_ELECTRON_APP_DOCKER_SKIP_START_IN_ORDER = undefined;
65
65
  export const ENV_ELECTRON_APP_DOCKER_SKIP_USING_MYSQL_DB = undefined;
66
- // THIS FILE IS GENERATED - DO NOT MODIFY
66
+ // THIS FILE IS GENERATED - DO NOT MODIFY
@@ -63,4 +63,4 @@ export const ENV_MOBILE_APP_IS_CI_PROCESS = undefined;
63
63
  export const ENV_MOBILE_APP_DOCKER_ADDITIONAL_CONTAINER = undefined;
64
64
  export const ENV_MOBILE_APP_DOCKER_SKIP_START_IN_ORDER = undefined;
65
65
  export const ENV_MOBILE_APP_DOCKER_SKIP_USING_MYSQL_DB = undefined;
66
- // THIS FILE IS GENERATED - DO NOT MODIFY
66
+ // THIS FILE IS GENERATED - DO NOT MODIFY
@@ -63,4 +63,4 @@ export const ENV_NPM_LIB_AND_CLI_TOOL_IS_CI_PROCESS = undefined;
63
63
  export const ENV_NPM_LIB_AND_CLI_TOOL_DOCKER_ADDITIONAL_CONTAINER = undefined;
64
64
  export const ENV_NPM_LIB_AND_CLI_TOOL_DOCKER_SKIP_START_IN_ORDER = undefined;
65
65
  export const ENV_NPM_LIB_AND_CLI_TOOL_DOCKER_SKIP_USING_MYSQL_DB = undefined;
66
- // THIS FILE IS GENERATED - DO NOT MODIFY
66
+ // THIS FILE IS GENERATED - DO NOT MODIFY
@@ -63,4 +63,4 @@ export const ENV_VSCODE_PLUGIN_IS_CI_PROCESS = undefined;
63
63
  export const ENV_VSCODE_PLUGIN_DOCKER_ADDITIONAL_CONTAINER = undefined;
64
64
  export const ENV_VSCODE_PLUGIN_DOCKER_SKIP_START_IN_ORDER = undefined;
65
65
  export const ENV_VSCODE_PLUGIN_DOCKER_SKIP_USING_MYSQL_DB = undefined;
66
- // THIS FILE IS GENERATED - DO NOT MODIFY
66
+ // THIS FILE IS GENERATED - DO NOT MODIFY
@@ -0,0 +1,101 @@
1
+ import { crossPlatformPath, fg, fse, path, Helpers__NS__exists, Helpers__NS__isFolder, Helpers__NS__logInfo, Helpers__NS__logWarn, UtilsStringRegex__NS__containsNonAscii } from 'tnp-core/lib-prod';
2
+ /**
3
+ * @returns Absolute paths of files/folders matching the given pattern
4
+ */
5
+ export const getFilesByPattern = ({ globPath, ignorePatterns = [], followSymlinks = true, searchStrategy = 'folders-and-files', taskName, }) => {
6
+ //#region @backendFunc
7
+ globPath = stripGlobToDir(globPath);
8
+ if (Helpers__NS__exists(globPath) && !Helpers__NS__isFolder(globPath)) {
9
+ return [globPath];
10
+ }
11
+ ignorePatterns = ignorePatterns || [];
12
+ //#region OLD_APPROACH commented out
13
+ // for (let index = 0; index < ignorePatterns.length; index++) {
14
+ // ignorePatterns[index] = ignorePatterns[index]
15
+ // .replace(globPath + '/', '**/')
16
+ // .replace('**/**/', '**/');
17
+ // }
18
+ // const localIgnorePatterns = ignorePatterns.reduce((a, b) => {
19
+ // const f1 = b.replace(/^\*\*\//, '');
20
+ // const f2 = f1.replace(/\/\*\*$/, '');
21
+ // return Utils__NS__uniqArray([...a, f1, f2]);
22
+ // }, []);
23
+ // const firstlevelFolders = fse
24
+ // .readdirSync(globPath)
25
+ // .map(f => `${globPath}/${f}`)
26
+ // .filter(f => fse.lstatSync(f).isDirectory())
27
+ // .filter(f => {
28
+ // const exclude = anymatch(localIgnorePatterns, path.basename(f));
29
+ // return !exclude;
30
+ // })
31
+ // .map(f => path.basename(f));
32
+ // const fullPattern = `${globPath}/{${firstlevelFolders.join(',')}}/**/*`;
33
+ // ignorePatterns = localIgnorePatterns;
34
+ // console.log({
35
+ // firstlevelFolers: firstlevelFolders,
36
+ // localIgnorePatterns,
37
+ // fullPattern,
38
+ // globPath,
39
+ // followSymlinks,
40
+ // ignorePatterns,
41
+ // searchStrategy,
42
+ // taskName,
43
+ // });
44
+ //#endregion
45
+ const fullPattern = `${globPath}/**/*`;
46
+ const entries = fg.sync(fullPattern, {
47
+ absolute: true,
48
+ dot: true,
49
+ followSymbolicLinks: followSymlinks,
50
+ ignore: ignorePatterns,
51
+ onlyFiles: false,
52
+ stats: true,
53
+ });
54
+ Helpers__NS__logInfo(`[incremental-compiler] Found ${entries.length} entries for pattern:\n${fullPattern}`);
55
+ Helpers__NS__logInfo(`[incremental-compiler] Task name:\n${taskName}`);
56
+ // Helpers__NS__logInfo(
57
+ // `Ignored patterns:\n\n${ignorePatterns.map(c => `'${c}',`).join('\n')}`,
58
+ // );
59
+ return entries
60
+ .filter(entry => {
61
+ if (UtilsStringRegex__NS__containsNonAscii(entry.path)) {
62
+ Helpers__NS__logWarn(`[incremental-compiler] Skipping path with non-ascii characters:\n${entry.path}`);
63
+ return false;
64
+ }
65
+ const stats = entry.stats;
66
+ const isDir = stats.isDirectory();
67
+ if (searchStrategy === 'files-only')
68
+ return !isDir;
69
+ if (searchStrategy === 'folders-only')
70
+ return isDir;
71
+ return true; // folders-and-files
72
+ })
73
+ .map(entry => crossPlatformPath(entry.path));
74
+ //#endregion
75
+ };
76
+ export const mapForWatching = (c) => {
77
+ //#region @backendFunc
78
+ if (fse.existsSync(c) && fse.lstatSync(c).isDirectory()) {
79
+ return [c, `${c}/**/*.*`];
80
+ }
81
+ return [c];
82
+ //#endregion
83
+ };
84
+ export const stripGlobToDir = (globPath) => {
85
+ //#region @backendFunc
86
+ // Find the first glob metacharacter
87
+ const globChars = ['*', '?', '[', ']', '{', '}'];
88
+ const firstGlobIndex = globChars
89
+ .map(ch => globPath.indexOf(ch))
90
+ .filter(i => i >= 0)
91
+ .sort((a, b) => a - b)[0];
92
+ if (firstGlobIndex === undefined) {
93
+ // no glob characters at all, return dirname if it's a file
94
+ return crossPlatformPath(globPath);
95
+ }
96
+ // Cut before the first glob character
97
+ const base = globPath.slice(0, firstGlobIndex);
98
+ // Ensure we end on a directory (strip partial segments)
99
+ return crossPlatformPath(path.resolve(base).replace(/[/\\]*$/, ''));
100
+ //#endregion
101
+ };
@@ -0,0 +1,26 @@
1
+ //#region imports
2
+ import { ___NS__cloneDeep, Helpers__NS__logInfo } from 'tnp-core/lib-prod';
3
+ import { chokidar } from 'tnp-core/lib-prod';
4
+ import { ParcelWatcherAdapter } from './parcel-watcher-adapter';
5
+ //#endregion
6
+ export function incrementalWatcher(filesFolderPathOrPatternsToWatch, watchOptions) {
7
+ //#region @backendFunc
8
+ if (!watchOptions) {
9
+ watchOptions = {};
10
+ }
11
+ // default to parcel watcher
12
+ watchOptions.engine = watchOptions.engine || '@parcel/watcher';
13
+ Helpers__NS__logInfo(`Using watcher: ${watchOptions.engine}`);
14
+ if (watchOptions?.engine === '@parcel/watcher') {
15
+ const opt = ___NS__cloneDeep(watchOptions);
16
+ // console.log({ filesFolderPathOrPattern/sToWatch, opt });
17
+ const instance = new ParcelWatcherAdapter(filesFolderPathOrPatternsToWatch, opt);
18
+ return instance;
19
+ }
20
+ else {
21
+ const opt = ___NS__cloneDeep(watchOptions);
22
+ opt.ignorePermissionErrors = true;
23
+ return chokidar.watch(filesFolderPathOrPatternsToWatch, watchOptions);
24
+ }
25
+ //#endregion
26
+ }
@@ -2,4 +2,4 @@
2
2
  // This file is auto-generated during init process. Do not modify.
3
3
  // This is only placeholder.
4
4
  // Use property "shouldGenerateAutogenIndexFile: true"
5
- // in taon.jsonc to enable ts exports auto generation.
5
+ // in taon.jsonc to enable ts exports auto generation.
@@ -2,4 +2,4 @@ export * from './constants';
2
2
  export * from './models';
3
3
  export * from './incremental-watcher';
4
4
  export * from './base-client-compiler';
5
- export * from './compiler-manager'; // @backend
5
+ export * from './compiler-manager'; // @backend
@@ -0,0 +1,2 @@
1
+ //@ts-nocheck
2
+ export * from './migrations_index._auto-generated_';
@@ -1,5 +1,3 @@
1
1
  // THIS FILE IS GENERATED - DO NOT MODIFY
2
-
3
2
  // THIS FILE IS GENERATED - DO NOT MODIFY
4
-
5
3
  // THIS FILE IS GENERATED - DO NOT MODIFY
@@ -0,0 +1 @@
1
+ export {};