@magic-xpa/cli 4.801.0-dev481.243 → 4.801.0-dev481.249

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 (84) hide show
  1. package/index.js +1 -1
  2. package/index.js.map +1 -1
  3. package/package.json +1 -1
  4. package/src/collection.json +1 -0
  5. package/src/public_api.js +3 -3
  6. package/src/public_api.js.map +1 -1
  7. package/src/schematics/magic-utils/env.js +5 -5
  8. package/src/schematics/magic-utils/env.js.map +1 -1
  9. package/src/schematics/magic-utils/env.ts +5 -5
  10. package/src/schematics/magic-utils/metadata.class.js +3 -3
  11. package/src/schematics/magic-utils/metadata.class.js.map +1 -1
  12. package/src/schematics/magic-utils/process-json.js +4 -4
  13. package/src/schematics/magic-utils/process-json.js.map +1 -1
  14. package/src/schematics/magic-utils/rules/build-control.rule.js +4 -4
  15. package/src/schematics/magic-utils/rules/build-control.rule.js.map +1 -1
  16. package/src/schematics/magic-utils/rules/build-view.rule.js +4 -4
  17. package/src/schematics/magic-utils/rules/build-view.rule.js.map +1 -1
  18. package/src/schematics/magic-utils/rules/component-list.rule.js +29 -50
  19. package/src/schematics/magic-utils/rules/component-list.rule.js.map +1 -1
  20. package/src/schematics/magic-utils/rules/component-list.rule.ts +2 -28
  21. package/src/schematics/magic-utils/rules/generate.rule.js +3 -3
  22. package/src/schematics/magic-utils/rules/generate.rule.js.map +1 -1
  23. package/src/schematics/magic-utils/rules/init-add-modules.rule.js +40 -24
  24. package/src/schematics/magic-utils/rules/init-add-modules.rule.js.map +1 -1
  25. package/src/schematics/magic-utils/rules/init-add-modules.rule.ts +21 -1
  26. package/src/schematics/magic-utils/rules/init-gen-components.rule.js +9 -9
  27. package/src/schematics/magic-utils/rules/init-gen-components.rule.js.map +1 -1
  28. package/src/schematics/magic-utils/rules/init-magic-metadata.rule.js +2 -2
  29. package/src/schematics/magic-utils/rules/init-magic-metadata.rule.js.map +1 -1
  30. package/src/schematics/magic-utils/rules/load-views-gen.rule.js +5 -5
  31. package/src/schematics/magic-utils/rules/load-views-gen.rule.js.map +1 -1
  32. package/src/schematics/magic-utils/utils.js +10 -10
  33. package/src/schematics/magic-utils/utils.js.map +1 -1
  34. package/src/schematics/mg-Install-prerequisites/index.js +3 -3
  35. package/src/schematics/mg-Install-prerequisites/index.js.map +1 -1
  36. package/src/schematics/mg-Install-prerequisites/schema.json +1 -1
  37. package/src/schematics/mg-add/files/src/app/magic/lazy-loader.service.ts +10 -0
  38. package/src/schematics/mg-add/index.js +52 -16
  39. package/src/schematics/mg-add/index.js.map +1 -1
  40. package/src/schematics/mg-add/index.ts +42 -3
  41. package/src/schematics/mg-add/schema.json +1 -1
  42. package/src/schematics/mg-add/utils/add-declaration-to-root-module.js +2 -2
  43. package/src/schematics/mg-add/utils/add-declaration-to-root-module.js.map +1 -1
  44. package/src/schematics/mg-add-tasks/schema.json +1 -1
  45. package/src/schematics/mg-delete-files/index.js +3 -3
  46. package/src/schematics/mg-delete-files/index.js.map +1 -1
  47. package/src/schematics/mg-delete-files/schema.json +1 -1
  48. package/src/schematics/mg-gen-module/index.js +4 -4
  49. package/src/schematics/mg-gen-module/index.js.map +1 -1
  50. package/src/schematics/mg-gen-module/schema.json +1 -1
  51. package/src/schematics/mg-generate/index.js +3 -3
  52. package/src/schematics/mg-generate/index.js.map +1 -1
  53. package/src/schematics/mg-generate/schema.json +1 -1
  54. package/src/schematics/mg-install/index.js +2 -2
  55. package/src/schematics/mg-install/index.js.map +1 -1
  56. package/src/schematics/mg-install/schema.json +1 -1
  57. package/src/schematics/mg-routes/index.js +6 -6
  58. package/src/schematics/mg-routes/index.js.map +1 -1
  59. package/src/schematics/mg-routes/schema.json +1 -1
  60. package/src/schematics/mg-single-control/index.js +4 -4
  61. package/src/schematics/mg-single-control/index.js.map +1 -1
  62. package/src/schematics/mg-single-control/schema.json +1 -1
  63. package/src/schematics/utils/ast.js +6 -6
  64. package/src/schematics/utils/ast.js.map +1 -1
  65. package/src/schematics/utils/devkit-utils/ast-utils_old.js +2 -2
  66. package/src/schematics/utils/devkit-utils/ast-utils_old.js.map +1 -1
  67. package/src/schematics/utils/devkit-utils/component.js +16 -16
  68. package/src/schematics/utils/devkit-utils/component.js.map +1 -1
  69. package/src/schematics/utils/devkit-utils/find-module.js +11 -11
  70. package/src/schematics/utils/devkit-utils/find-module.js.map +1 -1
  71. package/src/schematics/utils/devkit-utils/ng-ast-utils.js +6 -6
  72. package/src/schematics/utils/devkit-utils/ng-ast-utils.js.map +1 -1
  73. package/src/schematics/utils/devkit-utils/parse-name.js +3 -3
  74. package/src/schematics/utils/devkit-utils/parse-name.js.map +1 -1
  75. package/src/schematics/utils/devkit-utils/route-utils.js +16 -16
  76. package/src/schematics/utils/devkit-utils/route-utils.js.map +1 -1
  77. package/src/schematics/utils/html.js +1 -1
  78. package/src/schematics/utils/html.js.map +1 -1
  79. package/src/schematics/utils/testing.js +1 -1
  80. package/src/schematics/utils/testing.js.map +1 -1
  81. package/src/types/enums/Enums.js +5 -1
  82. package/src/types/enums/Enums.js.map +1 -1
  83. package/src/types/index.js +7 -7
  84. package/src/types/index.js.map +1 -1
@@ -26,9 +26,9 @@ function addDeclarationToNgModule(options) {
26
26
  + (options.flat ? '' : core_1.strings.dasherize(options.name) + '/')
27
27
  + core_1.strings.dasherize(options.name)
28
28
  + '.component';
29
- const relativePath = find_module_1.buildRelativePath(modulePath, componentPath);
29
+ const relativePath = (0, find_module_1.buildRelativePath)(modulePath, componentPath);
30
30
  const classifiedName = core_1.strings.classify(`${options.name}Component`);
31
- const declarationChanges = ast_utils_1.addDeclarationToModule(source, modulePath, classifiedName, relativePath);
31
+ const declarationChanges = (0, ast_utils_1.addDeclarationToModule)(source, modulePath, classifiedName, relativePath);
32
32
  const declarationRecorder = host.beginUpdate(modulePath);
33
33
  for (const change of declarationChanges) {
34
34
  if (change instanceof change_1.InsertChange) {
@@ -45,7 +45,7 @@ function addDeclarationToNgModule(options) {
45
45
  const sourceText = text.toString('utf-8');
46
46
  const source = ts.createSourceFile(modulePath, sourceText, ts.ScriptTarget.Latest, true);
47
47
  const exportRecorder = host.beginUpdate(modulePath);
48
- const exportChanges = ast_utils_1.addExportToModule(source, modulePath, core_1.strings.classify(`${options.name}Component`), relativePath);
48
+ const exportChanges = (0, ast_utils_1.addExportToModule)(source, modulePath, core_1.strings.classify(`${options.name}Component`), relativePath);
49
49
  for (const change of exportChanges) {
50
50
  if (change instanceof change_1.InsertChange) {
51
51
  exportRecorder.insertLeft(change.pos, change.toAdd);
@@ -65,7 +65,7 @@ function buildSelector(options) {
65
65
  }
66
66
  function buildComponent(options) {
67
67
  return (host, context) => {
68
- const workspace = config_1.getWorkspace(host);
68
+ const workspace = (0, config_1.getWorkspace)(host);
69
69
  if (!options.project) {
70
70
  options.project = Object.keys(workspace.projects)[0];
71
71
  }
@@ -74,22 +74,22 @@ function buildComponent(options) {
74
74
  options.path = `/${project.root}/src/app`;
75
75
  }
76
76
  options.selector = options.selector || buildSelector(options);
77
- options.module = find_module_1.findModuleFromOptions(host, options);
78
- const parsedPath = parse_name_1.parseName(options.path, options.name);
77
+ options.module = (0, find_module_1.findModuleFromOptions)(host, options);
78
+ const parsedPath = (0, parse_name_1.parseName)(options.path, options.name);
79
79
  options.name = parsedPath.name;
80
80
  options.path = parsedPath.path;
81
- validation_1.validateName(options.name);
82
- const templateSource = schematics_1.apply(schematics_1.url('./files'), [
83
- options.spec ? schematics_1.noop() : schematics_1.filter(path => !path.endsWith('.spec.ts')),
84
- options.inlineStyle ? schematics_1.filter(path => !path.endsWith('.__styleext__')) : schematics_1.noop(),
85
- options.inlineTemplate ? schematics_1.filter(path => !path.endsWith('.html')) : schematics_1.noop(),
86
- schematics_1.template(Object.assign(Object.assign(Object.assign({}, core_1.strings), { 'if-flat': (s) => options.flat ? '' : s }), options)),
87
- schematics_1.move(null, parsedPath.path),
81
+ (0, validation_1.validateName)(options.name);
82
+ const templateSource = (0, schematics_1.apply)((0, schematics_1.url)('./files'), [
83
+ options.spec ? (0, schematics_1.noop)() : (0, schematics_1.filter)(path => !path.endsWith('.spec.ts')),
84
+ options.inlineStyle ? (0, schematics_1.filter)(path => !path.endsWith('.__styleext__')) : (0, schematics_1.noop)(),
85
+ options.inlineTemplate ? (0, schematics_1.filter)(path => !path.endsWith('.html')) : (0, schematics_1.noop)(),
86
+ (0, schematics_1.template)(Object.assign(Object.assign(Object.assign({}, core_1.strings), { 'if-flat': (s) => options.flat ? '' : s }), options)),
87
+ (0, schematics_1.move)(null, parsedPath.path),
88
88
  ]);
89
- return schematics_1.chain([
90
- schematics_1.branchAndMerge(schematics_1.chain([
89
+ return (0, schematics_1.chain)([
90
+ (0, schematics_1.branchAndMerge)((0, schematics_1.chain)([
91
91
  addDeclarationToNgModule(options),
92
- schematics_1.mergeWith(templateSource),
92
+ (0, schematics_1.mergeWith)(templateSource),
93
93
  ])),
94
94
  ])(host, context);
95
95
  };
@@ -1 +1 @@
1
- {"version":3,"file":"component.js","sourceRoot":"","sources":["component.ts"],"names":[],"mappings":";;;AAAA,+CAAwD;AACxD,2DAcoC;AACpC,iCAAiC;AACjC,2CAAsE;AACtE,qCAAsC;AACtC,+CAAuE;AACvE,qCAAsC;AACtC,6CAAuC;AACvC,6CAA0C;AAE1C,SAAS,wBAAwB,CAAC,OAAY;IAC5C,OAAO,CAAC,IAAU,EAAE,EAAE;QACpB,IAAI,OAAO,CAAC,UAAU,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;YACzC,OAAO,IAAI,CAAC;SACb;QAED,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;QAClC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACnC,IAAI,IAAI,KAAK,IAAI,EAAE;YACjB,MAAM,IAAI,gCAAmB,CAAC,QAAQ,UAAU,kBAAkB,CAAC,CAAC;SACrE;QACD,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC1C,MAAM,MAA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CAAC,CAAC,CAAC,KAC5C,OAAO,EACV;YACF,iBAAI,CAAC,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC;SAC5B,CAAC,CAAC;QAEH,OAAO,kBAAK,CAAC;YACX,2BAAc,CAAC,kBAAK,CAAC;gBACnB,wBAAwB,CAAC,OAAO,CAAC;gBACjC,sBAAS,CAAC,cAAc,CAAC;aAC1B,CAAC,CAAC;SACJ,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC;AAxCD,wCAwCC","sourcesContent":["import {normalize, strings} from '@angular-devkit/core';\nimport {\n apply,\n branchAndMerge,\n chain,\n filter,\n mergeWith,\n move,\n noop,\n Rule,\n SchematicContext,\n SchematicsException,\n template,\n Tree,\n url,\n} from '@angular-devkit/schematics';\nimport * as ts from 'typescript';\nimport {addDeclarationToModule, addExportToModule} from './ast-utils';\nimport {InsertChange} from './change';\nimport {buildRelativePath, findModuleFromOptions} from './find-module';\nimport {getWorkspace} from './config';\nimport {parseName} from './parse-name';\nimport {validateName} from './validation';\n\nfunction addDeclarationToNgModule(options: any): Rule {\n return (host: Tree) => {\n if (options.skipImport || !options.module) {\n return host;\n }\n\n const modulePath = options.module;\n const text = host.read(modulePath);\n if (text === null) {\n throw new SchematicsException(`File ${modulePath} does not exist.`);\n }\n const sourceText = text.toString('utf-8');\n const source = ts.createSourceFile(modulePath, sourceText, ts.ScriptTarget.Latest, true);\n\n const componentPath = `/${options.path}/`\n + (options.flat ? '' : strings.dasherize(options.name) + '/')\n + strings.dasherize(options.name)\n + '.component';\n const relativePath = buildRelativePath(modulePath, componentPath);\n const classifiedName = strings.classify(`${options.name}Component`);\n const declarationChanges = addDeclarationToModule(source,\n modulePath,\n classifiedName,\n relativePath);\n\n const declarationRecorder = host.beginUpdate(modulePath);\n for (const change of declarationChanges) {\n if (change instanceof InsertChange) {\n declarationRecorder.insertLeft(change.pos, change.toAdd);\n }\n }\n host.commitUpdate(declarationRecorder);\n\n if (options.export) {\n // Need to refresh the AST because we overwrote the file in the host.\n const text = host.read(modulePath);\n if (text === null) {\n throw new SchematicsException(`File ${modulePath} does not exist.`);\n }\n const sourceText = text.toString('utf-8');\n const source = ts.createSourceFile(modulePath, sourceText, ts.ScriptTarget.Latest, true);\n\n const exportRecorder = host.beginUpdate(modulePath);\n const exportChanges = addExportToModule(source, modulePath,\n strings.classify(`${options.name}Component`),\n relativePath);\n\n for (const change of exportChanges) {\n if (change instanceof InsertChange) {\n exportRecorder.insertLeft(change.pos, change.toAdd);\n }\n }\n host.commitUpdate(exportRecorder);\n }\n\n\n return host;\n };\n}\n\n\nfunction buildSelector(options: any) {\n let selector = strings.dasherize(options.name);\n if (options.prefix) {\n selector = `${options.prefix}-${selector}`;\n }\n\n return selector;\n}\n\n\nexport function buildComponent(options: any): Rule {\n return (host: Tree, context: SchematicContext) => {\n const workspace = getWorkspace(host);\n if (!options.project) {\n options.project = Object.keys(workspace.projects)[0];\n }\n const project = workspace.projects[options.project];\n\n if (options.path === undefined) {\n options.path = `/${project.root}/src/app`;\n }\n\n options.selector = options.selector || buildSelector(options);\n options.module = findModuleFromOptions(host, options);\n\n const parsedPath = parseName(options.path, options.name);\n options.name = parsedPath.name;\n options.path = parsedPath.path;\n\n validateName(options.name);\n\n const templateSource = apply(url('./files'), [\n options.spec ? noop() : filter(path => !path.endsWith('.spec.ts')),\n options.inlineStyle ? filter(path => !path.endsWith('.__styleext__')) : noop(),\n options.inlineTemplate ? filter(path => !path.endsWith('.html')) : noop(),\n template({\n ...strings,\n 'if-flat': (s: string) => options.flat ? '' : s,\n ...options,\n }),\n move(null, parsedPath.path),\n ]);\n\n return chain([\n branchAndMerge(chain([\n addDeclarationToNgModule(options),\n mergeWith(templateSource),\n ])),\n ])(host, context);\n };\n}\n"]}
1
+ {"version":3,"file":"component.js","sourceRoot":"","sources":["component.ts"],"names":[],"mappings":";;;AAAA,+CAAwD;AACxD,2DAcoC;AACpC,iCAAiC;AACjC,2CAAsE;A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AAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAA,iBAAI,GAAE,CAAC,CAAC,CAAC,IAAA,mBAAM,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;YAClE,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,IAAA,mBAAM,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,IAAA,iBAAI,GAAE;YAC9E,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,IAAA,mBAAM,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,IAAA,iBAAI,GAAE;YACzE,IAAA,qBAAQ,gDACH,cAAO,KACV,SAAS,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAC5C,OAAO,EACV;YACF,IAAA,iBAAI,EAAC,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC;SAC5B,CAAC,CAAC;QAEH,OAAO,IAAA,kBAAK,EAAC;YACX,IAAA,2BAAc,EAAC,IAAA,kBAAK,EAAC;gBACnB,wBAAwB,CAAC,OAAO,CAAC;gBACjC,IAAA,sBAAS,EAAC,cAAc,CAAC;aAC1B,CAAC,CAAC;SACJ,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC;AAxCD,wCAwCC","sourcesContent":["import {normalize, strings} from '@angular-devkit/core';\nimport {\n apply,\n branchAndMerge,\n chain,\n filter,\n mergeWith,\n move,\n noop,\n Rule,\n SchematicContext,\n SchematicsException,\n template,\n Tree,\n url,\n} from '@angular-devkit/schematics';\nimport * as ts from 'typescript';\nimport {addDeclarationToModule, addExportToModule} from './ast-utils';\nimport {InsertChange} from './change';\nimport {buildRelativePath, findModuleFromOptions} from './find-module';\nimport {getWorkspace} from './config';\nimport {parseName} from './parse-name';\nimport {validateName} from './validation';\n\nfunction addDeclarationToNgModule(options: any): Rule {\n return (host: Tree) => {\n if (options.skipImport || !options.module) {\n return host;\n }\n\n const modulePath = options.module;\n const text = host.read(modulePath);\n if (text === null) {\n throw new SchematicsException(`File ${modulePath} does not exist.`);\n }\n const sourceText = text.toString('utf-8');\n const source = ts.createSourceFile(modulePath, sourceText, ts.ScriptTarget.Latest, true);\n\n const componentPath = `/${options.path}/`\n + (options.flat ? '' : strings.dasherize(options.name) + '/')\n + strings.dasherize(options.name)\n + '.component';\n const relativePath = buildRelativePath(modulePath, componentPath);\n const classifiedName = strings.classify(`${options.name}Component`);\n const declarationChanges = addDeclarationToModule(source,\n modulePath,\n classifiedName,\n relativePath);\n\n const declarationRecorder = host.beginUpdate(modulePath);\n for (const change of declarationChanges) {\n if (change instanceof InsertChange) {\n declarationRecorder.insertLeft(change.pos, change.toAdd);\n }\n }\n host.commitUpdate(declarationRecorder);\n\n if (options.export) {\n // Need to refresh the AST because we overwrote the file in the host.\n const text = host.read(modulePath);\n if (text === null) {\n throw new SchematicsException(`File ${modulePath} does not exist.`);\n }\n const sourceText = text.toString('utf-8');\n const source = ts.createSourceFile(modulePath, sourceText, ts.ScriptTarget.Latest, true);\n\n const exportRecorder = host.beginUpdate(modulePath);\n const exportChanges = addExportToModule(source, modulePath,\n strings.classify(`${options.name}Component`),\n relativePath);\n\n for (const change of exportChanges) {\n if (change instanceof InsertChange) {\n exportRecorder.insertLeft(change.pos, change.toAdd);\n }\n }\n host.commitUpdate(exportRecorder);\n }\n\n\n return host;\n };\n}\n\n\nfunction buildSelector(options: any) {\n let selector = strings.dasherize(options.name);\n if (options.prefix) {\n selector = `${options.prefix}-${selector}`;\n }\n\n return selector;\n}\n\n\nexport function buildComponent(options: any): Rule {\n return (host: Tree, context: SchematicContext) => {\n const workspace = getWorkspace(host);\n if (!options.project) {\n options.project = Object.keys(workspace.projects)[0];\n }\n const project = workspace.projects[options.project];\n\n if (options.path === undefined) {\n options.path = `/${project.root}/src/app`;\n }\n\n options.selector = options.selector || buildSelector(options);\n options.module = findModuleFromOptions(host, options);\n\n const parsedPath = parseName(options.path, options.name);\n options.name = parsedPath.name;\n options.path = parsedPath.path;\n\n validateName(options.name);\n\n const templateSource = apply(url('./files'), [\n options.spec ? noop() : filter(path => !path.endsWith('.spec.ts')),\n options.inlineStyle ? filter(path => !path.endsWith('.__styleext__')) : noop(),\n options.inlineTemplate ? filter(path => !path.endsWith('.html')) : noop(),\n template({\n ...strings,\n 'if-flat': (s: string) => options.flat ? '' : s,\n ...options,\n }),\n move(null, parsedPath.path),\n ]);\n\n return chain([\n branchAndMerge(chain([\n addDeclarationToNgModule(options),\n mergeWith(templateSource),\n ])),\n ])(host, context);\n };\n}\n"]}
@@ -19,22 +19,22 @@ function findModuleFromOptions(host, options) {
19
19
  if (!options.module) {
20
20
  const pathToCheck = (options.path || '')
21
21
  + (options.flat ? '' : '/' + core_1.strings.dasherize(options.name));
22
- return core_1.normalize(findModule(host, pathToCheck));
22
+ return (0, core_1.normalize)(findModule(host, pathToCheck));
23
23
  }
24
24
  else {
25
- const modulePath = core_1.normalize('/' + (options.path) + '/' + options.module);
26
- const moduleBaseName = core_1.normalize(modulePath).split('/').pop();
25
+ const modulePath = (0, core_1.normalize)('/' + (options.path) + '/' + options.module);
26
+ const moduleBaseName = (0, core_1.normalize)(modulePath).split('/').pop();
27
27
  if (host.exists(modulePath)) {
28
- return core_1.normalize(modulePath);
28
+ return (0, core_1.normalize)(modulePath);
29
29
  }
30
30
  else if (host.exists(modulePath + '.ts')) {
31
- return core_1.normalize(modulePath + '.ts');
31
+ return (0, core_1.normalize)(modulePath + '.ts');
32
32
  }
33
33
  else if (host.exists(modulePath + '.module.ts')) {
34
- return core_1.normalize(modulePath + '.module.ts');
34
+ return (0, core_1.normalize)(modulePath + '.module.ts');
35
35
  }
36
36
  else if (host.exists(modulePath + '/' + moduleBaseName + '.module.ts')) {
37
- return core_1.normalize(modulePath + '/' + moduleBaseName + '.module.ts');
37
+ return (0, core_1.normalize)(modulePath + '/' + moduleBaseName + '.module.ts');
38
38
  }
39
39
  else {
40
40
  throw new Error('Specified module does not exist');
@@ -52,7 +52,7 @@ function findModule(host, generateDir) {
52
52
  while (dir) {
53
53
  const matches = dir.subfiles.filter(p => moduleRe.test(p) && !routingModuleRe.test(p));
54
54
  if (matches.length == 1) {
55
- return core_1.join(dir.path, matches[0]);
55
+ return (0, core_1.join)(dir.path, matches[0]);
56
56
  }
57
57
  else if (matches.length > 1) {
58
58
  throw new Error('More than one module matches. Use skip-import option to skip importing '
@@ -68,15 +68,15 @@ exports.findModule = findModule;
68
68
  * Build a relative path from one file path to another file path.
69
69
  */
70
70
  function buildRelativePath(from, to) {
71
- from = core_1.normalize(from);
72
- to = core_1.normalize(to);
71
+ from = (0, core_1.normalize)(from);
72
+ to = (0, core_1.normalize)(to);
73
73
  // Convert to arrays.
74
74
  const fromParts = from.split('/');
75
75
  const toParts = to.split('/');
76
76
  // Remove file names (preserving destination)
77
77
  fromParts.pop();
78
78
  const toFileName = toParts.pop();
79
- const relativePath = core_1.relative(core_1.normalize(fromParts.join('/')), core_1.normalize(toParts.join('/')));
79
+ const relativePath = (0, core_1.relative)((0, core_1.normalize)(fromParts.join('/')), (0, core_1.normalize)(toParts.join('/')));
80
80
  let pathPrefix = '';
81
81
  // Set the path prefix for same dir or child dir, parent dir starts with `..`
82
82
  if (!relativePath) {
@@ -1 +1 @@
1
- {"version":3,"file":"find-module.js","sourceRoot":"","sources":["find-module.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,+CAAgF;AAahF;;GAEG;AACH,SAAgB,qBAAqB,CAAC,IAAU,EAAE,OAAsB;IACtE,IAAI,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,UAAU,EAAE;QAC9D,OAAO,SAAS,CAAC;K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eAAQ,CAAC,gBAAS,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,gBAAS,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC5F,IAAI,UAAU,GAAG,EAAE,CAAC;IAEpB,6EAA6E;IAC7E,IAAI,CAAC,YAAY,EAAE;QACjB,UAAU,GAAG,GAAG,CAAC;KAClB;SAAM,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QACxC,UAAU,GAAG,IAAI,CAAC;KACnB;IACD,IAAI,UAAU,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QAC3C,UAAU,IAAI,GAAG,CAAC;KACnB;IAED,OAAO,UAAU,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC;AAC5E,CAAC;AA1BD,8CA0BC","sourcesContent":["/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport { Path, join, normalize, relative, strings } from '@angular-devkit/core';\nimport { DirEntry, Tree } from '@angular-devkit/schematics';\n\n\nexport interface ModuleOptions {\n module?: string;\n name: string;\n flat?: boolean;\n path?: string;\n skipImport?: boolean;\n}\n\n\n/**\n * Find the module referred by a set of options passed to the schematics.\n */\nexport function findModuleFromOptions(host: Tree, options: ModuleOptions): Path | undefined {\n if (options.hasOwnProperty('skipImport') && options.skipImport) {\n return undefined;\n }\n\n if (!options.module) {\n const pathToCheck = (options.path || '')\n + (options.flat ? '' : '/' + strings.dasherize(options.name));\n\n return normalize(findModule(host, pathToCheck));\n } else {\n const modulePath = normalize(\n '/' + (options.path) + '/' + options.module);\n const moduleBaseName = normalize(modulePath).split('/').pop();\n\n if (host.exists(modulePath)) {\n return normalize(modulePath);\n } else if (host.exists(modulePath + '.ts')) {\n return normalize(modulePath + '.ts');\n } else if (host.exists(modulePath + '.module.ts')) {\n return normalize(modulePath + '.module.ts');\n } else if (host.exists(modulePath + '/' + moduleBaseName + '.module.ts')) {\n return normalize(modulePath + '/' + moduleBaseName + '.module.ts');\n } else {\n throw new Error('Specified module does not exist');\n }\n }\n}\n\n/**\n * Function to find the \"closest\" module to a generated file's path.\n */\nexport function findModule(host: Tree, generateDir: string): Path {\n let dir: DirEntry | null = host.getDir('/' + generateDir);\n\n const moduleRe = /\\.module\\.ts$/;\n const routingModuleRe = /-routing\\.module\\.ts/;\n\n while (dir) {\n const matches = dir.subfiles.filter(p => moduleRe.test(p) && !routingModuleRe.test(p));\n\n if (matches.length == 1) {\n return join(dir.path, matches[0]);\n } else if (matches.length > 1) {\n throw new Error('More than one module matches. Use skip-import option to skip importing '\n + 'the component into the closest module.');\n }\n\n dir = dir.parent;\n }\n\n throw new Error('Could not find an NgModule. Use the skip-import '\n + 'option to skip importing in NgModule.');\n}\n\n/**\n * Build a relative path from one file path to another file path.\n */\nexport function buildRelativePath(from: string, to: string): string {\n from = normalize(from);\n to = normalize(to);\n\n // Convert to arrays.\n const fromParts = from.split('/');\n const toParts = to.split('/');\n\n // Remove file names (preserving destination)\n fromParts.pop();\n const toFileName = toParts.pop();\n\n const relativePath = relative(normalize(fromParts.join('/')), normalize(toParts.join('/')));\n let pathPrefix = '';\n\n // Set the path prefix for same dir or child dir, parent dir starts with `..`\n if (!relativePath) {\n pathPrefix = '.';\n } else if (!relativePath.startsWith('.')) {\n pathPrefix = `./`;\n }\n if (pathPrefix && !pathPrefix.endsWith('/')) {\n pathPrefix += '/';\n }\n\n return pathPrefix + (relativePath ? relativePath + '/' : '') + toFileName;\n}\n"]}
1
+ {"version":3,"file":"find-module.js","sourceRoot":"","sources":["find-module.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,+CAAgF;AAahF;;GAEG;AACH,SAAgB,qBAAqB,CAAC,IAAU,EAAE,OAAsB;IAC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KAAK,CAAC,GAAG,CAAC,CAAC;IAE9B,6CAA6C;IAC7C,SAAS,CAAC,GAAG,EAAE,CAAC;IAChB,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAEjC,MAAM,YAAY,GAAG,IAAA,eAAQ,EAAC,IAAA,gBAAS,EAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAA,gBAAS,EAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC5F,IAAI,UAAU,GAAG,EAAE,CAAC;IAEpB,6EAA6E;IAC7E,IAAI,CAAC,YAAY,EAAE;QACjB,UAAU,GAAG,GAAG,CAAC;KAClB;SAAM,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QACxC,UAAU,GAAG,IAAI,CAAC;KACnB;IACD,IAAI,UAAU,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QAC3C,UAAU,IAAI,GAAG,CAAC;KACnB;IAED,OAAO,UAAU,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC;AAC5E,CAAC;AA1BD,8CA0BC","sourcesContent":["/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport { Path, join, normalize, relative, strings } from '@angular-devkit/core';\nimport { DirEntry, Tree } from '@angular-devkit/schematics';\n\n\nexport interface ModuleOptions {\n module?: string;\n name: string;\n flat?: boolean;\n path?: string;\n skipImport?: boolean;\n}\n\n\n/**\n * Find the module referred by a set of options passed to the schematics.\n */\nexport function findModuleFromOptions(host: Tree, options: ModuleOptions): Path | undefined {\n if (options.hasOwnProperty('skipImport') && options.skipImport) {\n return undefined;\n }\n\n if (!options.module) {\n const pathToCheck = (options.path || '')\n + (options.flat ? '' : '/' + strings.dasherize(options.name));\n\n return normalize(findModule(host, pathToCheck));\n } else {\n const modulePath = normalize(\n '/' + (options.path) + '/' + options.module);\n const moduleBaseName = normalize(modulePath).split('/').pop();\n\n if (host.exists(modulePath)) {\n return normalize(modulePath);\n } else if (host.exists(modulePath + '.ts')) {\n return normalize(modulePath + '.ts');\n } else if (host.exists(modulePath + '.module.ts')) {\n return normalize(modulePath + '.module.ts');\n } else if (host.exists(modulePath + '/' + moduleBaseName + '.module.ts')) {\n return normalize(modulePath + '/' + moduleBaseName + '.module.ts');\n } else {\n throw new Error('Specified module does not exist');\n }\n }\n}\n\n/**\n * Function to find the \"closest\" module to a generated file's path.\n */\nexport function findModule(host: Tree, generateDir: string): Path {\n let dir: DirEntry | null = host.getDir('/' + generateDir);\n\n const moduleRe = /\\.module\\.ts$/;\n const routingModuleRe = /-routing\\.module\\.ts/;\n\n while (dir) {\n const matches = dir.subfiles.filter(p => moduleRe.test(p) && !routingModuleRe.test(p));\n\n if (matches.length == 1) {\n return join(dir.path, matches[0]);\n } else if (matches.length > 1) {\n throw new Error('More than one module matches. Use skip-import option to skip importing '\n + 'the component into the closest module.');\n }\n\n dir = dir.parent;\n }\n\n throw new Error('Could not find an NgModule. Use the skip-import '\n + 'option to skip importing in NgModule.');\n}\n\n/**\n * Build a relative path from one file path to another file path.\n */\nexport function buildRelativePath(from: string, to: string): string {\n from = normalize(from);\n to = normalize(to);\n\n // Convert to arrays.\n const fromParts = from.split('/');\n const toParts = to.split('/');\n\n // Remove file names (preserving destination)\n fromParts.pop();\n const toFileName = toParts.pop();\n\n const relativePath = relative(normalize(fromParts.join('/')), normalize(toParts.join('/')));\n let pathPrefix = '';\n\n // Set the path prefix for same dir or child dir, parent dir starts with `..`\n if (!relativePath) {\n pathPrefix = '.';\n } else if (!relativePath.startsWith('.')) {\n pathPrefix = `./`;\n }\n if (pathPrefix && !pathPrefix.endsWith('/')) {\n pathPrefix += '/';\n }\n\n return pathPrefix + (relativePath ? relativePath + '/' : '') + toFileName;\n}\n"]}
@@ -20,11 +20,11 @@ function findBootstrapModuleCall(host, mainPath) {
20
20
  }
21
21
  const mainText = mainBuffer.toString('utf-8');
22
22
  const source = ts.createSourceFile(mainPath, mainText, ts.ScriptTarget.Latest, true);
23
- const allNodes = ast_utils_1.getSourceNodes(source);
23
+ const allNodes = (0, ast_utils_1.getSourceNodes)(source);
24
24
  let bootstrapCall = null;
25
25
  for (const node of allNodes) {
26
26
  let bootstrapCallNode = null;
27
- bootstrapCallNode = ast_utils_1.findNode(node, ts.SyntaxKind.Identifier, 'bootstrapModule');
27
+ bootstrapCallNode = (0, ast_utils_1.findNode)(node, ts.SyntaxKind.Identifier, 'bootstrapModule');
28
28
  // Walk up the parent until CallExpression is found.
29
29
  while (bootstrapCallNode && bootstrapCallNode.parent
30
30
  && bootstrapCallNode.parent.kind !== ts.SyntaxKind.CallExpression) {
@@ -52,11 +52,11 @@ function findBootstrapModulePath(host, mainPath) {
52
52
  }
53
53
  const mainText = mainBuffer.toString('utf-8');
54
54
  const source = ts.createSourceFile(mainPath, mainText, ts.ScriptTarget.Latest, true);
55
- const allNodes = ast_utils_1.getSourceNodes(source);
55
+ const allNodes = (0, ast_utils_1.getSourceNodes)(source);
56
56
  const bootstrapModuleRelativePath = allNodes
57
57
  .filter(node => node.kind === ts.SyntaxKind.ImportDeclaration)
58
58
  .filter(imp => {
59
- return ast_utils_1.findNode(imp, ts.SyntaxKind.Identifier, bootstrapModule.getText());
59
+ return (0, ast_utils_1.findNode)(imp, ts.SyntaxKind.Identifier, bootstrapModule.getText());
60
60
  })
61
61
  .map((imp) => {
62
62
  const modulePathStringLiteral = imp.moduleSpecifier;
@@ -67,8 +67,8 @@ function findBootstrapModulePath(host, mainPath) {
67
67
  exports.findBootstrapModulePath = findBootstrapModulePath;
68
68
  function getAppModulePath(host, mainPath) {
69
69
  const moduleRelativePath = findBootstrapModulePath(host, mainPath);
70
- const mainDir = path_1.dirname(mainPath);
71
- const modulePath = core_1.normalize(`/${mainDir}/${moduleRelativePath}.ts`);
70
+ const mainDir = (0, path_1.dirname)(mainPath);
71
+ const modulePath = (0, core_1.normalize)(`/${mainDir}/${moduleRelativePath}.ts`);
72
72
  return modulePath;
73
73
  }
74
74
  exports.getAppModulePath = getAppModulePath;
@@ -1 +1 @@
1
- {"version":3,"file":"ng-ast-utils.js","sourceRoot":"","sources":["ng-ast-utils.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,+CAAiD;AACjD,2DAAuE;AACvE,+BAA+B;AAC/B,iCAAiC;AACjC,2CAAuD;AAEvD,SAAgB,uBAAuB,CAAC,IAAU,EAAE,QAAgB;IAClE,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACvC,IAAI,CAAC,UAAU,EAAE;QACf,MAAM,IAAI,gCAAmB,CAAC,cAAc,QAAQ,aAAa,CAAC,CAAC;KACpE;IACD,MAAM,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC9C,MAAM,MAAM,GAAG,EAAE,CAAC,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAErF,MAAM,QAAQ,GAAG,0BAAc,CAAC,MAAM,CAAC,CAAC;IAExC,IAAI,aAAa,GAA6B,IAAI,CAAC;IAEnD,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE;QAE3B,IAAI,iBAAiB,GAAmB,IAAI,CAAC;QAC7C,iBAAiB,GAAG,oBAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;QAEhF,oDAAoD;QACpD,OAAO,iBAAiB,IAAI,iBAAiB,CAAC,MAAM;eAC/C,iBAAiB,CAAC,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC,UAAU,CAAC,cAAc,EAAE;YAEnE,iBAAiB,GAAG,iBAAiB,CAAC,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,EAAE,eAAe,CAAC,OAAO,EAAE,CAAC,CAAC;IAC5E,CAAC,CAAC;SACD,GAAG,CAAC,CAAC,GAAyB,EAAE,EAAE;QACjC,MAAM,uBAAuB,GAAsB,GAAG,CAAC,eAAe,CAAC;QAEvE,OAAO,uBAAuB,CAAC,IAAI,CAAC;IACtC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAER,OAAO,2BAA2B,CAAC;AACrC,CAAC;AA3BD,0DA2BC;AAED,SAAgB,gBAAgB,CAAC,IAAU,EAAE,QAAgB;IAC3D,MAAM,kBAAkB,GAAG,uBAAuB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACnE,MAAM,OAAO,GAAG,cAAO,CAAC,QAAQ,CAAC,CAAC;IAClC,MAAM,UAAU,GAAG,gBAAS,CAAC,IAAI,OAAO,IAAI,kBAAkB,KAAK,CAAC,CAAC;IAErE,OAAO,UAAU,CAAC;AACpB,CAAC;AAND,4CAMC","sourcesContent":["/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport { normalize } from '@angular-devkit/core';\nimport { SchematicsException, Tree } from '@angular-devkit/schematics';\nimport { dirname } from 'path';\nimport * as ts from 'typescript';\nimport { findNode, getSourceNodes } from './ast-utils';\n\nexport function findBootstrapModuleCall(host: Tree, mainPath: string): ts.CallExpression | null {\n const mainBuffer = host.read(mainPath);\n if (!mainBuffer) {\n throw new SchematicsException(`Main file (${mainPath}) not found`);\n }\n const mainText = mainBuffer.toString('utf-8');\n const source = ts.createSourceFile(mainPath, mainText, ts.ScriptTarget.Latest, true);\n\n const allNodes = getSourceNodes(source);\n\n let bootstrapCall: ts.CallExpression | null = null;\n\n for (const node of allNodes) {\n\n let bootstrapCallNode: ts.Node | null = null;\n bootstrapCallNode = findNode(node, ts.SyntaxKind.Identifier, 'bootstrapModule');\n\n // Walk up the parent until CallExpression is found.\n while (bootstrapCallNode && bootstrapCallNode.parent\n && bootstrapCallNode.parent.kind !== ts.SyntaxKind.CallExpression) {\n\n bootstrapCallNode = bootstrapCallNode.parent;\n }\n\n if (bootstrapCallNode !== null &&\n bootstrapCallNode.parent !== undefined &&\n bootstrapCallNode.parent.kind === ts.SyntaxKind.CallExpression) {\n bootstrapCall = bootstrapCallNode.parent as ts.CallExpression;\n break;\n }\n }\n\n return bootstrapCall;\n}\n\nexport function findBootstrapModulePath(host: Tree, mainPath: string): string {\n const bootstrapCall = findBootstrapModuleCall(host, mainPath);\n if (!bootstrapCall) {\n throw new SchematicsException('Bootstrap call not found');\n }\n\n const bootstrapModule = bootstrapCall.arguments[0];\n\n const mainBuffer = host.read(mainPath);\n if (!mainBuffer) {\n throw new SchematicsException(`Client app main file (${mainPath}) not found`);\n }\n const mainText = mainBuffer.toString('utf-8');\n const source = ts.createSourceFile(mainPath, mainText, ts.ScriptTarget.Latest, true);\n const allNodes = getSourceNodes(source);\n const bootstrapModuleRelativePath = allNodes\n .filter(node => node.kind === ts.SyntaxKind.ImportDeclaration)\n .filter(imp => {\n return findNode(imp, ts.SyntaxKind.Identifier, bootstrapModule.getText());\n })\n .map((imp: ts.ImportDeclaration) => {\n const modulePathStringLiteral = <ts.StringLiteral> imp.moduleSpecifier;\n\n return modulePathStringLiteral.text;\n })[0];\n\n return bootstrapModuleRelativePath;\n}\n\nexport function getAppModulePath(host: Tree, mainPath: string): string {\n const moduleRelativePath = findBootstrapModulePath(host, mainPath);\n const mainDir = dirname(mainPath);\n const modulePath = normalize(`/${mainDir}/${moduleRelativePath}.ts`);\n\n return modulePath;\n}\n"]}
1
+ {"version":3,"file":"ng-ast-utils.js","sourceRoot":"","sources":["ng-ast-utils.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,+CAAiD;AACjD,2DAAuE;AACvE,+BAA+B;AAC/B,iCAAiC;AACjC,2CAAuD;AAEvD,SAAgB,uBAAuB,CAAC,IAAU,EAAE,QAAgB;IAClE,MAAM,UAAU,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,CAAC,CAAC;IACnE,MAAM,OAAO,GAAG,IAAA,cAAO,EAAC,QAAQ,CAAC,CAAC;IAClC,MAAM,UAAU,GAAG,IAAA,gBAAS,EAAC,IAAI,OAAO,IAAI,kBAAkB,KAAK,CAAC,CAAC;IAErE,OAAO,UAAU,CAAC;AACpB,CAAC;AAND,4CAMC","sourcesContent":["/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport { normalize } from '@angular-devkit/core';\nimport { SchematicsException, Tree } from '@angular-devkit/schematics';\nimport { dirname } from 'path';\nimport * as ts from 'typescript';\nimport { findNode, getSourceNodes } from './ast-utils';\n\nexport function findBootstrapModuleCall(host: Tree, mainPath: string): ts.CallExpression | null {\n const mainBuffer = host.read(mainPath);\n if (!mainBuffer) {\n throw new SchematicsException(`Main file (${mainPath}) not found`);\n }\n const mainText = mainBuffer.toString('utf-8');\n const source = ts.createSourceFile(mainPath, mainText, ts.ScriptTarget.Latest, true);\n\n const allNodes = getSourceNodes(source);\n\n let bootstrapCall: ts.CallExpression | null = null;\n\n for (const node of allNodes) {\n\n let bootstrapCallNode: ts.Node | null = null;\n bootstrapCallNode = findNode(node, ts.SyntaxKind.Identifier, 'bootstrapModule');\n\n // Walk up the parent until CallExpression is found.\n while (bootstrapCallNode && bootstrapCallNode.parent\n && bootstrapCallNode.parent.kind !== ts.SyntaxKind.CallExpression) {\n\n bootstrapCallNode = bootstrapCallNode.parent;\n }\n\n if (bootstrapCallNode !== null &&\n bootstrapCallNode.parent !== undefined &&\n bootstrapCallNode.parent.kind === ts.SyntaxKind.CallExpression) {\n bootstrapCall = bootstrapCallNode.parent as ts.CallExpression;\n break;\n }\n }\n\n return bootstrapCall;\n}\n\nexport function findBootstrapModulePath(host: Tree, mainPath: string): string {\n const bootstrapCall = findBootstrapModuleCall(host, mainPath);\n if (!bootstrapCall) {\n throw new SchematicsException('Bootstrap call not found');\n }\n\n const bootstrapModule = bootstrapCall.arguments[0];\n\n const mainBuffer = host.read(mainPath);\n if (!mainBuffer) {\n throw new SchematicsException(`Client app main file (${mainPath}) not found`);\n }\n const mainText = mainBuffer.toString('utf-8');\n const source = ts.createSourceFile(mainPath, mainText, ts.ScriptTarget.Latest, true);\n const allNodes = getSourceNodes(source);\n const bootstrapModuleRelativePath = allNodes\n .filter(node => node.kind === ts.SyntaxKind.ImportDeclaration)\n .filter(imp => {\n return findNode(imp, ts.SyntaxKind.Identifier, bootstrapModule.getText());\n })\n .map((imp: ts.ImportDeclaration) => {\n const modulePathStringLiteral = <ts.StringLiteral> imp.moduleSpecifier;\n\n return modulePathStringLiteral.text;\n })[0];\n\n return bootstrapModuleRelativePath;\n}\n\nexport function getAppModulePath(host: Tree, mainPath: string): string {\n const moduleRelativePath = findBootstrapModulePath(host, mainPath);\n const mainDir = dirname(mainPath);\n const modulePath = normalize(`/${mainDir}/${moduleRelativePath}.ts`);\n\n return modulePath;\n}\n"]}
@@ -10,11 +10,11 @@ exports.parseName = void 0;
10
10
  */
11
11
  const core_1 = require("@angular-devkit/core");
12
12
  function parseName(path, name) {
13
- const nameWithoutPath = core_1.basename(name);
14
- const namePath = core_1.dirname((path + '/' + name));
13
+ const nameWithoutPath = (0, core_1.basename)(name);
14
+ const namePath = (0, core_1.dirname)((path + '/' + name));
15
15
  return {
16
16
  name: nameWithoutPath,
17
- path: core_1.normalize('/' + namePath),
17
+ path: (0, core_1.normalize)('/' + namePath),
18
18
  };
19
19
  }
20
20
  exports.parseName = parseName;
@@ -1 +1 @@
1
- {"version":3,"file":"parse-name.js","sourceRoot":"","sources":["parse-name.ts"],"names":[],"mappings":";;;AACA;;;;;;GAMG;AACH,+CAA0E;AAO1E,SAAgB,SAAS,CAAC,IAAY,EAAE,IAAY;IAClD,MAAM,eAAe,GAAG,eAAQ,CAAC,IAAY,CAAC,CAAC;IAC/C,MAAM,QAAQ,GAAG,cAAO,CAAC,CAAC,IAAI,GAAG,GAAG,GAAG,IAAI,CAAS,CAAC,CAAC;IAEtD,OAAO;QACL,IAAI,EAAE,eAAe;QACrB,IAAI,EAAE,gBAAS,CAAC,GAAG,GAAG,QAAQ,CAAC;KAChC,CAAC;AACJ,CAAC;AARD,8BAQC","sourcesContent":["\n/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport { Path, basename, dirname, normalize } from '@angular-devkit/core';\n\nexport interface Location {\n name: string;\n path: Path;\n}\n\nexport function parseName(path: string, name: string): Location {\n const nameWithoutPath = basename(name as Path);\n const namePath = dirname((path + '/' + name) as Path);\n\n return {\n name: nameWithoutPath,\n path: normalize('/' + namePath),\n };\n}\n"]}
1
+ {"version":3,"file":"parse-name.js","sourceRoot":"","sources":["parse-name.ts"],"names":[],"mappings":";;;AACA;;;;;;GAMG;AACH,+CAA0E;AAO1E,SAAgB,SAAS,CAAC,IAAY,EAAE,IAAY;IAClD,MAAM,eAAe,GAAG,IAAA,eAAQ,EAAC,IAAY,CAAC,CAAC;IAC/C,MAAM,QAAQ,GAAG,IAAA,cAAO,EAAC,CAAC,IAAI,GAAG,GAAG,GAAG,IAAI,CAAS,CAAC,CAAC;IAEtD,OAAO;QACL,IAAI,EAAE,eAAe;QACrB,IAAI,EAAE,IAAA,gBAAS,EAAC,GAAG,GAAG,QAAQ,CAAC;KAChC,CAAC;AACJ,CAAC;AARD,8BAQC","sourcesContent":["\n/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport { Path, basename, dirname, normalize } from '@angular-devkit/core';\n\nexport interface Location {\n name: string;\n path: Path;\n}\n\nexport function parseName(path: string, name: string): Location {\n const nameWithoutPath = basename(name as Path);\n const namePath = dirname((path + '/' + name) as Path);\n\n return {\n name: nameWithoutPath,\n path: normalize('/' + namePath),\n };\n}\n"]}
@@ -23,7 +23,7 @@ const schematics_1 = require("@angular-devkit/schematics");
23
23
  */
24
24
  function insertImport2(source, fileToEdit, symbolName, asSymbolName, fileName, isDefault = false) {
25
25
  const rootNode = source;
26
- const allImports = ast_utils_1.findNodes(rootNode, ts.SyntaxKind.ImportDeclaration);
26
+ const allImports = (0, ast_utils_1.findNodes)(rootNode, ts.SyntaxKind.ImportDeclaration);
27
27
  // get nodes that map to import statements from the file fileName
28
28
  const relevantImports = allImports.filter(node => {
29
29
  // StringLiteral of the ImportDeclaration is the import file (fileName in this case).
@@ -37,8 +37,8 @@ function insertImport2(source, fileToEdit, symbolName, asSymbolName, fileName, i
37
37
  // imports from import file
38
38
  const imports = [];
39
39
  relevantImports.forEach(n => {
40
- Array.prototype.push.apply(imports, ast_utils_1.findNodes(n, ts.SyntaxKind.Identifier));
41
- if (ast_utils_1.findNodes(n, ts.SyntaxKind.AsteriskToken).length > 0) {
40
+ Array.prototype.push.apply(imports, (0, ast_utils_1.findNodes)(n, ts.SyntaxKind.Identifier));
41
+ if ((0, ast_utils_1.findNodes)(n, ts.SyntaxKind.AsteriskToken).length > 0) {
42
42
  importsAsterisk = true;
43
43
  }
44
44
  });
@@ -49,14 +49,14 @@ function insertImport2(source, fileToEdit, symbolName, asSymbolName, fileName, i
49
49
  const importTextNodes = imports.filter(n => n.text === symbolName);
50
50
  // insert import if it's not there
51
51
  if (importTextNodes.length === 0) {
52
- const fallbackPos = ast_utils_1.findNodes(relevantImports[0], ts.SyntaxKind.CloseBraceToken)[0].getStart() ||
53
- ast_utils_1.findNodes(relevantImports[0], ts.SyntaxKind.FromKeyword)[0].getStart();
54
- return ast_utils_1.insertAfterLastOccurrence(imports, `, ${symbolName} as ${asSymbolName}`, fileToEdit, fallbackPos);
52
+ const fallbackPos = (0, ast_utils_1.findNodes)(relevantImports[0], ts.SyntaxKind.CloseBraceToken)[0].getStart() ||
53
+ (0, ast_utils_1.findNodes)(relevantImports[0], ts.SyntaxKind.FromKeyword)[0].getStart();
54
+ return (0, ast_utils_1.insertAfterLastOccurrence)(imports, `, ${symbolName} as ${asSymbolName}`, fileToEdit, fallbackPos);
55
55
  }
56
56
  return new change_1.NoopChange();
57
57
  }
58
58
  // no such import declaration exists
59
- const useStrict = ast_utils_1.findNodes(rootNode, ts.SyntaxKind.StringLiteral)
59
+ const useStrict = (0, ast_utils_1.findNodes)(rootNode, ts.SyntaxKind.StringLiteral)
60
60
  .filter((n) => n.text === 'use strict');
61
61
  let fallbackPos = 0;
62
62
  if (useStrict.length > 0) {
@@ -69,12 +69,12 @@ function insertImport2(source, fileToEdit, symbolName, asSymbolName, fileName, i
69
69
  const separator = insertAtBeginning ? '' : ';\n';
70
70
  const toInsert = `${separator}import ${open}${symbolName} as ${asSymbolName}${close}` +
71
71
  ` from '${fileName}'${insertAtBeginning ? ';\n' : ''}`;
72
- return ast_utils_1.insertAfterLastOccurrence(allImports, toInsert, fileToEdit, fallbackPos, ts.SyntaxKind.StringLiteral);
72
+ return (0, ast_utils_1.insertAfterLastOccurrence)(allImports, toInsert, fileToEdit, fallbackPos, ts.SyntaxKind.StringLiteral);
73
73
  }
74
74
  exports.insertImport2 = insertImport2;
75
75
  function insertImport(source, fileToEdit, symbolName, fileName, isDefault = false) {
76
76
  const rootNode = source;
77
- const allImports = ast_utils_1.findNodes(rootNode, ts.SyntaxKind.ImportDeclaration);
77
+ const allImports = (0, ast_utils_1.findNodes)(rootNode, ts.SyntaxKind.ImportDeclaration);
78
78
  // get nodes that map to import statements from the file fileName
79
79
  const relevantImports = allImports.filter(node => {
80
80
  // StringLiteral of the ImportDeclaration is the import file (fileName in this case).
@@ -88,8 +88,8 @@ function insertImport(source, fileToEdit, symbolName, fileName, isDefault = fals
88
88
  // imports from import file
89
89
  const imports = [];
90
90
  relevantImports.forEach(n => {
91
- Array.prototype.push.apply(imports, ast_utils_1.findNodes(n, ts.SyntaxKind.Identifier));
92
- if (ast_utils_1.findNodes(n, ts.SyntaxKind.AsteriskToken).length > 0) {
91
+ Array.prototype.push.apply(imports, (0, ast_utils_1.findNodes)(n, ts.SyntaxKind.Identifier));
92
+ if ((0, ast_utils_1.findNodes)(n, ts.SyntaxKind.AsteriskToken).length > 0) {
93
93
  importsAsterisk = true;
94
94
  }
95
95
  });
@@ -100,14 +100,14 @@ function insertImport(source, fileToEdit, symbolName, fileName, isDefault = fals
100
100
  const importTextNodes = imports.filter(n => n.text === symbolName);
101
101
  // insert import if it's not there
102
102
  if (importTextNodes.length === 0) {
103
- const fallbackPos = ast_utils_1.findNodes(relevantImports[0], ts.SyntaxKind.CloseBraceToken)[0].getStart() ||
104
- ast_utils_1.findNodes(relevantImports[0], ts.SyntaxKind.FromKeyword)[0].getStart();
105
- return ast_utils_1.insertAfterLastOccurrence(imports, `, ${symbolName}`, fileToEdit, fallbackPos);
103
+ const fallbackPos = (0, ast_utils_1.findNodes)(relevantImports[0], ts.SyntaxKind.CloseBraceToken)[0].getStart() ||
104
+ (0, ast_utils_1.findNodes)(relevantImports[0], ts.SyntaxKind.FromKeyword)[0].getStart();
105
+ return (0, ast_utils_1.insertAfterLastOccurrence)(imports, `, ${symbolName}`, fileToEdit, fallbackPos);
106
106
  }
107
107
  return new change_1.NoopChange();
108
108
  }
109
109
  // no such import declaration exists
110
- const useStrict = ast_utils_1.findNodes(rootNode, ts.SyntaxKind.StringLiteral)
110
+ const useStrict = (0, ast_utils_1.findNodes)(rootNode, ts.SyntaxKind.StringLiteral)
111
111
  .filter((n) => n.text === 'use strict');
112
112
  let fallbackPos = 0;
113
113
  if (useStrict.length > 0) {
@@ -120,7 +120,7 @@ function insertImport(source, fileToEdit, symbolName, fileName, isDefault = fals
120
120
  const separator = insertAtBeginning ? '' : ';\n';
121
121
  const toInsert = `${separator}import ${open}${symbolName}${close}` +
122
122
  ` from '${fileName}'${insertAtBeginning ? ';\n' : ''}`;
123
- return ast_utils_1.insertAfterLastOccurrence(allImports, toInsert, fileToEdit, fallbackPos, ts.SyntaxKind.StringLiteral);
123
+ return (0, ast_utils_1.insertAfterLastOccurrence)(allImports, toInsert, fileToEdit, fallbackPos, ts.SyntaxKind.StringLiteral);
124
124
  }
125
125
  exports.insertImport = insertImport;
126
126
  function getSourceFile(host, path) {
@@ -1 +1 @@
1
- {"version":3,"file":"route-utils.js","sourceRoot":"","sources":["route-utils.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,iCAAiC;AACjC,2CAA6E;AAC7E,qCAA4D;AAC5D,2DAAqE;AAGrE;;;;;;;;EAQE;AAEF,SAAgB,aAAa,CAC3B,MAA2B,EAC3B,UAAoB,EACpB,UAAoB,EACpB,YAAoB,EACpB,QAAoB,EACpB,SAAS,GAAG,KAAK;IACjB,MAAM,QAAQ,GAAG,MAAM,CAAC;IACxB,MAAM,UAAU,GAAG,qBAAS,CAAC,QAAQ,EAAE,EAAE,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;IAExE,iEAAiE;IACjE,MAAM,eAAe,GAAG,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;QAC/C,qFAAqF;QACrF,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,EAAE;aACnC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC;aAC3D,GAAG,CAAC,CAAC,CAAC,EAAE,CAAE,CAAsB,CAAC,IAAI,CAAC,CAAC;QAE1C,OAAO,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;IAEH,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE;QAC9B,IAAI,eAAe,GAAG,KAAK,CAAC;QAC5B,2BAA2B;QAC3B,MAAM,OAAO,GAAc,EAAE,CAAC;QAC9B,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;YAC1B,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CA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GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,IAAI,CAAC,MAAM,EAAE;QACX,MAAM,IAAI,gCAAmB,CAAC,kBAAkB,IAAI,GAAG,CAAC,CAAC;KAC1D;IACD,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;IAClC,MAAM,MAAM,GAAG,EAAE,CAAC,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAEhF,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport * as ts from 'typescript';\nimport { findNode, findNodes, insertAfterLastOccurrence } from \"./ast-utils\";\nimport { Change, InsertChange, NoopChange } from \"./change\";\nimport {SchematicsException, Tree} from \"@angular-devkit/schematics\";\n\n\n/**\n* Add Import `import { symbolName } from fileName` if the import doesn't exit\n* already. Assumes fileToEdit can be resolved and accessed.\n* @param fileToEdit (file we want to add import to)\n* @param symbolName (item to import)\n* @param fileName (path to the file)\n* @param isDefault (if true, import follows style for importing default exports)\n* @return Change\n*/\n\nexport function insertImport2(\n source : ts.SourceFile,\n fileToEdit : string,\n symbolName : string,\n asSymbolName: string,\n fileName : string,\n isDefault = false): Change {\n const rootNode = source;\n const allImports = findNodes(rootNode, ts.SyntaxKind.ImportDeclaration);\n\n // get nodes that map to import statements from the file fileName\n const relevantImports = allImports.filter(node => {\n // StringLiteral of the ImportDeclaration is the import file (fileName in this case).\n const importFiles = node.getChildren()\n .filter(child => child.kind === ts.SyntaxKind.StringLiteral)\n .map(n => (n as ts.StringLiteral).text);\n\n return importFiles.filter(file => file === fileName).length === 1;\n });\n\n if (relevantImports.length > 0) {\n let importsAsterisk = false;\n // imports from import file\n const imports: ts.Node[] = [];\n relevantImports.forEach(n => {\n Array.prototype.push.apply(imports, findNodes(n, ts.SyntaxKind.Identifier));\n if (findNodes(n, ts.SyntaxKind.AsteriskToken).length > 0) {\n importsAsterisk = true;\n }\n });\n\n // if imports * from fileName, don't add symbolName\n if (importsAsterisk) {\n return new NoopChange();\n }\n\n const importTextNodes = imports.filter(n => (n as ts.Identifier).text === symbolName);\n\n // insert import if it's not there\n if (importTextNodes.length === 0) {\n const fallbackPos =\n findNodes(relevantImports[0], ts.SyntaxKind.CloseBraceToken)[0].getStart() ||\n findNodes(relevantImports[0], ts.SyntaxKind.FromKeyword)[0].getStart();\n\n return insertAfterLastOccurrence(imports, `, ${symbolName} as ${asSymbolName}`, fileToEdit, fallbackPos);\n }\n\n return new NoopChange();\n }\n\n // no such import declaration exists\n const useStrict = findNodes(rootNode, ts.SyntaxKind.StringLiteral)\n .filter((n: ts.StringLiteral) => n.text === 'use strict');\n let fallbackPos = 0;\n if (useStrict.length > 0) {\n fallbackPos = useStrict[0].end;\n }\n const open = isDefault ? '' : '{ ';\n const close = isDefault ? '' : ' }';\n // if there are no imports or 'use strict' statement, insert import at beginning of file\n const insertAtBeginning = allImports.length === 0 && useStrict.length === 0;\n const separator = insertAtBeginning ? '' : ';\\n';\n const toInsert = `${separator}import ${open}${symbolName} as ${asSymbolName}${close}` +\n ` from '${fileName}'${insertAtBeginning ? ';\\n' : ''}`;\n\n return insertAfterLastOccurrence(\n allImports,\n toInsert,\n fileToEdit,\n fallbackPos,\n ts.SyntaxKind.StringLiteral,\n );\n}\n\n\nexport function insertImport(source: ts.SourceFile, fileToEdit: string, symbolName: string,\n fileName: string, isDefault = false): Change {\n const rootNode = source;\n const allImports = findNodes(rootNode, ts.SyntaxKind.ImportDeclaration);\n\n // get nodes that map to import statements from the file fileName\n const relevantImports = allImports.filter(node => {\n // StringLiteral of the ImportDeclaration is the import file (fileName in this case).\n const importFiles = node.getChildren()\n .filter(child => child.kind === ts.SyntaxKind.StringLiteral)\n .map(n => (n as ts.StringLiteral).text);\n\n return importFiles.filter(file => file === fileName).length === 1;\n });\n\n if (relevantImports.length > 0) {\n let importsAsterisk = false;\n // imports from import file\n const imports: ts.Node[] = [];\n relevantImports.forEach(n => {\n Array.prototype.push.apply(imports, findNodes(n, ts.SyntaxKind.Identifier));\n if (findNodes(n, ts.SyntaxKind.AsteriskToken).length > 0) {\n importsAsterisk = true;\n }\n });\n\n // if imports * from fileName, don't add symbolName\n if (importsAsterisk) {\n return new NoopChange();\n }\n\n const importTextNodes = imports.filter(n => (n as ts.Identifier).text === symbolName);\n\n // insert import if it's not there\n if (importTextNodes.length === 0) {\n const fallbackPos =\n findNodes(relevantImports[0], ts.SyntaxKind.CloseBraceToken)[0].getStart() ||\n findNodes(relevantImports[0], ts.SyntaxKind.FromKeyword)[0].getStart();\n\n return insertAfterLastOccurrence(imports, `, ${symbolName}`, fileToEdit, fallbackPos);\n }\n\n return new NoopChange();\n }\n\n // no such import declaration exists\n const useStrict = findNodes(rootNode, ts.SyntaxKind.StringLiteral)\n .filter((n: ts.StringLiteral) => n.text === 'use strict');\n let fallbackPos = 0;\n if (useStrict.length > 0) {\n fallbackPos = useStrict[0].end;\n }\n const open = isDefault ? '' : '{ ';\n const close = isDefault ? '' : ' }';\n // if there are no imports or 'use strict' statement, insert import at beginning of file\n const insertAtBeginning = allImports.length === 0 && useStrict.length === 0;\n const separator = insertAtBeginning ? '' : ';\\n';\n const toInsert = `${separator}import ${open}${symbolName}${close}` +\n ` from '${fileName}'${insertAtBeginning ? ';\\n' : ''}`;\n\n return insertAfterLastOccurrence(\n allImports,\n toInsert,\n fileToEdit,\n fallbackPos,\n ts.SyntaxKind.StringLiteral,\n );\n}\n\n\n\nfunction getSourceFile(host: Tree, path: string): ts.SourceFile {\n const buffer = host.read(path);\n if (!buffer) {\n throw new SchematicsException(`Could not find ${path}.`);\n }\n const content = buffer.toString();\n const source = ts.createSourceFile(path, content, ts.ScriptTarget.Latest, true);\n\n return source;\n}\n\n"]}
1
+ {"version":3,"file":"route-utils.js","sourceRoot":"","s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CAAC,MAAM,EAAE;QACX,MAAM,IAAI,gCAAmB,CAAC,kBAAkB,IAAI,GAAG,CAAC,CAAC;KAC1D;IACD,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;IAClC,MAAM,MAAM,GAAG,EAAE,CAAC,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAEhF,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["/**\n * @license\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\nimport * as ts from 'typescript';\nimport { findNode, findNodes, insertAfterLastOccurrence } from \"./ast-utils\";\nimport { Change, InsertChange, NoopChange } from \"./change\";\nimport {SchematicsException, Tree} from \"@angular-devkit/schematics\";\n\n\n/**\n* Add Import `import { symbolName } from fileName` if the import doesn't exit\n* already. Assumes fileToEdit can be resolved and accessed.\n* @param fileToEdit (file we want to add import to)\n* @param symbolName (item to import)\n* @param fileName (path to the file)\n* @param isDefault (if true, import follows style for importing default exports)\n* @return Change\n*/\n\nexport function insertImport2(\n source : ts.SourceFile,\n fileToEdit : string,\n symbolName : string,\n asSymbolName: string,\n fileName : string,\n isDefault = false): Change {\n const rootNode = source;\n const allImports = findNodes(rootNode, ts.SyntaxKind.ImportDeclaration);\n\n // get nodes that map to import statements from the file fileName\n const relevantImports = allImports.filter(node => {\n // StringLiteral of the ImportDeclaration is the import file (fileName in this case).\n const importFiles = node.getChildren()\n .filter(child => child.kind === ts.SyntaxKind.StringLiteral)\n .map(n => (n as ts.StringLiteral).text);\n\n return importFiles.filter(file => file === fileName).length === 1;\n });\n\n if (relevantImports.length > 0) {\n let importsAsterisk = false;\n // imports from import file\n const imports: ts.Node[] = [];\n relevantImports.forEach(n => {\n Array.prototype.push.apply(imports, findNodes(n, ts.SyntaxKind.Identifier));\n if (findNodes(n, ts.SyntaxKind.AsteriskToken).length > 0) {\n importsAsterisk = true;\n }\n });\n\n // if imports * from fileName, don't add symbolName\n if (importsAsterisk) {\n return new NoopChange();\n }\n\n const importTextNodes = imports.filter(n => (n as ts.Identifier).text === symbolName);\n\n // insert import if it's not there\n if (importTextNodes.length === 0) {\n const fallbackPos =\n findNodes(relevantImports[0], ts.SyntaxKind.CloseBraceToken)[0].getStart() ||\n findNodes(relevantImports[0], ts.SyntaxKind.FromKeyword)[0].getStart();\n\n return insertAfterLastOccurrence(imports, `, ${symbolName} as ${asSymbolName}`, fileToEdit, fallbackPos);\n }\n\n return new NoopChange();\n }\n\n // no such import declaration exists\n const useStrict = findNodes(rootNode, ts.SyntaxKind.StringLiteral)\n .filter((n: ts.StringLiteral) => n.text === 'use strict');\n let fallbackPos = 0;\n if (useStrict.length > 0) {\n fallbackPos = useStrict[0].end;\n }\n const open = isDefault ? '' : '{ ';\n const close = isDefault ? '' : ' }';\n // if there are no imports or 'use strict' statement, insert import at beginning of file\n const insertAtBeginning = allImports.length === 0 && useStrict.length === 0;\n const separator = insertAtBeginning ? '' : ';\\n';\n const toInsert = `${separator}import ${open}${symbolName} as ${asSymbolName}${close}` +\n ` from '${fileName}'${insertAtBeginning ? ';\\n' : ''}`;\n\n return insertAfterLastOccurrence(\n allImports,\n toInsert,\n fileToEdit,\n fallbackPos,\n ts.SyntaxKind.StringLiteral,\n );\n}\n\n\nexport function insertImport(source: ts.SourceFile, fileToEdit: string, symbolName: string,\n fileName: string, isDefault = false): Change {\n const rootNode = source;\n const allImports = findNodes(rootNode, ts.SyntaxKind.ImportDeclaration);\n\n // get nodes that map to import statements from the file fileName\n const relevantImports = allImports.filter(node => {\n // StringLiteral of the ImportDeclaration is the import file (fileName in this case).\n const importFiles = node.getChildren()\n .filter(child => child.kind === ts.SyntaxKind.StringLiteral)\n .map(n => (n as ts.StringLiteral).text);\n\n return importFiles.filter(file => file === fileName).length === 1;\n });\n\n if (relevantImports.length > 0) {\n let importsAsterisk = false;\n // imports from import file\n const imports: ts.Node[] = [];\n relevantImports.forEach(n => {\n Array.prototype.push.apply(imports, findNodes(n, ts.SyntaxKind.Identifier));\n if (findNodes(n, ts.SyntaxKind.AsteriskToken).length > 0) {\n importsAsterisk = true;\n }\n });\n\n // if imports * from fileName, don't add symbolName\n if (importsAsterisk) {\n return new NoopChange();\n }\n\n const importTextNodes = imports.filter(n => (n as ts.Identifier).text === symbolName);\n\n // insert import if it's not there\n if (importTextNodes.length === 0) {\n const fallbackPos =\n findNodes(relevantImports[0], ts.SyntaxKind.CloseBraceToken)[0].getStart() ||\n findNodes(relevantImports[0], ts.SyntaxKind.FromKeyword)[0].getStart();\n\n return insertAfterLastOccurrence(imports, `, ${symbolName}`, fileToEdit, fallbackPos);\n }\n\n return new NoopChange();\n }\n\n // no such import declaration exists\n const useStrict = findNodes(rootNode, ts.SyntaxKind.StringLiteral)\n .filter((n: ts.StringLiteral) => n.text === 'use strict');\n let fallbackPos = 0;\n if (useStrict.length > 0) {\n fallbackPos = useStrict[0].end;\n }\n const open = isDefault ? '' : '{ ';\n const close = isDefault ? '' : ' }';\n // if there are no imports or 'use strict' statement, insert import at beginning of file\n const insertAtBeginning = allImports.length === 0 && useStrict.length === 0;\n const separator = insertAtBeginning ? '' : ';\\n';\n const toInsert = `${separator}import ${open}${symbolName}${close}` +\n ` from '${fileName}'${insertAtBeginning ? ';\\n' : ''}`;\n\n return insertAfterLastOccurrence(\n allImports,\n toInsert,\n fileToEdit,\n fallbackPos,\n ts.SyntaxKind.StringLiteral,\n );\n}\n\n\n\nfunction getSourceFile(host: Tree, path: string): ts.SourceFile {\n const buffer = host.read(path);\n if (!buffer) {\n throw new SchematicsException(`Could not find ${path}.`);\n }\n const content = buffer.toString();\n const source = ts.createSourceFile(path, content, ts.ScriptTarget.Latest, true);\n\n return source;\n}\n\n"]}
@@ -43,7 +43,7 @@ exports.getHeadTag = getHeadTag;
43
43
  * @param link html element string we are inserting.
44
44
  */
45
45
  function addHeadLink(host, project, link) {
46
- const indexPath = ast_1.getIndexHtmlPath(host, project);
46
+ const indexPath = (0, ast_1.getIndexHtmlPath)(host, project);
47
47
  const buffer = host.read(indexPath);
48
48
  if (!buffer) {
49
49
  throw new schematics_1.SchematicsException(`Could not find file for path: ${indexPath}`);
@@ -1 +1 @@
1
- {"version":3,"file":"html.js","sourceRoot":"","sources":["html.ts"],"names":[],"mappings":";;;AAAA,2DAAqE;AACrE,iCAAiC;AACjC,+BAAuC;AACvC,kDAAmD;AAGnD;;;;GAIG;AACH,SAAgB,UAAU,CAAC,IAAU,EAAE,GAAW;IAChD,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,EAC/B,EAAC,YAAY,EAAE,IAAI,EAAC,CAAgC,CAAC;IAEvD,IAAI,IAAI,CAAC;IACT,MAAM,KAAK,GAAG,CAAC,KAAgC,EAAE,EAAE;QACjD,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACnB,MAAM,OAAO,GAA+B,IAAI,CAAC;YACjD,IAAI,OAAO,CAAC,OAAO,KAAK,MAAM,EAAE;gBAC9B,IAAI,GAAG,OAAO,CAAC;aAChB;iBAAM;gBACL,IAAI,OAAO,CAAC,UAAU,EAAE;oBACtB,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;iBAC3B;aACF;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;IAE3B,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,IAAI,gCAAmB,CAAC,yBAAyB,CAAC,CAAC;KAC1D;IAED,OAAO;QACL,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,SAAS;KAC7C,CAAC;AACJ,CAAC;AA3BD,gCA2BC;AAED;;;;;;GAMG;AACH,SAAgB,WAAW,CAAC,IAAU,EAAE,OAAgB,EAAE,IAAY;IACpE,MAAM,SAAS,GAAG,sBAAgB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAClD,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACpC,IAAI,CAAC,MAAM,EAAE;QACX,MAAM,IAAI,gCAAmB,CAAC,iCAAiC,SAAS,EAAE,CAAC,CAAC;KAC7E;IAED,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC9B,IAAI,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE;QAC5B,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACnC,MAAM,SAAS,GAAG,IAAI,qBAAY,CAAC,SAAS,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACnE,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QAC7C,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;QACpD,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;KAC7B;AACH,CAAC;AAfD,kCAeC","sourcesContent":["import {Tree, SchematicsException} from '@angular-devkit/schematics';\nimport * as parse5 from 'parse5';\nimport {getIndexHtmlPath} from './ast';\nimport {InsertChange} from './devkit-utils/change';\nimport {Project} from './devkit-utils/config';\n\n/**\n * Parses the index.html file to get the HEAD tag position.\n * @param host the tree we are traversing\n * @param src the src path of the html file to parse\n */\nexport function getHeadTag(host: Tree, src: string) {\n const document = parse5.parse(src,\n {locationInfo: true}) as parse5.AST.Default.Document;\n\n let head;\n const visit = (nodes: parse5.AST.Default.Node[]) => {\n nodes.forEach(node => {\n const element = <parse5.AST.Default.Element>node;\n if (element.tagName === 'head') {\n head = element;\n } else {\n if (element.childNodes) {\n visit(element.childNodes);\n }\n }\n });\n };\n\n visit(document.childNodes);\n\n if (!head) {\n throw new SchematicsException('Head element not found!');\n }\n\n return {\n position: head.__location.startTag.endOffset\n };\n}\n\n/**\n * Adds a link to the index.html head tag Example:\n * `<link href=\"https://fonts.googleapis.com/css?family=Roboto:300,400,500\" rel=\"stylesheet\">`\n * @param host The tree we are updating\n * @param project The project we're targeting.\n * @param link html element string we are inserting.\n */\nexport function addHeadLink(host: Tree, project: Project, link: string) {\n const indexPath = getIndexHtmlPath(host, project);\n const buffer = host.read(indexPath);\n if (!buffer) {\n throw new SchematicsException(`Could not find file for path: ${indexPath}`);\n }\n\n const src = buffer.toString();\n if (src.indexOf(link) === -1) {\n const node = getHeadTag(host, src);\n const insertion = new InsertChange(indexPath, node.position, link);\n const recorder = host.beginUpdate(indexPath);\n recorder.insertLeft(insertion.pos, insertion.toAdd);\n host.commitUpdate(recorder);\n }\n}\n"]}
1
+ {"version":3,"file":"html.js","sourceRoot":"","sources":["html.ts"],"names":[],"mappings":";;;AAAA,2DAAqE;AACrE,iCAAiC;AACjC,+BAAuC;AACvC,kDAAmD;AAGnD;;;;GAIG;AACH,SAAgB,UAAU,CAAC,IAAU,EAAE,GAAW;IAChD,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,EAC/B,EAAC,YAAY,EAAE,IAAI,EAAC,CAAgC,CAAC;IAEvD,IAAI,IAAI,CAAC;IACT,MAAM,KAAK,GAAG,CAAC,KAAgC,EAAE,EAAE;QACjD,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACnB,MAAM,OAAO,GAA+B,IAAI,CAAC;YACjD,IAAI,OAAO,CAAC,OAAO,KAAK,MAAM,EAAE;gBAC9B,IAAI,GAAG,OAAO,CAAC;aAChB;iBAAM;gBACL,IAAI,OAAO,CAAC,UAAU,EAAE;oBACtB,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;iBAC3B;aACF;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;IAE3B,IAAI,CAAC,IAAI,EAAE;QACT,MAAM,IAAI,gCAAmB,CAAC,yBAAyB,CAAC,CAAC;KAC1D;IAED,OAAO;QACL,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,SAAS;KAC7C,CAAC;AACJ,CAAC;AA3BD,gCA2BC;AAED;;;;;;GAMG;AACH,SAAgB,WAAW,CAAC,IAAU,EAAE,OAAgB,EAAE,IAAY;IACpE,MAAM,SAAS,GAAG,IAAA,sBAAgB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAClD,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACpC,IAAI,CAAC,MAAM,EAAE;QACX,MAAM,IAAI,gCAAmB,CAAC,iCAAiC,SAAS,EAAE,CAAC,CAAC;KAC7E;IAED,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC9B,IAAI,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE;QAC5B,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QACnC,MAAM,SAAS,GAAG,IAAI,qBAAY,CAAC,SAAS,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QACnE,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QAC7C,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;QACpD,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;KAC7B;AACH,CAAC;AAfD,kCAeC","sourcesContent":["import {Tree, SchematicsException} from '@angular-devkit/schematics';\nimport * as parse5 from 'parse5';\nimport {getIndexHtmlPath} from './ast';\nimport {InsertChange} from './devkit-utils/change';\nimport {Project} from './devkit-utils/config';\n\n/**\n * Parses the index.html file to get the HEAD tag position.\n * @param host the tree we are traversing\n * @param src the src path of the html file to parse\n */\nexport function getHeadTag(host: Tree, src: string) {\n const document = parse5.parse(src,\n {locationInfo: true}) as parse5.AST.Default.Document;\n\n let head;\n const visit = (nodes: parse5.AST.Default.Node[]) => {\n nodes.forEach(node => {\n const element = <parse5.AST.Default.Element>node;\n if (element.tagName === 'head') {\n head = element;\n } else {\n if (element.childNodes) {\n visit(element.childNodes);\n }\n }\n });\n };\n\n visit(document.childNodes);\n\n if (!head) {\n throw new SchematicsException('Head element not found!');\n }\n\n return {\n position: head.__location.startTag.endOffset\n };\n}\n\n/**\n * Adds a link to the index.html head tag Example:\n * `<link href=\"https://fonts.googleapis.com/css?family=Roboto:300,400,500\" rel=\"stylesheet\">`\n * @param host The tree we are updating\n * @param project The project we're targeting.\n * @param link html element string we are inserting.\n */\nexport function addHeadLink(host: Tree, project: Project, link: string) {\n const indexPath = getIndexHtmlPath(host, project);\n const buffer = host.read(indexPath);\n if (!buffer) {\n throw new SchematicsException(`Could not find file for path: ${indexPath}`);\n }\n\n const src = buffer.toString();\n if (src.indexOf(link) === -1) {\n const node = getHeadTag(host, src);\n const insertion = new InsertChange(indexPath, node.position, link);\n const recorder = host.beginUpdate(indexPath);\n recorder.insertLeft(insertion.pos, insertion.toAdd);\n host.commitUpdate(recorder);\n }\n}\n"]}
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createTestApp = void 0;
4
4
  const path_1 = require("path");
5
5
  const testing_1 = require("@angular-devkit/schematics/testing");
6
- const collectionPath = path_1.join('./node_modules/@schematics/angular/collection.json');
6
+ const collectionPath = (0, path_1.join)('./node_modules/@schematics/angular/collection.json');
7
7
  /**
8
8
  * Create a base app used for testing.
9
9
  */
@@ -1 +1 @@
1
- {"version":3,"file":"testing.js","sourceRoot":"","sources":["testing.ts"],"names":[],"mappings":";;;AAAA,+BAA0B;AAC1B,gEAAqF;AAErF,MAAM,cAAc,GAAG,WAAI,CAAC,oDAAoD,CAAC,CAAC;AAElF;;GAEG;AACH,SAAgB,aAAa;IAC3B,MAAM,UAAU,GAAG,IAAI,6BAAmB,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;IACzE,OAAO,UAAU,CAAC,iBAAiB,CAAC,aAAa,EAAE;QACjD,SAAS,EAAE,EAAE;QACb,IAAI,EAAE,KAAK;QACX,MAAM,EAAE,KAAK;QACb,SAAS,EAAE,KAAK;QAChB,WAAW,EAAE,KAAK;QAClB,cAAc,EAAE,KAAK;QACrB,iBAAiB,EAAE,MAAM;QACzB,OAAO,EAAE,OAAO;QAChB,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,MAAM;QACb,SAAS,EAAE,KAAK;QAChB,OAAO,EAAE,KAAK;KACf,CAAC,CAAC,SAAS,EAAE,CAAC;AACjB,CAAC;AAhBD,sCAgBC","sourcesContent":["import {join} from 'path';\nimport {SchematicTestRunner, UnitTestTree} from '@angular-devkit/schematics/testing';\n\nconst collectionPath = join('./node_modules/@schematics/angular/collection.json');\n\n/**\n * Create a base app used for testing.\n */\nexport function createTestApp() {\n const baseRunner = new SchematicTestRunner('schematics', collectionPath);\n return baseRunner.runSchematicAsync('application', {\n directory: '',\n name: 'app',\n prefix: 'app',\n sourceDir: 'src',\n inlineStyle: false,\n inlineTemplate: false,\n viewEncapsulation: 'None',\n version: '1.2.3',\n routing: true,\n style: 'scss',\n skipTests: false,\n minimal: false,\n }).toPromise();\n}\n"]}
1
+ {"version":3,"file":"testing.js","sourceRoot":"","sources":["testing.ts"],"names":[],"mappings":";;;AAAA,+BAA0B;AAC1B,gEAAqF;AAErF,MAAM,cAAc,GAAG,IAAA,WAAI,EAAC,oDAAoD,CAAC,CAAC;AAElF;;GAEG;AACH,SAAgB,aAAa;IAC3B,MAAM,UAAU,GAAG,IAAI,6BAAmB,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;IACzE,OAAO,UAAU,CAAC,iBAAiB,CAAC,aAAa,EAAE;QACjD,SAAS,EAAE,EAAE;QACb,IAAI,EAAE,KAAK;QACX,MAAM,EAAE,KAAK;QACb,SAAS,EAAE,KAAK;QAChB,WAAW,EAAE,KAAK;QAClB,cAAc,EAAE,KAAK;QACrB,iBAAiB,EAAE,MAAM;QACzB,OAAO,EAAE,OAAO;QAChB,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,MAAM;QACb,SAAS,EAAE,KAAK;QAChB,OAAO,EAAE,KAAK;KACf,CAAC,CAAC,SAAS,EAAE,CAAC;AACjB,CAAC;AAhBD,sCAgBC","sourcesContent":["import {join} from 'path';\nimport {SchematicTestRunner, UnitTestTree} from '@angular-devkit/schematics/testing';\n\nconst collectionPath = join('./node_modules/@schematics/angular/collection.json');\n\n/**\n * Create a base app used for testing.\n */\nexport function createTestApp() {\n const baseRunner = new SchematicTestRunner('schematics', collectionPath);\n return baseRunner.runSchematicAsync('application', {\n directory: '',\n name: 'app',\n prefix: 'app',\n sourceDir: 'src',\n inlineStyle: false,\n inlineTemplate: false,\n viewEncapsulation: 'None',\n version: '1.2.3',\n routing: true,\n style: 'scss',\n skipTests: false,\n minimal: false,\n }).toPromise();\n}\n"]}
@@ -1,6 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TableWebStyle = exports.RowEditingTypes = exports.NotifyCollectionChangedAction = exports.StorageAttribute = exports.FontAttributes = exports.ScrollBarThumbType = exports.LineDirection = exports.FrameLayoutTypes = exports.OpenEditDialog = exports.KeyboardReturnKeys = exports.KeyboardTypes = exports.ExitAnimation = exports.EnterAnimation = exports.OrientationLock = exports.UndoRedoAction = exports.DataViewOutputType = exports.LineManipulationType = exports.ViewRefreshMode = exports.MagicSystemColor = exports.SourceContextType = exports.FieldViewModelType = exports.DatabaseFilters = exports.LogicHeaderAction = exports.DatabaseDataType = exports.TableType = exports.RangeMode = exports.ViewSelectType = exports.Recursion = exports.ChoiceControlStyle = exports.DbhSegmentDirection = exports.DbhKeyIndexType = exports.DbhKeyRangeMode = exports.DbhKeyDirection = exports.DbhKeyMode = exports.ModelAttMerge = exports.ModelAttGuiFrame = exports.ModelAttrBrowser = exports.ModelAttRichClientFrameSet = exports.ModelAttrFramesetForm = exports.ModelAttrRichClient = exports.ModelAttrText = exports.ModelAttrGui1 = exports.ModelAttrGui0 = exports.ModelAttrField = exports.ModelAttrHelp = exports.Axis = exports.CallbackType = exports.MgModelType = exports.APGInvokedFrom = exports.APGType = exports.APGFormSize = exports.APGDisplayMode = exports.APGOption = exports.APGMode = exports.OSType = exports.MediaType = exports.ForceExit = exports.RowType = exports.CallOperationMode = exports.FormDelimiter = exports.FormPage = exports.FormOperationType = exports.BlockTypes = exports.UpdateMode = exports.ItemMasks = exports.TriggerType = exports.ExportType = exports.DriverDB = exports.FldStorage = exports.ValType = exports.CheckExist = exports.Resident = exports.DBHCache = exports.Encr = exports.UseSQLCursor = exports.DBHRowIdentifier = exports.BlobContent = exports.FieldComAlloc = exports.ComponentItemType = exports.ErrorClassific = exports.BrkType = exports.UniqueTskSort = exports.EndMode = exports.BoxDir = exports.KeyMode = exports.InitialMode = exports.LnkMode = exports.PositionUsage = exports.TransMode = exports.ExeState = exports.CacheStrategy = exports.ErrStrategy = exports.TransBegin = exports.LockingStrategy = exports.TabbingCycleType = exports.DataviewType = exports.VeePartOfDataview = exports.VeeDiffUpdate = exports.VeeMode = exports.RemarkType = exports.TaskFlow = exports.CompTypes = exports.ModelClass = exports.NullArithmetic = exports.HelpType = exports.TrueFalseValues = exports.YesNoValues = exports.LoadedValues = exports.DataViewOperationType = exports.DataViewHeaderType = exports.Opr = exports.LogicOperationType = exports.LogicHeaderType = exports.DisplayTextType = exports.Area = exports.PaperSizePdfEnabled = exports.PaperSizePdfDisabled = exports.PaperSize = exports.MediaAccess = exports.CharacterSet = exports.MediaFormat = exports.MediaOrientation = exports.BrkLevel = exports.StorageAttributeType = exports.Storage = exports.FrameType = exports.FramesetStyle = exports.MultilineHorizontalScrollBar = exports.ExecOn = exports.TableColorBy = exports.BottomPositionInterval = exports.SplitterStyle = exports.RowHighlightType = exports.FlwMode = exports.FlowDirection = exports.EngineDirect = exports.RaiseAt = exports.DbDelUpdMode = exports.DbOpen = exports.DbShare = exports.Access = exports.LnkEval_Cond = exports.Order = exports.LDir = exports.BrkScope = exports.LogicLevel = exports.LogicUnit = exports.CallOsShow = exports.CallWsStyle = exports.CallComOption = exports.VerifyButtons = exports.VerifyImage = exports.VerifyDisplay = exports.VerifyMode = exports.CallUDPType = exports.CallUdpConvention = exports.ColumnUpdateStyle = exports.StartupMode = exports.WindowType = exports.AutoFit = exports.SplitPrimaryDisplay = exports.SplitWindowType = exports.ListboxSelectionMode = exports.FieldComType = exports.FldStyle = exports.WindowPosition = exports.DataTranslation = exports.DatabaseOperations = exports.DatabaseDefinitionType = exports.SubformType = exports.CtrlHotspotType = exports.ImageEffects = exports.CtrlButtonTypeGui = exports.SliderType = exports.PrgExecPlace = exports.DspInterface = exports.DitAttribute = exports.FormExpandType = exports.HelpCommand = exports.RbAppearance = exports.CheckboxMainStyle = exports.TabControlTabsWidth = exports.CtrlImageStyle = exports.CtrlButtonType = exports.CtrlOleStoreType = exports.CtrlOleDisplayType = exports.CtrlLineDirection = exports.CtrlTextType = exports.CtrlLineType = exports.ControlStyle = exports.WinUom = exports.WinHtmlType = exports.WinCptn = exports.SelprgMode = exports.SideType = exports.HtmlAlignmentType = exports.AlignmentTypeVert = exports.AllowedDirectionType = exports.TabbingOrderType = exports.AlignmentTypeHori = exports.GradientStyle = exports.BorderType = exports.DitType = exports.MgControlType = exports.HttpStatusCode = exports.TableBehaviour = exports.Priority = exports.Logger_LogLevels = exports.Logger_MessageDirection = void 0;
3
+ exports.AutoFit = exports.SplitPrimaryDisplay = exports.SplitWindowType = exports.ListboxSelectionMode = exports.FieldComType = exports.FldStyle = exports.WindowPosition = exports.DataTranslation = exports.DatabaseOperations = exports.DatabaseDefinitionType = exports.SubformType = exports.CtrlHotspotType = exports.ImageEffects = exports.CtrlButtonTypeGui = exports.SliderType = exports.PrgExecPlace = exports.DspInterface = exports.DitAttribute = exports.FormExpandType = exports.HelpCommand = exports.RbAppearance = exports.CheckboxMainStyle = exports.TabControlTabsWidth = exports.CtrlImageStyle = exports.CtrlButtonType = exports.CtrlOleStoreType = exports.CtrlOleDisplayType = exports.CtrlLineDirection = exports.CtrlTextType = exports.CtrlLineType = exports.ControlStyle = exports.WinUom = exports.WinHtmlType = exports.WinCptn = exports.SelprgMode = exports.SideType = exports.HtmlAlignmentType = exports.AlignmentTypeVert = exports.AllowedDirectionType = exports.TabbingOrderType = exports.AlignmentTypeHori = exports.GradientStyle = exports.BorderType = exports.DitType = exports.MgControlType = exports.HttpStatusCode = exports.TableBehaviour = exports.Priority = exports.Logger_LogLevels = exports.Logger_MessageDirection = void 0;
4
+ exports.DataViewHeaderType = exports.Opr = exports.LogicOperationType = exports.LogicHeaderType = exports.DisplayTextType = exports.Area = exports.PaperSizePdfEnabled = exports.PaperSizePdfDisabled = exports.PaperSize = exports.MediaAccess = exports.CharacterSet = exports.MediaFormat = exports.MediaOrientation = exports.BrkLevel = exports.StorageAttributeType = exports.Storage = exports.FrameType = exports.FramesetStyle = exports.MultilineHorizontalScrollBar = exports.ExecOn = exports.TableColorBy = exports.BottomPositionInterval = exports.SplitterStyle = exports.RowHighlightType = exports.FlwMode = exports.FlowDirection = exports.EngineDirect = exports.RaiseAt = exports.DbDelUpdMode = exports.DbOpen = exports.DbShare = exports.Access = exports.LnkEval_Cond = exports.Order = exports.LDir = exports.BrkScope = exports.LogicLevel = exports.LogicUnit = exports.CallOsShow = exports.CallWsStyle = exports.CallComOption = exports.VerifyButtons = exports.VerifyImage = exports.VerifyDisplay = exports.VerifyMode = exports.CallUDPType = exports.CallUdpConvention = exports.ColumnUpdateStyle = exports.StartupMode = exports.WindowType = void 0;
5
+ exports.FormDelimiter = exports.FormPage = exports.FormOperationType = exports.BlockTypes = exports.UpdateMode = exports.ItemMasks = exports.TriggerType = exports.ExportType = exports.DriverDB = exports.FldStorage = exports.ValType = exports.CheckExist = exports.Resident = exports.DBHCache = exports.Encr = exports.UseSQLCursor = exports.DBHRowIdentifier = exports.BlobContent = exports.FieldComAlloc = exports.ComponentItemType = exports.ErrorClassific = exports.BrkType = exports.UniqueTskSort = exports.EndMode = exports.BoxDir = exports.KeyMode = exports.InitialMode = exports.LnkMode = exports.PositionUsage = exports.TransMode = exports.ExeState = exports.CacheStrategy = exports.ErrStrategy = exports.TransBegin = exports.LockingStrategy = exports.TabbingCycleType = exports.DataviewType = exports.VeePartOfDataview = exports.VeeDiffUpdate = exports.VeeMode = exports.RemarkType = exports.TaskFlow = exports.CompTypes = exports.ModelClass = exports.NullArithmetic = exports.HelpType = exports.TrueFalseValues = exports.YesNoValues = exports.LoadedValues = exports.DataViewOperationType = void 0;
6
+ exports.KeyboardReturnKeys = exports.KeyboardTypes = exports.ExitAnimation = exports.EnterAnimation = exports.OrientationLock = exports.UndoRedoAction = exports.DataViewOutputType = exports.LineManipulationType = exports.ViewRefreshMode = exports.MagicSystemColor = exports.SourceContextType = exports.FieldViewModelType = exports.DatabaseFilters = exports.LogicHeaderAction = exports.DatabaseDataType = exports.TableType = exports.RangeMode = exports.ViewSelectType = exports.Recursion = exports.ChoiceControlStyle = exports.DbhSegmentDirection = exports.DbhKeyIndexType = exports.DbhKeyRangeMode = exports.DbhKeyDirection = exports.DbhKeyMode = exports.ModelAttMerge = exports.ModelAttGuiFrame = exports.ModelAttrBrowser = exports.ModelAttRichClientFrameSet = exports.ModelAttrFramesetForm = exports.ModelAttrRichClient = exports.ModelAttrText = exports.ModelAttrGui1 = exports.ModelAttrGui0 = exports.ModelAttrField = exports.ModelAttrHelp = exports.Axis = exports.CallbackType = exports.MgModelType = exports.APGInvokedFrom = exports.APGType = exports.APGFormSize = exports.APGDisplayMode = exports.APGOption = exports.APGMode = exports.OSType = exports.MediaType = exports.ForceExit = exports.RowType = exports.CallOperationMode = void 0;
7
+ exports.TableWebStyle = exports.RowEditingTypes = exports.NotifyCollectionChangedAction = exports.StorageAttribute = exports.FontAttributes = exports.ScrollBarThumbType = exports.LineDirection = exports.FrameLayoutTypes = exports.OpenEditDialog = void 0;
4
8
  var Logger_MessageDirection;
5
9
  (function (Logger_MessageDirection) {
6
10
  Logger_MessageDirection[Logger_MessageDirection["MessageLeaving"] = 0] = "MessageLeaving";