@ng-atomic/schematics 17.6.0 → 17.6.1
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.js +3 -3
- package/index.js.map +3 -3
- package/lib/page/index.js +3 -3
- package/lib/page/index.js.map +3 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -207,7 +207,7 @@ var import_schematics3 = require("@angular-devkit/schematics");
|
|
|
207
207
|
var import_parse_name2 = require("@schematics/angular/utility/parse-name");
|
|
208
208
|
var import_strings = require("@angular-devkit/core/src/utils/strings");
|
|
209
209
|
var import_ngcli_adapter = require("nx/src/adapter/ngcli-adapter");
|
|
210
|
-
var
|
|
210
|
+
var import_lodash5 = require("lodash");
|
|
211
211
|
|
|
212
212
|
// packages/@schematics-x/schematics-x/src/lib/common/_meta/utils/external-schematic.ts
|
|
213
213
|
var import_schematics2 = require("@angular-devkit/schematics");
|
|
@@ -272,7 +272,7 @@ function page(options) {
|
|
|
272
272
|
options.path ??= await getDefaultPath(tree, context, options.project);
|
|
273
273
|
const { name, path, type, project } = options = { ...options, ...(0, import_parse_name2.parseName)(options.path, options.name) };
|
|
274
274
|
const { styleHeader, useTypeAsExtension } = options;
|
|
275
|
-
const opt = (0,
|
|
275
|
+
const opt = (0, import_lodash5.omit)(options, ["styleHeader", "useTypeAsExtension", "story", "ngPackage"]);
|
|
276
276
|
const componentExt = useTypeAsExtension ? type : "component";
|
|
277
277
|
const scssPath = `${path}/${name}/${name}.${componentExt}.scss`;
|
|
278
278
|
const pages2 = getPagesOptions(`${path}/${name}`);
|
|
@@ -281,7 +281,7 @@ function page(options) {
|
|
|
281
281
|
addRouteIntoPagesRoutes(options, pages2),
|
|
282
282
|
generateRoutes({ name, path, type }),
|
|
283
283
|
externalSchematic2("@nx/angular", "component", {
|
|
284
|
-
...(0,
|
|
284
|
+
...(0, import_lodash5.omit)(opt, ["path"]),
|
|
285
285
|
directory: (0, import_path2.join)(options.path, options.name),
|
|
286
286
|
changeDetection: "Default",
|
|
287
287
|
nameAndDirectoryFormat: "as-provided",
|
package/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../packages/@ng-atomic/schematics/src/index.ts", "../../../../packages/@ng-atomic/schematics/src/lib/atomic-component/index.ts", "../../../../packages/@ng-atomic/schematics/src/lib/ng-add/index.ts", "../../../../packages/@ng-atomic/schematics/src/lib/_utilities/add-path-to-routes.ts", "../../../../packages/@ng-atomic/schematics/src/lib/_utilities/angular-config.ts", "../../../../packages/@ng-atomic/schematics/src/lib/_utilities/overwrite.ts", "../../../../packages/@ng-atomic/schematics/src/lib/_utilities/get-default-path.ts", "../../../../packages/@ng-atomic/schematics/src/lib/_utilities/run-in-nx-context.ts", "../../../../packages/@ng-atomic/schematics/src/lib/_utilities/ts-config.ts", "../../../../packages/@ng-atomic/schematics/src/lib/page/index.ts", "../../../../packages/@schematics-x/schematics-x/src/lib/common/_meta/utils/external-schematic.ts", "../../../../packages/@ng-atomic/schematics/src/lib/pages/index.ts", "../../../../packages/@ng-atomic/schematics/src/lib/setup/index.ts", "../../../../packages/@ng-atomic/schematics/src/lib/style-header/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * from './lib/atomic-component';\nexport * from './lib/ng-add';\nexport * from './lib/page';\nexport * from './lib/pages';\nexport * from './lib/setup';\nexport * from './lib/style-header';\n", "import { \n\tRule, Tree, SchematicContext, apply, chain,\n\texternalSchematic, schematic,\n\turl, applyTemplates, mergeWith, move, noop,\n\ttemplate as _template,\n\tfilter\n} from '@angular-devkit/schematics';\nimport * as strings from '@angular-devkit/core/src/utils/strings';\nimport { parseName } from '@schematics/angular/utility/parse-name';\nimport { createDefaultPath } from '@schematics/angular/utility/workspace';\nimport { join } from 'path';\nimport { Schema } from './schema';\nimport { omit } from 'lodash';\n\nexport const atomicComponent = (options: Schema): Rule => async (host: Tree, _: SchematicContext) => {\n\toptions.prefix ||= `${options.type}s`;\n\toptions.path = join(await createDefaultPath(host, options.project), options?.path ?? '');\n\n\tconst { name, path, type, project, standalone } = options = {...options, ...parseName(options.path, options.name)};\n\tconst opt = omit(options, ['styleHeader', 'useTypeAsExtension', 'story', 'ngPackage']);\n\tconst { styleHeader, useTypeAsExtension } = options;\n\tconst componentExt = useTypeAsExtension ? type : 'component';\n\tconst scssPath = `${path}/${name}/${name}.${componentExt}.scss`;\n\n\treturn chain([\n\t\toptions.standalone ? noop() : externalSchematic('@schematics/angular', 'module', {name, path, project}),\n\t\texternalSchematic('@schematics/angular', 'component', {...opt, type: componentExt, export: true}),\n\t\tmergeWith(apply(\n\t\t\turl('./files'),\n\t\t\t[\n\t\t\t\tapplyTemplates({...strings, name, type: type ?? 'component', standalone}),\n\t\t\t\tmove(path),\n\t\t\t\tfilter(path => {\n\t\t\t\t\tif (path.endsWith('/index.ts')) return true;\n\t\t\t\t\tif (options.ngPackage && path.endsWith('/ng-package.json')) return true;\n\t\t\t\t\tif (options.story && path.endsWith('.stories.ts')) return true;\n\t\t\t\t\treturn false\n\t\t\t\t}),\n\t\t\t],\n\t\t)), \n\t\tschematic('style-header', {...options, styleHeader, name, type, path: scssPath}),\n\t]);\n};\n\nexport const atom = (options: Schema): Rule => atomicComponent(({...options, type: 'atom'}));\nexport const molecule = (options: Schema): Rule => atomicComponent(({...options, type: 'molecule'}));\nexport const organism = (options: Schema): Rule => atomicComponent(({...options, type: 'organism'}));\nexport const template = (options: Schema): Rule => atomicComponent(({...options, type: 'template'}));\nexport const frame = (options: Schema): Rule => atomicComponent(({...options, type: 'frame'}));\nexport const sheet = (options: Schema): Rule => atomicComponent(({...options, type: 'sheet'}));\nexport const dialog = (options: Schema): Rule => atomicComponent(({...options, type: 'dialog'}));\n", "import { Rule, SchematicContext, Tree } from '@angular-devkit/schematics';\nimport { NodePackageInstallTask, RunSchematicTask } from '@angular-devkit/schematics/tasks';\nimport { addPackageToPackageJson, getPackageVersionFromPackageJson } from '../_utilities';\n\nexport default function(options: any): Rule {\n return (host: Tree, context: SchematicContext) => {\n const ngCoreVersionTag = getPackageVersionFromPackageJson(host, '@angular/core');\n const angularDependencyVersion = ngCoreVersionTag || `0.0.0-NG`;\n\n if (angularDependencyVersion === '0.0.0-NG') {\n throw new Error('@angular/core version is not supported.');\n }\n\n\t\taddPackageToPackageJson(host, '@ng-atomic/schematics', '^1.0.0', 'devDependencies');\n\t\taddPackageToPackageJson(host, 'scoped-var', '^1.0.0', 'devDependencies');\n\n\t\tconst installTaskId = context.addTask(new NodePackageInstallTask());\n\t\t\n\t\t// Set Up Angular Atomic Schematics\n\t\tcontext.addTask(new RunSchematicTask('setup', {...options}), [installTaskId])\n\n\t\treturn host\n }\n}\n\nexport function getCustomWebpackVersion(ver: string): string {\n const [major, minor, patch] = (ver.replace(/(\\^|\\~)/, '')).split('.');\n switch (major) {\n case '10': return '^0.1000.0';\n case '11': return '^0.1100.0';\n default: throw new Error('@angular/core version is not supported.');\n }\n}", "import { Tree } from '@angular-devkit/schematics';\nimport { getSourceNodes } from '@nx/workspace/src/utils/ast-utils';\nimport ts from 'typescript';\n\nconst isVariableDeclaration = (n: ts.Node) =>\n n.kind === ts.SyntaxKind.VariableDeclaration;\nconst isIdentifier = (n: ts.Node) => n.kind === ts.SyntaxKind.Identifier;\nconst isArrayLiteralExpression = (n: ts.Node) =>\n n.kind === ts.SyntaxKind.ArrayLiteralExpression;\nconst matchText = (n: ts.Node, text: string) => n.getText() === text;\nconst hasMatchTextChild = (n: ts.Node, text: string) => {\n return (\n n.getChildren().findIndex((c) => isIdentifier(c) && matchText(c, text)) !==\n -1\n );\n};\nconst isRoutesVariableDeclaration = (n: ts.Node) =>\n isVariableDeclaration(n) && hasMatchTextChild(n, 'routes');\n\nexport const addPathToRoutes =\n ({ route, routesPath, removeOtherRoutes }: any) =>\n (host: Tree) => {\n const src = ts.createSourceFile(\n routesPath,\n host.read(routesPath)!.toString('utf-8'),\n ts.ScriptTarget.Latest,\n true\n );\n\n const nodes = getSourceNodes(src);\n const routeNodes = nodes\n .filter(isRoutesVariableDeclaration)\n .map((n: ts.Node) => {\n return n.getChildren().filter(isArrayLiteralExpression).reverse()[0];\n });\n\n if (routeNodes.length === 1) {\n const n = routeNodes[0] as ts.ArrayLiteralExpression;\n const recorder = host.beginUpdate(routesPath);\n const suffix = n.elements.length > 0 && !removeOtherRoutes ? ',' : '';\n recorder.insertRight(n.getStart() + 1, `${route}${suffix}`);\n host.commitUpdate(recorder);\n }\n\n return host;\n };\n", "import { Tree } from '@angular-devkit/schematics';\nimport get from 'lodash.get';\nimport set from 'lodash.set';\nimport { overwrite } from './overwrite';\n\nconst PACKAGE_NAME = '@ng-atomic/schematics';\n\nexport const addSchematicsConfig = ({project, componentsDir}: any, type: string) => (host: Tree): Tree => {\n\tconst query = `projects.${project}.schematics.${PACKAGE_NAME}:${type}`;\n\treturn overwrite(host, 'angular.json', json => (set(json, query, {'path': `${componentsDir}/${type}s`}), json));\n};\n\nexport const setDefaultCollection = () => (host: Tree) => {\n\treturn overwrite(host, 'angular.json', json => (set(json, `cli.defaultCollection`, PACKAGE_NAME), json));\n}\n\nexport const addStyleIncludePath = ({project, stylesDir}: any) => (host: Tree) => {\n\tconst query = `projects.${project}.architect.build.options.stylePreprocessorOptions.includePaths`;\n\treturn overwrite(host, 'angular.json', json => (set(json, query, [...new Set(get(json, query)).add(stylesDir)]), json));\n};\n", "\nimport { Tree } from '@angular-devkit/schematics';\nimport { parse } from \"jsonc-parser\";\n\nexport function overwrite(host: Tree, file: string, callback: (json: object) => object): Tree {\n\tif (!host.exists(file)) return host;\n\tconst json = parse(host.read(file)!.toString('utf-8'));\n\thost.overwrite(file, JSON.stringify(callback(json), null, 2));\n\treturn host;\n}\n", "import { SchematicContext } from \"@angular-devkit/schematics\";\nimport { Tree as NgTree } from \"@angular-devkit/schematics/src/tree/interface\";\nimport { readProjectConfiguration } from \"@nx/devkit\";\nimport { createDefaultPath } from \"@schematics/angular/utility/workspace\";\nimport { runInNxContext } from \"./run-in-nx-context\";\n\nexport function isNxContext(context: SchematicContext): boolean {\n return context.schematic.description.name.startsWith('@nrwl');\n}\n\nexport async function getDefaultPath(tree: NgTree, context: SchematicContext, project: string): Promise<string> {\n if (tree.exists('nx.json')) {\n\t\tconst conf = await runInNxContext(tree, context, (nxTree) => {\n\t\t\treturn readProjectConfiguration(nxTree, project);\n\t\t});\n return `${conf.sourceRoot}/${conf.projectType === 'application' ? 'app' : 'lib'}`;\n }\n return createDefaultPath(tree, project);\n}", "import { SchematicContext, Tree } from \"@angular-devkit/schematics\";\nimport { convertNxGenerator } from \"@nx/devkit\";\nimport { Tree as NxTree } from '@nx/devkit';\n\nexport async function runInNxContext<T>(tree: Tree, context: SchematicContext, callback: (tree: NxTree) => T | Promise<T>): Promise<T> {\n\treturn new Promise<T>((resolve) => {\n\t\tconvertNxGenerator((tree: NxTree) => resolve(callback(tree)))({})(tree, context);\n\t});\n}\n", "import { Tree } from '@angular-devkit/schematics';\nimport set from 'lodash.set';\nimport { overwrite } from './overwrite';\n\nexport const addPathsToTsConfig = ({componentsDir}: any) => (host: Tree) => {\n\treturn overwrite(host, host.exists('tsconfig.base.json') ? 'tsconfig.base.json' : 'tsconfig.json', json => {\n\t\tset(json, `compilerOptions.paths.@components`, [componentsDir]);\n\t\tset(json, `compilerOptions.paths.@components/*`, [`${componentsDir}/*`]);\n\t\treturn json;\n\t});\n};\n\n", "import 'source-map-support/register';\nimport { strings } from '@angular-devkit/core';\nimport { MergeStrategy, Rule, SchematicContext, Tree, apply, applyTemplates, chain, mergeWith, move, schematic, url } from '@angular-devkit/schematics';\nimport { parseName } from '@schematics/angular/utility/parse-name';\nimport { dasherize, classify } from '@angular-devkit/core/src/utils/strings';\nimport { wrapAngularDevkitSchematic } from 'nx/src/adapter/ngcli-adapter';\nimport { omit } from 'lodash-es';\nimport { Schema } from '../atomic-component/schema';\nimport { addPathToRoutes, getDefaultPath } from '../_utilities';\nimport { externalSchematic } from \"schematics-x/common/_meta/utils\";\nimport { join } from 'path';\n\ntype TargetType = 'page' | 'pages';\ntype Target = {path: string, name: string};\n\nexport function page(options: Schema): Rule {\n\treturn async (tree: Tree, context: SchematicContext) => {\n\t\toptions.type = 'page';\n\t\toptions.name = resolveName(options.name);\n\n\t\toptions.prefix ||= `${options.type}s`;\n\t\n\t\toptions.path ??= await getDefaultPath(tree, context, options.project);\n\n\t\tconst { name, path, type, project } = options = {...options, ...parseName(options.path, options.name)};\n\t\tconst { styleHeader, useTypeAsExtension } = options;\n\t\tconst opt = omit(options, ['styleHeader', 'useTypeAsExtension', 'story', 'ngPackage']);\n\n\t\tconst componentExt = useTypeAsExtension ? type : 'component';\n\t\tconst scssPath = `${path}/${name}/${name}.${componentExt}.scss`;\n\t\tconst pages = getPagesOptions(`${path}/${name}`);\n\n\t\treturn chain([\n\t\t\tschematic('pages', {...pages, project}),\n\t\t\taddRouteIntoPagesRoutes(options, pages),\n\t\t\tgenerateRoutes({name, path, type}),\n\t\t\texternalSchematic('@nx/angular', 'component', {\n\t\t\t\t...omit(opt, ['path']),\n\t\t\t\tdirectory: join(options.path, options.name),\n\t\t\t\tchangeDetection: 'Default',\n\t\t\t\tnameAndDirectoryFormat: 'as-provided',\n\t\t\t\texport: true\n\t\t\t}),\n\t\t\tschematic('style-header', {...options, styleHeader, name, type, path: scssPath}),\n\t\t\taddRouteIntoPageRoutes(options, {path, name}),\n\t\t]);\n\t}\n}\n\nexport function nxPage(tree: any, options: Schema) {\n\treturn wrapAngularDevkitSchematic('./dist/packages/@ng-atomic/schematics', 'page')(tree, options);\n}\n\nexport function generateRoutes(options: {path: string, name: string, type: string}) {\n\treturn mergeWith(\n\t\tapply(\n\t\t\turl('./files'),\n\t\t\t[\n\t\t\t\tapplyTemplates({...strings, ...options}),\n\t\t\t\tmove(options.path),\n\t\t\t]\n\t\t),\n\t\tMergeStrategy.Overwrite,\n\t);\n}\n\nconst getPagesOptions = (fullPath: string): {path: string, name: string} => {\n\tconst [_, name, ...paths] = fullPath.split('/').reverse();\n\treturn {name, path: paths.reverse().join('/')};\n};\n\nconst resolveName = (name: string) => {\n\treturn 'pages/' + name.split('/').filter(path => path !== 'pages').join('/pages/');\n};\n\nconst addRouteIntoPagesRoutes = (options: Schema, target: Target) => {\n\tconst routeOptions = buildOption(options, target, 'pages');\n\treturn addPathToRoutes(routeOptions);\n};\n\nconst addRouteIntoPageRoutes = (options: Schema, target: Target) => {\n\tconst routeOptions = buildOption(options, target, 'page');\n\treturn addPathToRoutes(routeOptions);\n};\n\nconst buildOption = (options, {path, name}: Target, type: TargetType) => {\n\treturn {\n\t\t...options,\n\t\troutesPath: `${path}/${name}/${name}.routes.ts`,\n\t\troute: type === 'pages' ? buildPagesRoute(options.name) : buildPageRoute(name),\n\t\tremoveOtherRoutes: type === 'page',\n\t}\n};\n\nconst buildPagesRoute = (name): string => `\n\t{\n\t\tpath: '${name}',\n\t\tloadChildren: () => import('./${dasherize(name)}/${dasherize(name)}.routes').then(m => m.routes)\n\t}`;\n\nconst buildPageRoute = (name): string => `\n\t{\n\t\tpath: '',\n\t\tcomponent: ${classify(name)}Page,\n\t\tloadChildren: () => import('@ng-atomic/components/pages/blank').then(m => m.routes)\n\t\t// loadChildren: () => import('./pages/pages.routes').then(m => m.routes)\n\t}`;\n", "import { callRule, ExecutionOptions, MergeStrategy, Rule, SchematicContext, Tree } from \"@angular-devkit/schematics\";\nimport { concatMap, first, last, map, of } from \"rxjs\";\nimport { convertNxGenerator, Tree as NxTree } from '@nx/devkit';\n\nfunction isNxGenerator(func: Function): func is (tree: NxTree, schema: any) => Promise<void> {\n return func.length === 2;\n}\n\nexport function externalSchematic<OptionT extends object>(\n collectionName: string,\n schematicName: string,\n options: OptionT,\n executionOptions?: Partial<ExecutionOptions>,\n): Rule {\n return (input: Tree, context: SchematicContext) => {\n const collection = context.engine.createCollection(\n collectionName,\n context.schematic.collection,\n );\n const schematic = collection.createSchematic(schematicName);\n const context_ = schematic['_engine'].createContext(schematic, context, executionOptions);\n\n return of(input.branch()).pipe(\n first(),\n concatMap((tree) =>\n schematic['_engine']\n .transformOptions(schematic, options, context_)\n .pipe(map((o) => [tree, o] as [Tree, OptionT])),\n ),\n concatMap(([tree, transformedOptions]) => {\n let input: Tree;\n let scoped = false;\n if (executionOptions && executionOptions.scope) {\n scoped = true;\n input = tree;\n } else {\n input = tree;\n } \n const _fn = schematic['_description'].factoryFn;\n const fn = isNxGenerator(_fn) ? convertNxGenerator(_fn) : _fn;\n\n return callRule(fn(transformedOptions), input, context_)\n .pipe(\n map((output) => {\n if (output === input) {\n return tree;\n } else if (scoped) {\n tree.merge(output);\n\n return tree;\n } else {\n return output;\n }\n }),\n );\n }),\n last(),\n map((x) => {\n input.merge(x, MergeStrategy.AllowOverwriteConflict);\n return input;\n }),\n );\n };\n}\n", "import { strings } from '@angular-devkit/core';\nimport { Rule, Tree, apply, applyTemplates, mergeWith, move, noop, url } from '@angular-devkit/schematics';\nimport { parseName } from '@schematics/angular/utility/parse-name';\nimport { createDefaultPath } from '@schematics/angular/utility/workspace';\nimport { Schema } from './schema';\n\nexport const pages = (options: Schema): Rule => async (host: Tree) => {\n options.path ??= await createDefaultPath(host, options.project);\n const { name, path } = options = {...options, ...parseName(options.path, options.name)};\n return host.exists(`${path}/${name}/${name}.routes.ts`) ? noop() : genModule(options);\n};\n\nconst genModule = (options: Schema) => \n mergeWith(apply(url('./files'), [applyTemplates({...strings, ...options}), move(options.path)]));\n", "import { chain, Rule, Tree, template, move, url, apply, mergeWith, noop } from '@angular-devkit/schematics';\nimport { addSchematicsConfig, addPathsToTsConfig, setDefaultCollection, addStyleIncludePath } from '../_utilities';\n\nexport const setup = (options: any): Rule => chain([\n\taddSchematicsConfig(options, 'atom'),\n\taddSchematicsConfig(options, 'molecule'),\n\taddSchematicsConfig(options, 'organism'),\n\taddSchematicsConfig(options, 'template'),\n\tsetDefaultCollection(),\n\taddStyleIncludePath(options),\n\t(host: Tree) => host.exists(`${options.stylesDir}/atomic`) ? noop() : addStyleFiles(options),\n\taddPathsToTsConfig(options),\n]);\n\nconst addStyleFiles = (options: any) => mergeWith(apply(url('./files'), [template({}), move(options.stylesDir)]));\n", "import { Rule, Tree } from '@angular-devkit/schematics';\nimport { dasherize} from '@angular-devkit/core/src/utils/strings';\nimport format from 'string-template';\nimport { basename } from 'path';\nimport { Schema } from './schema';\nimport { saveFile } from '../_utilities/save-file';\n\nconst buildOptions = (options: Schema): Schema => ({\n ...options,\n name: options?.name || basename(options.path, '.scss').split('.')?.[0],\n type: options?.type || basename(options.path, '.scss').split('.').reverse()?.[0],\n});\n\nconst buildStyle = ({styleHeader, name, type}: Pick<Schema, 'styleHeader' | 'name' | 'type'>): string =>\n format(styleHeader, {name: dasherize(name), type: type});\n\nexport default (_options: Schema): Rule => (host: Tree) => {\n const {path, ...extra} = buildOptions(_options);\n return saveFile(host, path, (src: string): string => `${buildStyle(extra)}${src}`);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,wBAMO;AACP,cAAyB;AACzB,wBAA0B;AAC1B,uBAAkC;AAClC,kBAAqB;AAErB,oBAAqB;AAEd,IAAM,kBAAkB,CAAC,YAA0B,OAAO,MAAY,MAAwB;AACpG,UAAQ,WAAW,GAAG,QAAQ,IAAI;AAClC,UAAQ,WAAO,kBAAK,UAAM,oCAAkB,MAAM,QAAQ,OAAO,GAAG,SAAS,QAAQ,EAAE;AAEvF,QAAM,EAAE,MAAM,MAAM,MAAM,SAAS,WAAW,IAAI,UAAU,EAAC,GAAG,SAAS,OAAG,6BAAU,QAAQ,MAAM,QAAQ,IAAI,EAAC;AACjH,QAAM,UAAM,oBAAK,SAAS,CAAC,eAAe,sBAAsB,SAAS,WAAW,CAAC;AACrF,QAAM,EAAE,aAAa,mBAAmB,IAAI;AAC5C,QAAM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,SAASA,KAAI,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,OAAO;AAAA,EAChF,CAAC;AACF;;;ADEA,eAAsB,eAAe,MAAc,SAA2B,SAAkC;AAC9G,MAAI,KAAK,OAAO,SAAS,GAAG;AAC5B,UAAM,OAAO,MAAM,eAAe,MAAM,SAAS,CAAC,WAAW;AAC5D,iBAAO,yCAAyB,QAAQ,OAAO;AAAA,IAChD,CAAC;AACC,WAAO,GAAG,KAAK,UAAU,IAAI,KAAK,gBAAgB,gBAAgB,QAAQ,KAAK;AAAA,EACjF;AACA,aAAO,qCAAkB,MAAM,OAAO;AACxC;;;AEjBA,IAAAC,iBAAgB;AAGT,IAAM,qBAAqB,CAAC,EAAC,cAAa,MAAW,CAAC,SAAe;AAC3E,SAAO,UAAU,MAAM,KAAK,OAAO,oBAAoB,IAAI,uBAAuB,iBAAiB,UAAQ;AAC1G,uBAAAC,SAAI,MAAM,qCAAqC,CAAC,aAAa,CAAC;AAC9D,uBAAAA,SAAI,MAAM,uCAAuC,CAAC,GAAG,aAAa,IAAI,CAAC;AACvE,WAAO;AAAA,EACR,CAAC;AACF;;;ANeO,SAAS,wBAAwB,KAAqB;AAC3D,QAAM,CAAC,OAAO,OAAO,KAAK,IAAK,IAAI,QAAQ,WAAW,EAAE,EAAG,MAAM,GAAG;AACpE,UAAQ,OAAO;AAAA,IACb,KAAK;AAAM,aAAO;AAAA,IAClB,KAAK;AAAM,aAAO;AAAA,IAClB;AAAS,YAAM,IAAI,MAAM,yCAAyC;AAAA,EACpE;AACF;;;AOhCA,sBAAO;AACP,kBAAwB;AACxB,IAAAC,qBAA2H;AAC3H,IAAAC,qBAA0B;AAC1B,qBAAoC;AACpC,2BAA2C;AAC3C,
|
|
6
|
-
"names": ["path", "ts", "import_lodash", "set", "get", "import_devkit", "import_workspace", "tree", "import_lodash", "set", "import_schematics", "import_parse_name", "import_schematics", "import_devkit", "externalSchematic", "schematic", "input", "import_path", "pages", "externalSchematic", "import_core", "import_schematics", "import_parse_name", "import_workspace", "import_schematics", "import_strings"]
|
|
4
|
+
"sourcesContent": ["export * from './lib/atomic-component';\nexport * from './lib/ng-add';\nexport * from './lib/page';\nexport * from './lib/pages';\nexport * from './lib/setup';\nexport * from './lib/style-header';\n", "import { \n\tRule, Tree, SchematicContext, apply, chain,\n\texternalSchematic, schematic,\n\turl, applyTemplates, mergeWith, move, noop,\n\ttemplate as _template,\n\tfilter\n} from '@angular-devkit/schematics';\nimport * as strings from '@angular-devkit/core/src/utils/strings';\nimport { parseName } from '@schematics/angular/utility/parse-name';\nimport { createDefaultPath } from '@schematics/angular/utility/workspace';\nimport { join } from 'path';\nimport { Schema } from './schema';\nimport { omit } from 'lodash';\n\nexport const atomicComponent = (options: Schema): Rule => async (host: Tree, _: SchematicContext) => {\n\toptions.prefix ||= `${options.type}s`;\n\toptions.path = join(await createDefaultPath(host, options.project), options?.path ?? '');\n\n\tconst { name, path, type, project, standalone } = options = {...options, ...parseName(options.path, options.name)};\n\tconst opt = omit(options, ['styleHeader', 'useTypeAsExtension', 'story', 'ngPackage']);\n\tconst { styleHeader, useTypeAsExtension } = options;\n\tconst componentExt = useTypeAsExtension ? type : 'component';\n\tconst scssPath = `${path}/${name}/${name}.${componentExt}.scss`;\n\n\treturn chain([\n\t\toptions.standalone ? noop() : externalSchematic('@schematics/angular', 'module', {name, path, project}),\n\t\texternalSchematic('@schematics/angular', 'component', {...opt, type: componentExt, export: true}),\n\t\tmergeWith(apply(\n\t\t\turl('./files'),\n\t\t\t[\n\t\t\t\tapplyTemplates({...strings, name, type: type ?? 'component', standalone}),\n\t\t\t\tmove(path),\n\t\t\t\tfilter(path => {\n\t\t\t\t\tif (path.endsWith('/index.ts')) return true;\n\t\t\t\t\tif (options.ngPackage && path.endsWith('/ng-package.json')) return true;\n\t\t\t\t\tif (options.story && path.endsWith('.stories.ts')) return true;\n\t\t\t\t\treturn false\n\t\t\t\t}),\n\t\t\t],\n\t\t)), \n\t\tschematic('style-header', {...options, styleHeader, name, type, path: scssPath}),\n\t]);\n};\n\nexport const atom = (options: Schema): Rule => atomicComponent(({...options, type: 'atom'}));\nexport const molecule = (options: Schema): Rule => atomicComponent(({...options, type: 'molecule'}));\nexport const organism = (options: Schema): Rule => atomicComponent(({...options, type: 'organism'}));\nexport const template = (options: Schema): Rule => atomicComponent(({...options, type: 'template'}));\nexport const frame = (options: Schema): Rule => atomicComponent(({...options, type: 'frame'}));\nexport const sheet = (options: Schema): Rule => atomicComponent(({...options, type: 'sheet'}));\nexport const dialog = (options: Schema): Rule => atomicComponent(({...options, type: 'dialog'}));\n", "import { Rule, SchematicContext, Tree } from '@angular-devkit/schematics';\nimport { NodePackageInstallTask, RunSchematicTask } from '@angular-devkit/schematics/tasks';\nimport { addPackageToPackageJson, getPackageVersionFromPackageJson } from '../_utilities';\n\nexport default function(options: any): Rule {\n return (host: Tree, context: SchematicContext) => {\n const ngCoreVersionTag = getPackageVersionFromPackageJson(host, '@angular/core');\n const angularDependencyVersion = ngCoreVersionTag || `0.0.0-NG`;\n\n if (angularDependencyVersion === '0.0.0-NG') {\n throw new Error('@angular/core version is not supported.');\n }\n\n\t\taddPackageToPackageJson(host, '@ng-atomic/schematics', '^1.0.0', 'devDependencies');\n\t\taddPackageToPackageJson(host, 'scoped-var', '^1.0.0', 'devDependencies');\n\n\t\tconst installTaskId = context.addTask(new NodePackageInstallTask());\n\t\t\n\t\t// Set Up Angular Atomic Schematics\n\t\tcontext.addTask(new RunSchematicTask('setup', {...options}), [installTaskId])\n\n\t\treturn host\n }\n}\n\nexport function getCustomWebpackVersion(ver: string): string {\n const [major, minor, patch] = (ver.replace(/(\\^|\\~)/, '')).split('.');\n switch (major) {\n case '10': return '^0.1000.0';\n case '11': return '^0.1100.0';\n default: throw new Error('@angular/core version is not supported.');\n }\n}", "import { Tree } from '@angular-devkit/schematics';\nimport { getSourceNodes } from '@nx/workspace/src/utils/ast-utils';\nimport ts from 'typescript';\n\nconst isVariableDeclaration = (n: ts.Node) =>\n n.kind === ts.SyntaxKind.VariableDeclaration;\nconst isIdentifier = (n: ts.Node) => n.kind === ts.SyntaxKind.Identifier;\nconst isArrayLiteralExpression = (n: ts.Node) =>\n n.kind === ts.SyntaxKind.ArrayLiteralExpression;\nconst matchText = (n: ts.Node, text: string) => n.getText() === text;\nconst hasMatchTextChild = (n: ts.Node, text: string) => {\n return (\n n.getChildren().findIndex((c) => isIdentifier(c) && matchText(c, text)) !==\n -1\n );\n};\nconst isRoutesVariableDeclaration = (n: ts.Node) =>\n isVariableDeclaration(n) && hasMatchTextChild(n, 'routes');\n\nexport const addPathToRoutes =\n ({ route, routesPath, removeOtherRoutes }: any) =>\n (host: Tree) => {\n const src = ts.createSourceFile(\n routesPath,\n host.read(routesPath)!.toString('utf-8'),\n ts.ScriptTarget.Latest,\n true\n );\n\n const nodes = getSourceNodes(src);\n const routeNodes = nodes\n .filter(isRoutesVariableDeclaration)\n .map((n: ts.Node) => {\n return n.getChildren().filter(isArrayLiteralExpression).reverse()[0];\n });\n\n if (routeNodes.length === 1) {\n const n = routeNodes[0] as ts.ArrayLiteralExpression;\n const recorder = host.beginUpdate(routesPath);\n const suffix = n.elements.length > 0 && !removeOtherRoutes ? ',' : '';\n recorder.insertRight(n.getStart() + 1, `${route}${suffix}`);\n host.commitUpdate(recorder);\n }\n\n return host;\n };\n", "import { Tree } from '@angular-devkit/schematics';\nimport get from 'lodash.get';\nimport set from 'lodash.set';\nimport { overwrite } from './overwrite';\n\nconst PACKAGE_NAME = '@ng-atomic/schematics';\n\nexport const addSchematicsConfig = ({project, componentsDir}: any, type: string) => (host: Tree): Tree => {\n\tconst query = `projects.${project}.schematics.${PACKAGE_NAME}:${type}`;\n\treturn overwrite(host, 'angular.json', json => (set(json, query, {'path': `${componentsDir}/${type}s`}), json));\n};\n\nexport const setDefaultCollection = () => (host: Tree) => {\n\treturn overwrite(host, 'angular.json', json => (set(json, `cli.defaultCollection`, PACKAGE_NAME), json));\n}\n\nexport const addStyleIncludePath = ({project, stylesDir}: any) => (host: Tree) => {\n\tconst query = `projects.${project}.architect.build.options.stylePreprocessorOptions.includePaths`;\n\treturn overwrite(host, 'angular.json', json => (set(json, query, [...new Set(get(json, query)).add(stylesDir)]), json));\n};\n", "\nimport { Tree } from '@angular-devkit/schematics';\nimport { parse } from \"jsonc-parser\";\n\nexport function overwrite(host: Tree, file: string, callback: (json: object) => object): Tree {\n\tif (!host.exists(file)) return host;\n\tconst json = parse(host.read(file)!.toString('utf-8'));\n\thost.overwrite(file, JSON.stringify(callback(json), null, 2));\n\treturn host;\n}\n", "import { SchematicContext } from \"@angular-devkit/schematics\";\nimport { Tree as NgTree } from \"@angular-devkit/schematics/src/tree/interface\";\nimport { readProjectConfiguration } from \"@nx/devkit\";\nimport { createDefaultPath } from \"@schematics/angular/utility/workspace\";\nimport { runInNxContext } from \"./run-in-nx-context\";\n\nexport function isNxContext(context: SchematicContext): boolean {\n return context.schematic.description.name.startsWith('@nrwl');\n}\n\nexport async function getDefaultPath(tree: NgTree, context: SchematicContext, project: string): Promise<string> {\n if (tree.exists('nx.json')) {\n\t\tconst conf = await runInNxContext(tree, context, (nxTree) => {\n\t\t\treturn readProjectConfiguration(nxTree, project);\n\t\t});\n return `${conf.sourceRoot}/${conf.projectType === 'application' ? 'app' : 'lib'}`;\n }\n return createDefaultPath(tree, project);\n}", "import { SchematicContext, Tree } from \"@angular-devkit/schematics\";\nimport { convertNxGenerator } from \"@nx/devkit\";\nimport { Tree as NxTree } from '@nx/devkit';\n\nexport async function runInNxContext<T>(tree: Tree, context: SchematicContext, callback: (tree: NxTree) => T | Promise<T>): Promise<T> {\n\treturn new Promise<T>((resolve) => {\n\t\tconvertNxGenerator((tree: NxTree) => resolve(callback(tree)))({})(tree, context);\n\t});\n}\n", "import { Tree } from '@angular-devkit/schematics';\nimport set from 'lodash.set';\nimport { overwrite } from './overwrite';\n\nexport const addPathsToTsConfig = ({componentsDir}: any) => (host: Tree) => {\n\treturn overwrite(host, host.exists('tsconfig.base.json') ? 'tsconfig.base.json' : 'tsconfig.json', json => {\n\t\tset(json, `compilerOptions.paths.@components`, [componentsDir]);\n\t\tset(json, `compilerOptions.paths.@components/*`, [`${componentsDir}/*`]);\n\t\treturn json;\n\t});\n};\n\n", "import 'source-map-support/register';\nimport { strings } from '@angular-devkit/core';\nimport { MergeStrategy, Rule, SchematicContext, Tree, apply, applyTemplates, chain, mergeWith, move, schematic, url } from '@angular-devkit/schematics';\nimport { parseName } from '@schematics/angular/utility/parse-name';\nimport { dasherize, classify } from '@angular-devkit/core/src/utils/strings';\nimport { wrapAngularDevkitSchematic } from 'nx/src/adapter/ngcli-adapter';\nimport { omit } from 'lodash';\nimport { Schema } from '../atomic-component/schema';\nimport { addPathToRoutes, getDefaultPath } from '../_utilities';\nimport { externalSchematic } from \"schematics-x/common/_meta/utils\";\nimport { join } from 'path';\n\ntype TargetType = 'page' | 'pages';\ntype Target = {path: string, name: string};\n\nexport function page(options: Schema): Rule {\n\treturn async (tree: Tree, context: SchematicContext) => {\n\t\toptions.type = 'page';\n\t\toptions.name = resolveName(options.name);\n\n\t\toptions.prefix ||= `${options.type}s`;\n\t\n\t\toptions.path ??= await getDefaultPath(tree, context, options.project);\n\n\t\tconst { name, path, type, project } = options = {...options, ...parseName(options.path, options.name)};\n\t\tconst { styleHeader, useTypeAsExtension } = options;\n\t\tconst opt = omit(options, ['styleHeader', 'useTypeAsExtension', 'story', 'ngPackage']);\n\n\t\tconst componentExt = useTypeAsExtension ? type : 'component';\n\t\tconst scssPath = `${path}/${name}/${name}.${componentExt}.scss`;\n\t\tconst pages = getPagesOptions(`${path}/${name}`);\n\n\t\treturn chain([\n\t\t\tschematic('pages', {...pages, project}),\n\t\t\taddRouteIntoPagesRoutes(options, pages),\n\t\t\tgenerateRoutes({name, path, type}),\n\t\t\texternalSchematic('@nx/angular', 'component', {\n\t\t\t\t...omit(opt, ['path']),\n\t\t\t\tdirectory: join(options.path, options.name),\n\t\t\t\tchangeDetection: 'Default',\n\t\t\t\tnameAndDirectoryFormat: 'as-provided',\n\t\t\t\texport: true\n\t\t\t}),\n\t\t\tschematic('style-header', {...options, styleHeader, name, type, path: scssPath}),\n\t\t\taddRouteIntoPageRoutes(options, {path, name}),\n\t\t]);\n\t}\n}\n\nexport function nxPage(tree: any, options: Schema) {\n\treturn wrapAngularDevkitSchematic('./dist/packages/@ng-atomic/schematics', 'page')(tree, options);\n}\n\nexport function generateRoutes(options: {path: string, name: string, type: string}) {\n\treturn mergeWith(\n\t\tapply(\n\t\t\turl('./files'),\n\t\t\t[\n\t\t\t\tapplyTemplates({...strings, ...options}),\n\t\t\t\tmove(options.path),\n\t\t\t]\n\t\t),\n\t\tMergeStrategy.Overwrite,\n\t);\n}\n\nconst getPagesOptions = (fullPath: string): {path: string, name: string} => {\n\tconst [_, name, ...paths] = fullPath.split('/').reverse();\n\treturn {name, path: paths.reverse().join('/')};\n};\n\nconst resolveName = (name: string) => {\n\treturn 'pages/' + name.split('/').filter(path => path !== 'pages').join('/pages/');\n};\n\nconst addRouteIntoPagesRoutes = (options: Schema, target: Target) => {\n\tconst routeOptions = buildOption(options, target, 'pages');\n\treturn addPathToRoutes(routeOptions);\n};\n\nconst addRouteIntoPageRoutes = (options: Schema, target: Target) => {\n\tconst routeOptions = buildOption(options, target, 'page');\n\treturn addPathToRoutes(routeOptions);\n};\n\nconst buildOption = (options, {path, name}: Target, type: TargetType) => {\n\treturn {\n\t\t...options,\n\t\troutesPath: `${path}/${name}/${name}.routes.ts`,\n\t\troute: type === 'pages' ? buildPagesRoute(options.name) : buildPageRoute(name),\n\t\tremoveOtherRoutes: type === 'page',\n\t}\n};\n\nconst buildPagesRoute = (name): string => `\n\t{\n\t\tpath: '${name}',\n\t\tloadChildren: () => import('./${dasherize(name)}/${dasherize(name)}.routes').then(m => m.routes)\n\t}`;\n\nconst buildPageRoute = (name): string => `\n\t{\n\t\tpath: '',\n\t\tcomponent: ${classify(name)}Page,\n\t\tloadChildren: () => import('@ng-atomic/components/pages/blank').then(m => m.routes)\n\t\t// loadChildren: () => import('./pages/pages.routes').then(m => m.routes)\n\t}`;\n", "import { callRule, ExecutionOptions, MergeStrategy, Rule, SchematicContext, Tree } from \"@angular-devkit/schematics\";\nimport { concatMap, first, last, map, of } from \"rxjs\";\nimport { convertNxGenerator, Tree as NxTree } from '@nx/devkit';\n\nfunction isNxGenerator(func: Function): func is (tree: NxTree, schema: any) => Promise<void> {\n return func.length === 2;\n}\n\nexport function externalSchematic<OptionT extends object>(\n collectionName: string,\n schematicName: string,\n options: OptionT,\n executionOptions?: Partial<ExecutionOptions>,\n): Rule {\n return (input: Tree, context: SchematicContext) => {\n const collection = context.engine.createCollection(\n collectionName,\n context.schematic.collection,\n );\n const schematic = collection.createSchematic(schematicName);\n const context_ = schematic['_engine'].createContext(schematic, context, executionOptions);\n\n return of(input.branch()).pipe(\n first(),\n concatMap((tree) =>\n schematic['_engine']\n .transformOptions(schematic, options, context_)\n .pipe(map((o) => [tree, o] as [Tree, OptionT])),\n ),\n concatMap(([tree, transformedOptions]) => {\n let input: Tree;\n let scoped = false;\n if (executionOptions && executionOptions.scope) {\n scoped = true;\n input = tree;\n } else {\n input = tree;\n } \n const _fn = schematic['_description'].factoryFn;\n const fn = isNxGenerator(_fn) ? convertNxGenerator(_fn) : _fn;\n\n return callRule(fn(transformedOptions), input, context_)\n .pipe(\n map((output) => {\n if (output === input) {\n return tree;\n } else if (scoped) {\n tree.merge(output);\n\n return tree;\n } else {\n return output;\n }\n }),\n );\n }),\n last(),\n map((x) => {\n input.merge(x, MergeStrategy.AllowOverwriteConflict);\n return input;\n }),\n );\n };\n}\n", "import { strings } from '@angular-devkit/core';\nimport { Rule, Tree, apply, applyTemplates, mergeWith, move, noop, url } from '@angular-devkit/schematics';\nimport { parseName } from '@schematics/angular/utility/parse-name';\nimport { createDefaultPath } from '@schematics/angular/utility/workspace';\nimport { Schema } from './schema';\n\nexport const pages = (options: Schema): Rule => async (host: Tree) => {\n options.path ??= await createDefaultPath(host, options.project);\n const { name, path } = options = {...options, ...parseName(options.path, options.name)};\n return host.exists(`${path}/${name}/${name}.routes.ts`) ? noop() : genModule(options);\n};\n\nconst genModule = (options: Schema) => \n mergeWith(apply(url('./files'), [applyTemplates({...strings, ...options}), move(options.path)]));\n", "import { chain, Rule, Tree, template, move, url, apply, mergeWith, noop } from '@angular-devkit/schematics';\nimport { addSchematicsConfig, addPathsToTsConfig, setDefaultCollection, addStyleIncludePath } from '../_utilities';\n\nexport const setup = (options: any): Rule => chain([\n\taddSchematicsConfig(options, 'atom'),\n\taddSchematicsConfig(options, 'molecule'),\n\taddSchematicsConfig(options, 'organism'),\n\taddSchematicsConfig(options, 'template'),\n\tsetDefaultCollection(),\n\taddStyleIncludePath(options),\n\t(host: Tree) => host.exists(`${options.stylesDir}/atomic`) ? noop() : addStyleFiles(options),\n\taddPathsToTsConfig(options),\n]);\n\nconst addStyleFiles = (options: any) => mergeWith(apply(url('./files'), [template({}), move(options.stylesDir)]));\n", "import { Rule, Tree } from '@angular-devkit/schematics';\nimport { dasherize} from '@angular-devkit/core/src/utils/strings';\nimport format from 'string-template';\nimport { basename } from 'path';\nimport { Schema } from './schema';\nimport { saveFile } from '../_utilities/save-file';\n\nconst buildOptions = (options: Schema): Schema => ({\n ...options,\n name: options?.name || basename(options.path, '.scss').split('.')?.[0],\n type: options?.type || basename(options.path, '.scss').split('.').reverse()?.[0],\n});\n\nconst buildStyle = ({styleHeader, name, type}: Pick<Schema, 'styleHeader' | 'name' | 'type'>): string =>\n format(styleHeader, {name: dasherize(name), type: type});\n\nexport default (_options: Schema): Rule => (host: Tree) => {\n const {path, ...extra} = buildOptions(_options);\n return saveFile(host, path, (src: string): string => `${buildStyle(extra)}${src}`);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;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;AAAA,EACvC,qBAAqB;AAAA,EACrB,oBAAoB,OAAO;AAAA,EAC3B,CAAC,SAAe,KAAK,OAAO,GAAG,QAAQ,SAAS,SAAS,QAAI,yBAAK,IAAI,cAAc,OAAO;AAAA,EAC3F,mBAAmB,OAAO;AAC3B,CAAC;AAED,IAAM,gBAAgB,CAAC,gBAAiB,kCAAU,8BAAM,wBAAI,SAAS,GAAG,KAAC,6BAAS,CAAC,CAAC,OAAG,yBAAK,QAAQ,SAAS,CAAC,CAAC,CAAC;;;ACbhH,IAAAC,kBAAyB;AACzB,6BAAmB;",
|
|
6
|
+
"names": ["path", "ts", "import_lodash", "set", "get", "import_devkit", "import_workspace", "tree", "import_lodash", "set", "import_schematics", "import_parse_name", "import_lodash", "import_schematics", "import_devkit", "externalSchematic", "schematic", "input", "import_path", "pages", "externalSchematic", "import_core", "import_schematics", "import_parse_name", "import_workspace", "import_schematics", "import_strings"]
|
|
7
7
|
}
|
package/lib/page/index.js
CHANGED
|
@@ -40,7 +40,7 @@ var import_schematics2 = require("@angular-devkit/schematics");
|
|
|
40
40
|
var import_parse_name = require("@schematics/angular/utility/parse-name");
|
|
41
41
|
var import_strings = require("@angular-devkit/core/src/utils/strings");
|
|
42
42
|
var import_ngcli_adapter = require("nx/src/adapter/ngcli-adapter");
|
|
43
|
-
var
|
|
43
|
+
var import_lodash4 = require("lodash");
|
|
44
44
|
|
|
45
45
|
// packages/@ng-atomic/schematics/src/lib/_utilities/add-path-to-routes.ts
|
|
46
46
|
var import_ast_utils = require("@nx/workspace/src/utils/ast-utils");
|
|
@@ -170,7 +170,7 @@ function page(options) {
|
|
|
170
170
|
options.path ??= await getDefaultPath(tree, context, options.project);
|
|
171
171
|
const { name, path, type, project } = options = { ...options, ...(0, import_parse_name.parseName)(options.path, options.name) };
|
|
172
172
|
const { styleHeader, useTypeAsExtension } = options;
|
|
173
|
-
const opt = (0,
|
|
173
|
+
const opt = (0, import_lodash4.omit)(options, ["styleHeader", "useTypeAsExtension", "story", "ngPackage"]);
|
|
174
174
|
const componentExt = useTypeAsExtension ? type : "component";
|
|
175
175
|
const scssPath = `${path}/${name}/${name}.${componentExt}.scss`;
|
|
176
176
|
const pages = getPagesOptions(`${path}/${name}`);
|
|
@@ -179,7 +179,7 @@ function page(options) {
|
|
|
179
179
|
addRouteIntoPagesRoutes(options, pages),
|
|
180
180
|
generateRoutes({ name, path, type }),
|
|
181
181
|
externalSchematic("@nx/angular", "component", {
|
|
182
|
-
...(0,
|
|
182
|
+
...(0, import_lodash4.omit)(opt, ["path"]),
|
|
183
183
|
directory: (0, import_path.join)(options.path, options.name),
|
|
184
184
|
changeDetection: "Default",
|
|
185
185
|
nameAndDirectoryFormat: "as-provided",
|
package/lib/page/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../packages/@ng-atomic/schematics/src/lib/page/index.ts", "../../../../../../packages/@ng-atomic/schematics/src/lib/_utilities/add-path-to-routes.ts", "../../../../../../packages/@ng-atomic/schematics/src/lib/_utilities/angular-config.ts", "../../../../../../packages/@ng-atomic/schematics/src/lib/_utilities/overwrite.ts", "../../../../../../packages/@ng-atomic/schematics/src/lib/_utilities/get-default-path.ts", "../../../../../../packages/@ng-atomic/schematics/src/lib/_utilities/run-in-nx-context.ts", "../../../../../../packages/@ng-atomic/schematics/src/lib/_utilities/ts-config.ts", "../../../../../../packages/@schematics-x/schematics-x/src/lib/common/_meta/utils/external-schematic.ts"],
|
|
4
|
-
"sourcesContent": ["import 'source-map-support/register';\nimport { strings } from '@angular-devkit/core';\nimport { MergeStrategy, Rule, SchematicContext, Tree, apply, applyTemplates, chain, mergeWith, move, schematic, url } from '@angular-devkit/schematics';\nimport { parseName } from '@schematics/angular/utility/parse-name';\nimport { dasherize, classify } from '@angular-devkit/core/src/utils/strings';\nimport { wrapAngularDevkitSchematic } from 'nx/src/adapter/ngcli-adapter';\nimport { omit } from 'lodash-es';\nimport { Schema } from '../atomic-component/schema';\nimport { addPathToRoutes, getDefaultPath } from '../_utilities';\nimport { externalSchematic } from \"schematics-x/common/_meta/utils\";\nimport { join } from 'path';\n\ntype TargetType = 'page' | 'pages';\ntype Target = {path: string, name: string};\n\nexport function page(options: Schema): Rule {\n\treturn async (tree: Tree, context: SchematicContext) => {\n\t\toptions.type = 'page';\n\t\toptions.name = resolveName(options.name);\n\n\t\toptions.prefix ||= `${options.type}s`;\n\t\n\t\toptions.path ??= await getDefaultPath(tree, context, options.project);\n\n\t\tconst { name, path, type, project } = options = {...options, ...parseName(options.path, options.name)};\n\t\tconst { styleHeader, useTypeAsExtension } = options;\n\t\tconst opt = omit(options, ['styleHeader', 'useTypeAsExtension', 'story', 'ngPackage']);\n\n\t\tconst componentExt = useTypeAsExtension ? type : 'component';\n\t\tconst scssPath = `${path}/${name}/${name}.${componentExt}.scss`;\n\t\tconst pages = getPagesOptions(`${path}/${name}`);\n\n\t\treturn chain([\n\t\t\tschematic('pages', {...pages, project}),\n\t\t\taddRouteIntoPagesRoutes(options, pages),\n\t\t\tgenerateRoutes({name, path, type}),\n\t\t\texternalSchematic('@nx/angular', 'component', {\n\t\t\t\t...omit(opt, ['path']),\n\t\t\t\tdirectory: join(options.path, options.name),\n\t\t\t\tchangeDetection: 'Default',\n\t\t\t\tnameAndDirectoryFormat: 'as-provided',\n\t\t\t\texport: true\n\t\t\t}),\n\t\t\tschematic('style-header', {...options, styleHeader, name, type, path: scssPath}),\n\t\t\taddRouteIntoPageRoutes(options, {path, name}),\n\t\t]);\n\t}\n}\n\nexport function nxPage(tree: any, options: Schema) {\n\treturn wrapAngularDevkitSchematic('./dist/packages/@ng-atomic/schematics', 'page')(tree, options);\n}\n\nexport function generateRoutes(options: {path: string, name: string, type: string}) {\n\treturn mergeWith(\n\t\tapply(\n\t\t\turl('./files'),\n\t\t\t[\n\t\t\t\tapplyTemplates({...strings, ...options}),\n\t\t\t\tmove(options.path),\n\t\t\t]\n\t\t),\n\t\tMergeStrategy.Overwrite,\n\t);\n}\n\nconst getPagesOptions = (fullPath: string): {path: string, name: string} => {\n\tconst [_, name, ...paths] = fullPath.split('/').reverse();\n\treturn {name, path: paths.reverse().join('/')};\n};\n\nconst resolveName = (name: string) => {\n\treturn 'pages/' + name.split('/').filter(path => path !== 'pages').join('/pages/');\n};\n\nconst addRouteIntoPagesRoutes = (options: Schema, target: Target) => {\n\tconst routeOptions = buildOption(options, target, 'pages');\n\treturn addPathToRoutes(routeOptions);\n};\n\nconst addRouteIntoPageRoutes = (options: Schema, target: Target) => {\n\tconst routeOptions = buildOption(options, target, 'page');\n\treturn addPathToRoutes(routeOptions);\n};\n\nconst buildOption = (options, {path, name}: Target, type: TargetType) => {\n\treturn {\n\t\t...options,\n\t\troutesPath: `${path}/${name}/${name}.routes.ts`,\n\t\troute: type === 'pages' ? buildPagesRoute(options.name) : buildPageRoute(name),\n\t\tremoveOtherRoutes: type === 'page',\n\t}\n};\n\nconst buildPagesRoute = (name): string => `\n\t{\n\t\tpath: '${name}',\n\t\tloadChildren: () => import('./${dasherize(name)}/${dasherize(name)}.routes').then(m => m.routes)\n\t}`;\n\nconst buildPageRoute = (name): string => `\n\t{\n\t\tpath: '',\n\t\tcomponent: ${classify(name)}Page,\n\t\tloadChildren: () => import('@ng-atomic/components/pages/blank').then(m => m.routes)\n\t\t// loadChildren: () => import('./pages/pages.routes').then(m => m.routes)\n\t}`;\n", "import { Tree } from '@angular-devkit/schematics';\nimport { getSourceNodes } from '@nx/workspace/src/utils/ast-utils';\nimport ts from 'typescript';\n\nconst isVariableDeclaration = (n: ts.Node) =>\n n.kind === ts.SyntaxKind.VariableDeclaration;\nconst isIdentifier = (n: ts.Node) => n.kind === ts.SyntaxKind.Identifier;\nconst isArrayLiteralExpression = (n: ts.Node) =>\n n.kind === ts.SyntaxKind.ArrayLiteralExpression;\nconst matchText = (n: ts.Node, text: string) => n.getText() === text;\nconst hasMatchTextChild = (n: ts.Node, text: string) => {\n return (\n n.getChildren().findIndex((c) => isIdentifier(c) && matchText(c, text)) !==\n -1\n );\n};\nconst isRoutesVariableDeclaration = (n: ts.Node) =>\n isVariableDeclaration(n) && hasMatchTextChild(n, 'routes');\n\nexport const addPathToRoutes =\n ({ route, routesPath, removeOtherRoutes }: any) =>\n (host: Tree) => {\n const src = ts.createSourceFile(\n routesPath,\n host.read(routesPath)!.toString('utf-8'),\n ts.ScriptTarget.Latest,\n true\n );\n\n const nodes = getSourceNodes(src);\n const routeNodes = nodes\n .filter(isRoutesVariableDeclaration)\n .map((n: ts.Node) => {\n return n.getChildren().filter(isArrayLiteralExpression).reverse()[0];\n });\n\n if (routeNodes.length === 1) {\n const n = routeNodes[0] as ts.ArrayLiteralExpression;\n const recorder = host.beginUpdate(routesPath);\n const suffix = n.elements.length > 0 && !removeOtherRoutes ? ',' : '';\n recorder.insertRight(n.getStart() + 1, `${route}${suffix}`);\n host.commitUpdate(recorder);\n }\n\n return host;\n };\n", "import { Tree } from '@angular-devkit/schematics';\nimport get from 'lodash.get';\nimport set from 'lodash.set';\nimport { overwrite } from './overwrite';\n\nconst PACKAGE_NAME = '@ng-atomic/schematics';\n\nexport const addSchematicsConfig = ({project, componentsDir}: any, type: string) => (host: Tree): Tree => {\n\tconst query = `projects.${project}.schematics.${PACKAGE_NAME}:${type}`;\n\treturn overwrite(host, 'angular.json', json => (set(json, query, {'path': `${componentsDir}/${type}s`}), json));\n};\n\nexport const setDefaultCollection = () => (host: Tree) => {\n\treturn overwrite(host, 'angular.json', json => (set(json, `cli.defaultCollection`, PACKAGE_NAME), json));\n}\n\nexport const addStyleIncludePath = ({project, stylesDir}: any) => (host: Tree) => {\n\tconst query = `projects.${project}.architect.build.options.stylePreprocessorOptions.includePaths`;\n\treturn overwrite(host, 'angular.json', json => (set(json, query, [...new Set(get(json, query)).add(stylesDir)]), json));\n};\n", "\nimport { Tree } from '@angular-devkit/schematics';\nimport { parse } from \"jsonc-parser\";\n\nexport function overwrite(host: Tree, file: string, callback: (json: object) => object): Tree {\n\tif (!host.exists(file)) return host;\n\tconst json = parse(host.read(file)!.toString('utf-8'));\n\thost.overwrite(file, JSON.stringify(callback(json), null, 2));\n\treturn host;\n}\n", "import { SchematicContext } from \"@angular-devkit/schematics\";\nimport { Tree as NgTree } from \"@angular-devkit/schematics/src/tree/interface\";\nimport { readProjectConfiguration } from \"@nx/devkit\";\nimport { createDefaultPath } from \"@schematics/angular/utility/workspace\";\nimport { runInNxContext } from \"./run-in-nx-context\";\n\nexport function isNxContext(context: SchematicContext): boolean {\n return context.schematic.description.name.startsWith('@nrwl');\n}\n\nexport async function getDefaultPath(tree: NgTree, context: SchematicContext, project: string): Promise<string> {\n if (tree.exists('nx.json')) {\n\t\tconst conf = await runInNxContext(tree, context, (nxTree) => {\n\t\t\treturn readProjectConfiguration(nxTree, project);\n\t\t});\n return `${conf.sourceRoot}/${conf.projectType === 'application' ? 'app' : 'lib'}`;\n }\n return createDefaultPath(tree, project);\n}", "import { SchematicContext, Tree } from \"@angular-devkit/schematics\";\nimport { convertNxGenerator } from \"@nx/devkit\";\nimport { Tree as NxTree } from '@nx/devkit';\n\nexport async function runInNxContext<T>(tree: Tree, context: SchematicContext, callback: (tree: NxTree) => T | Promise<T>): Promise<T> {\n\treturn new Promise<T>((resolve) => {\n\t\tconvertNxGenerator((tree: NxTree) => resolve(callback(tree)))({})(tree, context);\n\t});\n}\n", "import { Tree } from '@angular-devkit/schematics';\nimport set from 'lodash.set';\nimport { overwrite } from './overwrite';\n\nexport const addPathsToTsConfig = ({componentsDir}: any) => (host: Tree) => {\n\treturn overwrite(host, host.exists('tsconfig.base.json') ? 'tsconfig.base.json' : 'tsconfig.json', json => {\n\t\tset(json, `compilerOptions.paths.@components`, [componentsDir]);\n\t\tset(json, `compilerOptions.paths.@components/*`, [`${componentsDir}/*`]);\n\t\treturn json;\n\t});\n};\n\n", "import { callRule, ExecutionOptions, MergeStrategy, Rule, SchematicContext, Tree } from \"@angular-devkit/schematics\";\nimport { concatMap, first, last, map, of } from \"rxjs\";\nimport { convertNxGenerator, Tree as NxTree } from '@nx/devkit';\n\nfunction isNxGenerator(func: Function): func is (tree: NxTree, schema: any) => Promise<void> {\n return func.length === 2;\n}\n\nexport function externalSchematic<OptionT extends object>(\n collectionName: string,\n schematicName: string,\n options: OptionT,\n executionOptions?: Partial<ExecutionOptions>,\n): Rule {\n return (input: Tree, context: SchematicContext) => {\n const collection = context.engine.createCollection(\n collectionName,\n context.schematic.collection,\n );\n const schematic = collection.createSchematic(schematicName);\n const context_ = schematic['_engine'].createContext(schematic, context, executionOptions);\n\n return of(input.branch()).pipe(\n first(),\n concatMap((tree) =>\n schematic['_engine']\n .transformOptions(schematic, options, context_)\n .pipe(map((o) => [tree, o] as [Tree, OptionT])),\n ),\n concatMap(([tree, transformedOptions]) => {\n let input: Tree;\n let scoped = false;\n if (executionOptions && executionOptions.scope) {\n scoped = true;\n input = tree;\n } else {\n input = tree;\n } \n const _fn = schematic['_description'].factoryFn;\n const fn = isNxGenerator(_fn) ? convertNxGenerator(_fn) : _fn;\n\n return callRule(fn(transformedOptions), input, context_)\n .pipe(\n map((output) => {\n if (output === input) {\n return tree;\n } else if (scoped) {\n tree.merge(output);\n\n return tree;\n } else {\n return output;\n }\n }),\n );\n }),\n last(),\n map((x) => {\n input.merge(x, MergeStrategy.AllowOverwriteConflict);\n return input;\n }),\n );\n };\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAO;AACP,kBAAwB;AACxB,IAAAA,qBAA2H;AAC3H,wBAA0B;AAC1B,qBAAoC;AACpC,2BAA2C;AAC3C,
|
|
6
|
-
"names": ["import_schematics", "ts", "import_lodash", "import_devkit", "tree", "import_lodash", "import_devkit", "schematic", "input"]
|
|
4
|
+
"sourcesContent": ["import 'source-map-support/register';\nimport { strings } from '@angular-devkit/core';\nimport { MergeStrategy, Rule, SchematicContext, Tree, apply, applyTemplates, chain, mergeWith, move, schematic, url } from '@angular-devkit/schematics';\nimport { parseName } from '@schematics/angular/utility/parse-name';\nimport { dasherize, classify } from '@angular-devkit/core/src/utils/strings';\nimport { wrapAngularDevkitSchematic } from 'nx/src/adapter/ngcli-adapter';\nimport { omit } from 'lodash';\nimport { Schema } from '../atomic-component/schema';\nimport { addPathToRoutes, getDefaultPath } from '../_utilities';\nimport { externalSchematic } from \"schematics-x/common/_meta/utils\";\nimport { join } from 'path';\n\ntype TargetType = 'page' | 'pages';\ntype Target = {path: string, name: string};\n\nexport function page(options: Schema): Rule {\n\treturn async (tree: Tree, context: SchematicContext) => {\n\t\toptions.type = 'page';\n\t\toptions.name = resolveName(options.name);\n\n\t\toptions.prefix ||= `${options.type}s`;\n\t\n\t\toptions.path ??= await getDefaultPath(tree, context, options.project);\n\n\t\tconst { name, path, type, project } = options = {...options, ...parseName(options.path, options.name)};\n\t\tconst { styleHeader, useTypeAsExtension } = options;\n\t\tconst opt = omit(options, ['styleHeader', 'useTypeAsExtension', 'story', 'ngPackage']);\n\n\t\tconst componentExt = useTypeAsExtension ? type : 'component';\n\t\tconst scssPath = `${path}/${name}/${name}.${componentExt}.scss`;\n\t\tconst pages = getPagesOptions(`${path}/${name}`);\n\n\t\treturn chain([\n\t\t\tschematic('pages', {...pages, project}),\n\t\t\taddRouteIntoPagesRoutes(options, pages),\n\t\t\tgenerateRoutes({name, path, type}),\n\t\t\texternalSchematic('@nx/angular', 'component', {\n\t\t\t\t...omit(opt, ['path']),\n\t\t\t\tdirectory: join(options.path, options.name),\n\t\t\t\tchangeDetection: 'Default',\n\t\t\t\tnameAndDirectoryFormat: 'as-provided',\n\t\t\t\texport: true\n\t\t\t}),\n\t\t\tschematic('style-header', {...options, styleHeader, name, type, path: scssPath}),\n\t\t\taddRouteIntoPageRoutes(options, {path, name}),\n\t\t]);\n\t}\n}\n\nexport function nxPage(tree: any, options: Schema) {\n\treturn wrapAngularDevkitSchematic('./dist/packages/@ng-atomic/schematics', 'page')(tree, options);\n}\n\nexport function generateRoutes(options: {path: string, name: string, type: string}) {\n\treturn mergeWith(\n\t\tapply(\n\t\t\turl('./files'),\n\t\t\t[\n\t\t\t\tapplyTemplates({...strings, ...options}),\n\t\t\t\tmove(options.path),\n\t\t\t]\n\t\t),\n\t\tMergeStrategy.Overwrite,\n\t);\n}\n\nconst getPagesOptions = (fullPath: string): {path: string, name: string} => {\n\tconst [_, name, ...paths] = fullPath.split('/').reverse();\n\treturn {name, path: paths.reverse().join('/')};\n};\n\nconst resolveName = (name: string) => {\n\treturn 'pages/' + name.split('/').filter(path => path !== 'pages').join('/pages/');\n};\n\nconst addRouteIntoPagesRoutes = (options: Schema, target: Target) => {\n\tconst routeOptions = buildOption(options, target, 'pages');\n\treturn addPathToRoutes(routeOptions);\n};\n\nconst addRouteIntoPageRoutes = (options: Schema, target: Target) => {\n\tconst routeOptions = buildOption(options, target, 'page');\n\treturn addPathToRoutes(routeOptions);\n};\n\nconst buildOption = (options, {path, name}: Target, type: TargetType) => {\n\treturn {\n\t\t...options,\n\t\troutesPath: `${path}/${name}/${name}.routes.ts`,\n\t\troute: type === 'pages' ? buildPagesRoute(options.name) : buildPageRoute(name),\n\t\tremoveOtherRoutes: type === 'page',\n\t}\n};\n\nconst buildPagesRoute = (name): string => `\n\t{\n\t\tpath: '${name}',\n\t\tloadChildren: () => import('./${dasherize(name)}/${dasherize(name)}.routes').then(m => m.routes)\n\t}`;\n\nconst buildPageRoute = (name): string => `\n\t{\n\t\tpath: '',\n\t\tcomponent: ${classify(name)}Page,\n\t\tloadChildren: () => import('@ng-atomic/components/pages/blank').then(m => m.routes)\n\t\t// loadChildren: () => import('./pages/pages.routes').then(m => m.routes)\n\t}`;\n", "import { Tree } from '@angular-devkit/schematics';\nimport { getSourceNodes } from '@nx/workspace/src/utils/ast-utils';\nimport ts from 'typescript';\n\nconst isVariableDeclaration = (n: ts.Node) =>\n n.kind === ts.SyntaxKind.VariableDeclaration;\nconst isIdentifier = (n: ts.Node) => n.kind === ts.SyntaxKind.Identifier;\nconst isArrayLiteralExpression = (n: ts.Node) =>\n n.kind === ts.SyntaxKind.ArrayLiteralExpression;\nconst matchText = (n: ts.Node, text: string) => n.getText() === text;\nconst hasMatchTextChild = (n: ts.Node, text: string) => {\n return (\n n.getChildren().findIndex((c) => isIdentifier(c) && matchText(c, text)) !==\n -1\n );\n};\nconst isRoutesVariableDeclaration = (n: ts.Node) =>\n isVariableDeclaration(n) && hasMatchTextChild(n, 'routes');\n\nexport const addPathToRoutes =\n ({ route, routesPath, removeOtherRoutes }: any) =>\n (host: Tree) => {\n const src = ts.createSourceFile(\n routesPath,\n host.read(routesPath)!.toString('utf-8'),\n ts.ScriptTarget.Latest,\n true\n );\n\n const nodes = getSourceNodes(src);\n const routeNodes = nodes\n .filter(isRoutesVariableDeclaration)\n .map((n: ts.Node) => {\n return n.getChildren().filter(isArrayLiteralExpression).reverse()[0];\n });\n\n if (routeNodes.length === 1) {\n const n = routeNodes[0] as ts.ArrayLiteralExpression;\n const recorder = host.beginUpdate(routesPath);\n const suffix = n.elements.length > 0 && !removeOtherRoutes ? ',' : '';\n recorder.insertRight(n.getStart() + 1, `${route}${suffix}`);\n host.commitUpdate(recorder);\n }\n\n return host;\n };\n", "import { Tree } from '@angular-devkit/schematics';\nimport get from 'lodash.get';\nimport set from 'lodash.set';\nimport { overwrite } from './overwrite';\n\nconst PACKAGE_NAME = '@ng-atomic/schematics';\n\nexport const addSchematicsConfig = ({project, componentsDir}: any, type: string) => (host: Tree): Tree => {\n\tconst query = `projects.${project}.schematics.${PACKAGE_NAME}:${type}`;\n\treturn overwrite(host, 'angular.json', json => (set(json, query, {'path': `${componentsDir}/${type}s`}), json));\n};\n\nexport const setDefaultCollection = () => (host: Tree) => {\n\treturn overwrite(host, 'angular.json', json => (set(json, `cli.defaultCollection`, PACKAGE_NAME), json));\n}\n\nexport const addStyleIncludePath = ({project, stylesDir}: any) => (host: Tree) => {\n\tconst query = `projects.${project}.architect.build.options.stylePreprocessorOptions.includePaths`;\n\treturn overwrite(host, 'angular.json', json => (set(json, query, [...new Set(get(json, query)).add(stylesDir)]), json));\n};\n", "\nimport { Tree } from '@angular-devkit/schematics';\nimport { parse } from \"jsonc-parser\";\n\nexport function overwrite(host: Tree, file: string, callback: (json: object) => object): Tree {\n\tif (!host.exists(file)) return host;\n\tconst json = parse(host.read(file)!.toString('utf-8'));\n\thost.overwrite(file, JSON.stringify(callback(json), null, 2));\n\treturn host;\n}\n", "import { SchematicContext } from \"@angular-devkit/schematics\";\nimport { Tree as NgTree } from \"@angular-devkit/schematics/src/tree/interface\";\nimport { readProjectConfiguration } from \"@nx/devkit\";\nimport { createDefaultPath } from \"@schematics/angular/utility/workspace\";\nimport { runInNxContext } from \"./run-in-nx-context\";\n\nexport function isNxContext(context: SchematicContext): boolean {\n return context.schematic.description.name.startsWith('@nrwl');\n}\n\nexport async function getDefaultPath(tree: NgTree, context: SchematicContext, project: string): Promise<string> {\n if (tree.exists('nx.json')) {\n\t\tconst conf = await runInNxContext(tree, context, (nxTree) => {\n\t\t\treturn readProjectConfiguration(nxTree, project);\n\t\t});\n return `${conf.sourceRoot}/${conf.projectType === 'application' ? 'app' : 'lib'}`;\n }\n return createDefaultPath(tree, project);\n}", "import { SchematicContext, Tree } from \"@angular-devkit/schematics\";\nimport { convertNxGenerator } from \"@nx/devkit\";\nimport { Tree as NxTree } from '@nx/devkit';\n\nexport async function runInNxContext<T>(tree: Tree, context: SchematicContext, callback: (tree: NxTree) => T | Promise<T>): Promise<T> {\n\treturn new Promise<T>((resolve) => {\n\t\tconvertNxGenerator((tree: NxTree) => resolve(callback(tree)))({})(tree, context);\n\t});\n}\n", "import { Tree } from '@angular-devkit/schematics';\nimport set from 'lodash.set';\nimport { overwrite } from './overwrite';\n\nexport const addPathsToTsConfig = ({componentsDir}: any) => (host: Tree) => {\n\treturn overwrite(host, host.exists('tsconfig.base.json') ? 'tsconfig.base.json' : 'tsconfig.json', json => {\n\t\tset(json, `compilerOptions.paths.@components`, [componentsDir]);\n\t\tset(json, `compilerOptions.paths.@components/*`, [`${componentsDir}/*`]);\n\t\treturn json;\n\t});\n};\n\n", "import { callRule, ExecutionOptions, MergeStrategy, Rule, SchematicContext, Tree } from \"@angular-devkit/schematics\";\nimport { concatMap, first, last, map, of } from \"rxjs\";\nimport { convertNxGenerator, Tree as NxTree } from '@nx/devkit';\n\nfunction isNxGenerator(func: Function): func is (tree: NxTree, schema: any) => Promise<void> {\n return func.length === 2;\n}\n\nexport function externalSchematic<OptionT extends object>(\n collectionName: string,\n schematicName: string,\n options: OptionT,\n executionOptions?: Partial<ExecutionOptions>,\n): Rule {\n return (input: Tree, context: SchematicContext) => {\n const collection = context.engine.createCollection(\n collectionName,\n context.schematic.collection,\n );\n const schematic = collection.createSchematic(schematicName);\n const context_ = schematic['_engine'].createContext(schematic, context, executionOptions);\n\n return of(input.branch()).pipe(\n first(),\n concatMap((tree) =>\n schematic['_engine']\n .transformOptions(schematic, options, context_)\n .pipe(map((o) => [tree, o] as [Tree, OptionT])),\n ),\n concatMap(([tree, transformedOptions]) => {\n let input: Tree;\n let scoped = false;\n if (executionOptions && executionOptions.scope) {\n scoped = true;\n input = tree;\n } else {\n input = tree;\n } \n const _fn = schematic['_description'].factoryFn;\n const fn = isNxGenerator(_fn) ? convertNxGenerator(_fn) : _fn;\n\n return callRule(fn(transformedOptions), input, context_)\n .pipe(\n map((output) => {\n if (output === input) {\n return tree;\n } else if (scoped) {\n tree.merge(output);\n\n return tree;\n } else {\n return output;\n }\n }),\n );\n }),\n last(),\n map((x) => {\n input.merge(x, MergeStrategy.AllowOverwriteConflict);\n return input;\n }),\n );\n };\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAO;AACP,kBAAwB;AACxB,IAAAA,qBAA2H;AAC3H,wBAA0B;AAC1B,qBAAoC;AACpC,2BAA2C;AAC3C,I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EA,IAAM,0BAA0B,CAAC,SAAiB,WAAmB;AACpE,QAAM,eAAe,YAAY,SAAS,QAAQ,OAAO;AACzD,SAAO,gBAAgB,YAAY;AACpC;AAEA,IAAM,yBAAyB,CAAC,SAAiB,WAAmB;AACnE,QAAM,eAAe,YAAY,SAAS,QAAQ,MAAM;AACxD,SAAO,gBAAgB,YAAY;AACpC;AAEA,IAAM,cAAc,CAAC,SAAS,EAAC,MAAM,KAAI,GAAW,SAAqB;AACxE,SAAO;AAAA,IACN,GAAG;AAAA,IACH,YAAY,GAAG,IAAI,IAAI,IAAI,IAAI,IAAI;AAAA,IACnC,OAAO,SAAS,UAAU,gBAAgB,QAAQ,IAAI,IAAI,eAAe,IAAI;AAAA,IAC7E,mBAAmB,SAAS;AAAA,EAC7B;AACD;AAEA,IAAM,kBAAkB,CAAC,SAAiB;AAAA;AAAA,WAE/B,IAAI;AAAA,sCACmB,0BAAU,IAAI,CAAC,QAAI,0BAAU,IAAI,CAAC;AAAA;AAGpE,IAAM,iBAAiB,CAAC,SAAiB;AAAA;AAAA;AAAA,mBAG1B,yBAAS,IAAI,CAAC;AAAA;AAAA;AAAA;",
|
|
6
|
+
"names": ["import_schematics", "import_lodash", "ts", "import_lodash", "import_devkit", "tree", "import_lodash", "import_devkit", "schematic", "input"]
|
|
7
7
|
}
|