ohos-router 1.0.0

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/index.ts ADDED
@@ -0,0 +1 @@
1
+ export {ohosRouter} from './router_plugin';
package/main.js ADDED
File without changes
package/module.js ADDED
@@ -0,0 +1,6 @@
1
+ //执行组件化脚本
2
+ function startAssembly(){
3
+ console.log("执行组件化")
4
+ }
5
+
6
+ startAssembly()
package/package.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "ohos-router",
3
+ "version": "1.0.0",
4
+ "description": "鸿蒙项目快速实现路由配置",
5
+ "main": "main.js",
6
+ "scripts": {
7
+ "test": "node module.js"
8
+ },
9
+ "keywords": [
10
+ "鸿蒙路由",
11
+ "鸿蒙路由快速开发插件"
12
+ ],
13
+ "author": "AbnerMing",
14
+ "license": "ISC",
15
+ "dependencies": {
16
+ "@ohos/hvigor": "5.2.2"
17
+ }
18
+ }
@@ -0,0 +1,466 @@
1
+ import {HvigorNode, HvigorPlugin} from '@ohos/hvigor';
2
+ import {readFileSync, writeFileSync, existsSync} from 'fs'
3
+
4
+ export function ohosRouter(isExecute: boolean = true): HvigorPlugin {
5
+ return {
6
+ pluginId: 'ohosRouter',
7
+ apply(node: HvigorNode) {
8
+ pluginStart(node, isExecute)
9
+ }
10
+ }
11
+ }
12
+
13
+ let entryModulePath = ""
14
+ let entryUpperCaseNameArray: string[] = []
15
+ let entryIsHsp: boolean[] = []
16
+
17
+ function pluginStart(node: HvigorNode, isExecute: boolean) {
18
+ if (!isExecute) {
19
+ return
20
+ }
21
+ entryUpperCaseNameArray = []
22
+ entryIsHsp = []
23
+ node.subNodes((childNode: HvigorNode) => {
24
+ try {
25
+ let hvigorfilePath = childNode.getNodePath() + "\\hvigorfile.ts"
26
+ let hvigorfileData = readFileSync(hvigorfilePath, 'utf-8');
27
+ let isHsp = hvigorfileData.indexOf("hspTasks") != -1
28
+ let isHap = hvigorfileData.indexOf("hapTasks") != -1
29
+ let nodeName = childNode.getNodeName()
30
+ let upperCaseName = nodeName.substring(0, 1).toUpperCase() + nodeName.substring(1, nodeName.length)
31
+ if ("Entry" != upperCaseName) {
32
+ entryUpperCaseNameArray.push(upperCaseName)
33
+ entryIsHsp.push(isHsp)
34
+ }
35
+ let configPath = childNode.getNodePath() + "\\" + upperCaseName + "RouterConfig.ets"
36
+
37
+ if (!existsSync(configPath)) {
38
+ try {
39
+ writeFileSync(configPath, getRouterConfig(upperCaseName, nodeName, isHsp));
40
+ } catch (error) {
41
+ log(JSON.stringify(error))
42
+ }
43
+ if (!isHap) {
44
+ let indexFilePath = childNode.getNodePath() + "\\" + "Index.ets"
45
+ let indexFileData = readFileSync(indexFilePath, 'utf-8');
46
+ if (indexFileData.indexOf(upperCaseName) == -1) {
47
+ indexFileData = "export { " + upperCaseName +
48
+ "RouterConfig } from './" + upperCaseName +
49
+ "RouterConfig'\n" + indexFileData
50
+ writeFileSync(indexFilePath, indexFileData);
51
+ }
52
+ }
53
+ }
54
+ if (isHap) {
55
+ entryModulePath = childNode.getNodePath()
56
+ writeBuildProfile(childNode)
57
+ }
58
+ let fileList = childNode.getNodeDir()
59
+ .asFileList()
60
+ .filter(item => {
61
+ return item.getPath().indexOf("build") == -1
62
+ && item.getPath().indexOf("oh_modules") == -1
63
+ && item.getPath().indexOf("src\\main") != -1
64
+ && item.getPath().endsWith(".ets")
65
+ })
66
+
67
+ fileList.forEach((file) => {
68
+ let data = readFileSync(file.filePath, 'utf-8');
69
+ if (data.indexOf("@RouterPath") != -1) {
70
+ let routerPathEnd = data.split("@RouterPath")[1]
71
+ let routerName = routerPathEnd.substring(2, routerPathEnd.indexOf(")") - 1)
72
+ var importPath = "./src" + file.filePath.split("src")[1]
73
+ importPath = importPath.replace(".ets", "").replaceAll("\\", "/")
74
+ let viewName = importPath.substring(importPath.lastIndexOf("/") + 1, importPath.length)
75
+ let fileData = readFileSync(configPath, 'utf-8')
76
+ if (fileData.indexOf(routerName) == -1) {
77
+ let switchTag = "switch (builderName) {"
78
+ let switchPosition = fileData.indexOf(switchTag) + switchTag.length
79
+ let switchBuilder = "\n case \"" + routerName + "\":\n" +
80
+ " import(\"" + importPath + "\")\n" +
81
+ " break"
82
+ let configEnd = insertString(fileData, switchPosition, switchBuilder)
83
+ let destinationEnd = ""
84
+ let DestinationTag = "NavDestination() {"
85
+ let destinationPosition = configEnd.indexOf(DestinationTag) + DestinationTag.length
86
+
87
+ let destinationBuilder = "\n if (routerGetBuilderType() == \"" + routerName + "\") {\n" +
88
+ " " + viewName + "()\n" +
89
+ " } "
90
+ if (configEnd.indexOf("routerGetBuilderType()") != -1) {
91
+ destinationBuilder = destinationBuilder + "else "
92
+ }
93
+ destinationEnd = insertString(configEnd, destinationPosition, destinationBuilder)
94
+
95
+ let importContent = "import { " + viewName +
96
+ " } from '" + importPath + "';\n"
97
+ destinationEnd = importContent + destinationEnd
98
+
99
+ writeFileSync(configPath, destinationEnd);
100
+ }
101
+ }
102
+ })
103
+
104
+ } catch (error) {
105
+
106
+ }
107
+ })
108
+
109
+ try {
110
+ let moduleJson5Path = entryModulePath + "\\src\\main\\module.json5"
111
+ let moduleJson5Data = readFileSync(moduleJson5Path, 'utf-8');
112
+ moduleJson5JSONParse(moduleJson5Data)
113
+ let appPath = entryModulePath + "\\src\\main\\ets\\App.ets"
114
+ if (moduleSrcEntry == undefined) {
115
+ writeFileSync(appPath, getApp());
116
+ let moduleTag = "\"module\": {"
117
+ let modulePosition = moduleJson5Data.indexOf(moduleTag) + moduleTag.length
118
+ let mJson = "\n \"srcEntry\": \"./ets/App.ets\","
119
+ let moduleContent = insertString(moduleJson5Data, modulePosition, mJson)
120
+ writeFileSync(moduleJson5Path, moduleContent);
121
+ } else {
122
+ let endSrc = moduleSrcEntry.substring(1, moduleSrcEntry.length).replaceAll("/", "\\")
123
+ let endAppPath = entryModulePath + "\\src\\main" + endSrc
124
+ let appFileData = readFileSync(endAppPath, 'utf-8');
125
+ if (appFileData.indexOf("routerInitConfig([") != -1) {
126
+ let initHaveConfig = ""
127
+ let importHaveConfig = ""
128
+ let isHaveConfig = false;
129
+ entryUpperCaseNameArray.forEach((name, index) => {
130
+ let isHsp = entryIsHsp[index]
131
+ let endHsp = ""
132
+ if (isHsp) {
133
+ endHsp = "getARouter()"
134
+ }
135
+
136
+ if (appFileData.indexOf(name) == -1) {
137
+ //不包含
138
+ isHaveConfig = true;
139
+ initHaveConfig = initHaveConfig + (" new " + name + "RouterConfig(" + endHsp + "),\n")
140
+ dependenciesKey.forEach((item, index) => {
141
+ if (item.indexOf(name.toLowerCase()) != -1) {
142
+ //证明是包含的
143
+ importHaveConfig = importHaveConfig + "\nimport { " + name +
144
+ "RouterConfig } from '" + item + "';\n"
145
+ }
146
+ })
147
+ }
148
+ })
149
+
150
+ if (isHaveConfig) {
151
+ let routerInitHaveTag = "routerInitConfig(["
152
+ let routerInitHavePosition = appFileData.indexOf(routerInitHaveTag) + routerInitHaveTag.length
153
+ let routerHaveJson = "\n" + initHaveConfig
154
+ let routerInitHaveContent = insertString(appFileData, routerInitHavePosition, routerHaveJson)
155
+ routerInitHaveContent = importHaveConfig + routerInitHaveContent
156
+ writeFileSync(endAppPath, routerInitHaveContent);
157
+ }
158
+ } else {
159
+ let initNewConfig = ""
160
+ let importNewConfig = ""
161
+ entryUpperCaseNameArray.forEach((name, index) => {
162
+ let isHsp = entryIsHsp[index]
163
+ let endHsp = ""
164
+ if (isHsp) {
165
+ endHsp = "getARouter()"
166
+ }
167
+ initNewConfig = initNewConfig + (" new " + name + "RouterConfig(" + endHsp + "),\n")
168
+ dependenciesKey.forEach((item, index) => {
169
+ if (item.indexOf(name.toLowerCase()) != -1) {
170
+ //证明是包含的
171
+ importNewConfig = importNewConfig + "\nimport { " + name +
172
+ "RouterConfig } from '" + item + "';\n"
173
+ }
174
+ })
175
+ })
176
+
177
+ let routerInitTag = "onCreate(): void {"
178
+ let routerInitPosition = appFileData.indexOf(routerInitTag) + routerInitTag.length
179
+ let routerJson = "\n routerInitConfig([\n" +
180
+ initNewConfig +
181
+ " new EntryRouterConfig()\n" +
182
+ " ])\n"
183
+ let routerInitContent = insertString(appFileData, routerInitPosition, routerJson)
184
+ routerInitContent = "import { getARouter,routerInitConfig } from '@abner/router';\n" +
185
+ "import { EntryRouterConfig } from '../../../EntryRouterConfig';\n"
186
+ + importNewConfig
187
+ + routerInitContent
188
+ writeFileSync(endAppPath, routerInitContent);
189
+ }
190
+ }
191
+
192
+ } catch (error) {
193
+
194
+ }
195
+
196
+ }
197
+
198
+ let moduleSrcEntry = ""
199
+
200
+ function moduleJson5JSONParse(moduleJson5Data: string) {
201
+ try {
202
+ let moduleJsonBean = JSON.parse(moduleJson5Data)
203
+ let module = moduleJsonBean.module
204
+ moduleSrcEntry = module.srcEntry
205
+ } catch (error) {
206
+ let errorArray = error.message.split(" ")
207
+ let position = Number(errorArray[errorArray.length - 1])
208
+ let endString = moduleJson5Data.substring(0, position)
209
+ const lastIndex = endString.lastIndexOf(",")
210
+ let replacedStr = replaceCharUsingSubstring(endString, lastIndex, '');
211
+ moduleJson5JSONParse(replacedStr + moduleJson5Data.substring(position, moduleJson5Data.length))
212
+ }
213
+
214
+ }
215
+
216
+ function insertString(src: string, pos: number, val: string): string {
217
+ if (pos < -src.length - 1 || pos > src.length) {
218
+ throw "insert position is error";
219
+ }
220
+ if (pos >= 0) {
221
+ return src.slice(0, pos) + val + src.slice(pos);
222
+ } else {
223
+ return src.slice(0, src.length + 1 + pos) + val + src.slice(src.length + 1 + pos);
224
+ }
225
+ }
226
+
227
+ function getRouterConfig(upperCaseName: string, nodeName: string, isHsp: boolean) {
228
+ var configText = "import { ";
229
+ if (isHsp) {
230
+ configText = configText + " ARouter, setARouter, "
231
+ }
232
+ configText = configText + "RouterConfig,routerGetBuilderType, routerInitBuilder } from '@abner/router';\n" +
233
+ "\n" +
234
+ "/**\n" +
235
+ " * AUTHOR:AbnerMing\n" +
236
+ " * INTRODUCE:动态配置路径\n" +
237
+ " * */\n" +
238
+ "function importPath(builderName: string) {\n" +
239
+ " switch (builderName) {\n" +
240
+ "\n" +
241
+ " }\n" +
242
+ "}\n" +
243
+ "\n" +
244
+ "/**\n" +
245
+ " * AUTHOR:AbnerMing\n" +
246
+ " * INTRODUCE:动态配置组件\n" +
247
+ " * */\n" +
248
+ "@Builder\n" +
249
+ "export function viewBuilder() {\n" +
250
+ " NavDestination() {\n" +
251
+ "\n" +
252
+ " }\n" +
253
+ " .hideTitleBar(true)\n" +
254
+ " .height('100%')\n" +
255
+ "\n" +
256
+ "}\n" +
257
+ "\n" +
258
+ "\n" +
259
+ "/**\n" +
260
+ " * AUTHOR:AbnerMing\n" +
261
+ " * DATE:" + getNowTime() + "\n" +
262
+ " * INTRODUCE:路由配置,此路由配置文件为自动生成,无特殊情况下请无须改动\n" +
263
+ " * */\n" +
264
+ "export class " + upperCaseName + "RouterConfig implements RouterConfig {\n";
265
+
266
+ if (isHsp) {
267
+ configText = configText + " constructor(router: ARouter) {\n" +
268
+ " setARouter(router)\n" +
269
+ " }\n"
270
+ }
271
+
272
+ configText = configText + " getModuleName(): string {\n" +
273
+ " return \"" + nodeName + "\"\n" +
274
+ " }\n" +
275
+ "\n" +
276
+ " async initRouter(builderName: string): Promise<void> {\n" +
277
+ " return await new Promise((resolve: Function) => {\n" +
278
+ " importPath(builderName)\n" +
279
+ " routerInitBuilder(builderName, wrapBuilder(viewBuilder))\n" +
280
+ " resolve()\n" +
281
+ " })\n" +
282
+ " }\n" +
283
+ "}"
284
+
285
+
286
+ return configText
287
+ }
288
+
289
+ var buildProfilePath = ""
290
+
291
+ function writeBuildProfile(childNode: HvigorNode) {
292
+ let ohPackagePath = childNode.getNodePath() + "\\oh-package.json5"
293
+ let ohPackageData = readFileSync(ohPackagePath, 'utf-8');
294
+ dependenciesJSONParse(ohPackageData)
295
+ buildProfilePath = childNode.getNodePath() + "\\build-profile.json5"
296
+ let buildProfileData = readFileSync(buildProfilePath, 'utf-8');
297
+ buildProfileJSONParse(buildProfileData)
298
+ }
299
+
300
+ function getNowTime() {
301
+ let d = new Date();
302
+ return d.getFullYear() + "年" + (d.getMonth() + 1) + "月" + d.getDate() + "日 " + d.getHours() + "时" +
303
+ d.getMinutes() +
304
+ "分" + d.getSeconds() + "秒"
305
+ }
306
+
307
+ function log(params: string) {
308
+ console.error(params);
309
+ }
310
+
311
+ let dependenciesKey: string[]
312
+
313
+ function dependenciesJSONParse(ohPackageData: string) {
314
+ try {
315
+ dependenciesKey = []
316
+ let ohPackAgeBean = JSON.parse(ohPackageData)
317
+ let dependencies = ohPackAgeBean.dependencies
318
+ for (var key in dependencies) {
319
+ if (dependencies[key].indexOf("file:..") != -1) {
320
+ dependenciesKey.push(key)
321
+ }
322
+ }
323
+ } catch (error) {
324
+ let errorArray = error.message.split(" ")
325
+ let position = Number(errorArray[errorArray.length - 1])
326
+ let endString = ohPackageData.substring(0, position)
327
+ const lastIndex = endString.lastIndexOf(",")
328
+ let replacedStr = replaceCharUsingSubstring(endString, lastIndex, '');
329
+ dependenciesJSONParse(replacedStr + ohPackageData.substring(position, ohPackageData.length))
330
+ }
331
+ }
332
+
333
+ function buildProfileJSONParse(buildProfileData: string) {
334
+ try {
335
+ let buildProfileBean = JSON.parse(buildProfileData)
336
+ let buildOptionBean = buildProfileBean.buildOption
337
+ if (buildOptionBean.arkOptions == undefined) {
338
+ printBuildProFile(buildProfileData, 0)
339
+ } else {
340
+ //有了这个参数
341
+ let arkOptions = buildOptionBean.arkOptions
342
+ if (arkOptions.runtimeOnly == undefined) {
343
+ printBuildProFile(buildProfileData, 1)
344
+
345
+ } else {
346
+ let runtimeOnly = arkOptions.runtimeOnly
347
+ if (runtimeOnly.packages == undefined) {
348
+ printBuildProFile(buildProfileData, 2)
349
+ } else {
350
+ if (dependenciesKey.toString() != runtimeOnly["packages"].toString()) {
351
+ printBuildProFile(buildProfileData, 3)
352
+ }
353
+ }
354
+ }
355
+ }
356
+ } catch (error) {
357
+ let errorArray = error.message.split(" ")
358
+ let position = Number(errorArray[errorArray.length - 1])
359
+ let endString = buildProfileData.substring(0, position)
360
+ const lastIndex = endString.lastIndexOf(",")
361
+ let replacedStr = replaceCharUsingSubstring(endString, lastIndex, '');
362
+ buildProfileJSONParse(replacedStr + buildProfileData.substring(position, buildProfileData.length))
363
+ }
364
+ }
365
+
366
+ //打印到文件
367
+ function printBuildProFile(buildProfileData: string, type: number) {
368
+ let endArray = ""
369
+ dependenciesKey.forEach((item, index) => {
370
+ if (index == dependenciesKey.length - 1) {
371
+ endArray = endArray + " \"" + item + "\"\n"
372
+ } else {
373
+ endArray = endArray + " \"" + item + "\",\n"
374
+ }
375
+ })
376
+
377
+ if (endArray == "") {
378
+ return
379
+ }
380
+
381
+ let buildProfileContent = ""
382
+ if (type == 0) {
383
+ let buildProfileTag = "\"buildOption\": {"
384
+ let buildProfilePosition = buildProfileData.indexOf(buildProfileTag) + buildProfileTag.length
385
+ let buildProfileBuilder = "\n \"arkOptions\": {\n" +
386
+ " \"runtimeOnly\": {\n" +
387
+ " \"sources\": [\n" +
388
+ " ],\n" +
389
+ " \"packages\": [\n" +
390
+ endArray +
391
+ " ]\n" +
392
+ " }\n" +
393
+ " }"
394
+
395
+ buildProfileContent = insertString(buildProfileData, buildProfilePosition, buildProfileBuilder)
396
+ } else if (type == 1) {
397
+ let buildProfileTag = " \"buildOption\": {\n" +
398
+ " \"arkOptions\": {"
399
+ let buildProfilePosition = buildProfileData.indexOf(buildProfileTag) + buildProfileTag.length
400
+ let buildProfileBuilder = "\n \"runtimeOnly\": {\n" +
401
+ " \"sources\": [\n" +
402
+ " ],\n" +
403
+ " \"packages\": [\n" +
404
+ endArray +
405
+ " ]\n" +
406
+ " }"
407
+ buildProfileContent = insertString(buildProfileData, buildProfilePosition, buildProfileBuilder)
408
+ } else if (type == 2) {
409
+ let buildProfileTag = "\"runtimeOnly\": {"
410
+ let buildProfilePosition = buildProfileData.indexOf(buildProfileTag) + buildProfileTag.length
411
+ let buildProfileBuilder = "\n \"packages\": [\n" +
412
+ endArray +
413
+ " ]\n"
414
+ buildProfileContent = insertString(buildProfileData, buildProfilePosition, buildProfileBuilder)
415
+ } else if (type == 3) {
416
+ let buildProfileTag = "\"packages\": ["
417
+ let buildProfilePosition = buildProfileData.indexOf(buildProfileTag) + buildProfileTag.length
418
+ let buildProfileBuilder = "\n" + endArray
419
+ buildProfileContent = insertString(buildProfileData, buildProfilePosition, buildProfileBuilder)
420
+ }
421
+
422
+ writeFileSync(buildProfilePath, buildProfileContent);
423
+
424
+ }
425
+
426
+ function getApp() {
427
+ let initAppConfig = ""
428
+ let importAppConfig = ""
429
+ entryUpperCaseNameArray.forEach((name, index) => {
430
+ let isHsp = entryIsHsp[index]
431
+ let endHsp = ""
432
+ if (isHsp) {
433
+ endHsp = "getARouter()"
434
+ }
435
+ initAppConfig = initAppConfig + (" new " + name + "RouterConfig(" + endHsp + "),\n")
436
+ dependenciesKey.forEach((item, index) => {
437
+ if (item.indexOf(name.toLowerCase()) != -1) {
438
+ //证明是包含的
439
+ importAppConfig = importAppConfig + "\nimport { " + name +
440
+ "RouterConfig } from '" + item + "';\n"
441
+ }
442
+ })
443
+ })
444
+
445
+ let appContent = "import { getARouter,routerInitConfig } from '@abner/router';\n" +
446
+ "import { AbilityStage } from '@kit.AbilityKit';\n" +
447
+ "import { EntryRouterConfig } from '../../../EntryRouterConfig';\n" +
448
+ importAppConfig +
449
+ "\n" +
450
+ "export class App extends AbilityStage {\n" +
451
+ " onCreate(): void {\n" +
452
+ " routerInitConfig([\n" +
453
+ initAppConfig +
454
+ " new EntryRouterConfig()\n" +
455
+ " ])\n" +
456
+ " }\n" +
457
+ "}"
458
+ return appContent
459
+ }
460
+
461
+ function replaceCharUsingSubstring(str: string, index: number, newChar: string) {
462
+ if (index < 0 || index >= str.length) {
463
+ return str;
464
+ }
465
+ return str.substring(0, index) + newChar + str.substring(index + 1);
466
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,109 @@
1
+ {
2
+ "compilerOptions": {
3
+ /* Visit https://aka.ms/tsconfig to read more about this file */
4
+ "lib": ["ES2021", "dom"],
5
+ /* Projects */
6
+ // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
7
+ // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
8
+ // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
9
+ // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
10
+ // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11
+ // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12
+
13
+ /* Language and Environment */
14
+ "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
15
+ // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
16
+ // "jsx": "preserve", /* Specify what JSX code is generated. */
17
+ // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
18
+ // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
19
+ // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
20
+ // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
21
+ // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
22
+ // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
23
+ // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
24
+ // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
25
+ // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
26
+
27
+ /* Modules */
28
+ "module": "commonjs", /* Specify what module code is generated. */
29
+ // "rootDir": "./", /* Specify the root folder within your source files. */
30
+ // "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
31
+ // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
32
+ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
33
+ // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
34
+ // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
35
+ // "types": [], /* Specify type package names to be included without being referenced in a source file. */
36
+ // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
37
+ // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
38
+ // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
39
+ // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
40
+ // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
41
+ // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
42
+ // "resolveJsonModule": true, /* Enable importing .json files. */
43
+ // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
44
+ // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
45
+
46
+ /* JavaScript Support */
47
+ // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
48
+ // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
49
+ // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
50
+
51
+ /* Emit */
52
+ // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
53
+ // "declarationMap": true, /* Create sourcemaps for d.ts files. */
54
+ // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
55
+ // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
56
+ // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
57
+ // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
58
+ // "outDir": "./", /* Specify an output folder for all emitted files. */
59
+ // "removeComments": true, /* Disable emitting comments. */
60
+ // "noEmit": true, /* Disable emitting files from a compilation. */
61
+ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
62
+ // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
63
+ // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
64
+ // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
65
+ // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
66
+ // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
67
+ // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
68
+ // "newLine": "crlf", /* Set the newline character for emitting files. */
69
+ // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
70
+ // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
71
+ // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
72
+ // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
73
+ // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
74
+ // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
75
+
76
+ /* Interop Constraints */
77
+ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
78
+ // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
79
+ // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
80
+ "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
81
+ // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
82
+ "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
83
+
84
+ /* Type Checking */
85
+ "strict": true, /* Enable all strict type-checking options. */
86
+ // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
87
+ // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
88
+ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
89
+ // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
90
+ // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
91
+ // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
92
+ // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
93
+ // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
94
+ // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
95
+ // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
96
+ // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
97
+ // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
98
+ // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
99
+ // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
100
+ // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
101
+ // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
102
+ // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
103
+ // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
104
+
105
+ /* Completeness */
106
+ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
107
+ "skipLibCheck": true /* Skip type checking all .d.ts files. */
108
+ }
109
+ }