@ng-atomic/schematics 0.0.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/README.md +7 -0
- package/collection.json +56 -0
- package/package.json +14 -0
- package/src/_testing/build-expected-file-paths.d.ts +1 -0
- package/src/_testing/build-expected-file-paths.js +11 -0
- package/src/_testing/build-expected-file-paths.js.map +1 -0
- package/src/_testing/config.d.ts +1 -0
- package/src/_testing/config.js +6 -0
- package/src/_testing/config.js.map +1 -0
- package/src/_testing/create-app-module.d.ts +3 -0
- package/src/_testing/create-app-module.js +48 -0
- package/src/_testing/create-app-module.js.map +1 -0
- package/src/_testing/create-package.d.ts +3 -0
- package/src/_testing/create-package.js +14 -0
- package/src/_testing/create-package.js.map +1 -0
- package/src/_testing/create-workspace.d.ts +42 -0
- package/src/_testing/create-workspace.js +40 -0
- package/src/_testing/create-workspace.js.map +1 -0
- package/src/_testing/index.d.ts +4 -0
- package/src/_testing/index.js +8 -0
- package/src/_testing/index.js.map +1 -0
- package/src/_utilities/add-path-to-routes.d.ts +2 -0
- package/src/_utilities/add-path-to-routes.js +29 -0
- package/src/_utilities/add-path-to-routes.js.map +1 -0
- package/src/_utilities/angular-config.d.ts +4 -0
- package/src/_utilities/angular-config.js +18 -0
- package/src/_utilities/angular-config.js.map +1 -0
- package/src/_utilities/index.d.ts +4 -0
- package/src/_utilities/index.js +8 -0
- package/src/_utilities/index.js.map +1 -0
- package/src/_utilities/overwrite.d.ts +2 -0
- package/src/_utilities/overwrite.js +13 -0
- package/src/_utilities/overwrite.js.map +1 -0
- package/src/_utilities/package-config.d.ts +12 -0
- package/src/_utilities/package-config.js +47 -0
- package/src/_utilities/package-config.js.map +1 -0
- package/src/_utilities/ts-config.d.ts +2 -0
- package/src/_utilities/ts-config.js +13 -0
- package/src/_utilities/ts-config.js.map +1 -0
- package/src/atomic-component/_test/example.atom.ts.expected +15 -0
- package/src/atomic-component/files/__name@dasherize__/index.ts.template +1 -0
- package/src/atomic-component/index.d.ts +8 -0
- package/src/atomic-component/index.js +38 -0
- package/src/atomic-component/index.js.map +1 -0
- package/src/atomic-component/index.spec.ts +159 -0
- package/src/atomic-component/schema.d.ts +20 -0
- package/src/atomic-component/schema.js +3 -0
- package/src/atomic-component/schema.js.map +1 -0
- package/src/atomic-component/schema.json +133 -0
- package/src/ng-add/index.d.ts +3 -0
- package/src/ng-add/index.js +35 -0
- package/src/ng-add/index.js.map +1 -0
- package/src/ng-add/schema.json +29 -0
- package/src/page/_test/test.module.ts.expected +26 -0
- package/src/page/index.d.ts +3 -0
- package/src/page/index.js +54 -0
- package/src/page/index.js.map +1 -0
- package/src/page/index.spec.ts +29 -0
- package/src/pages/files/__name@dasherize__/__name@dasherize__.module.ts.template +15 -0
- package/src/pages/index.d.ts +3 -0
- package/src/pages/index.js +16 -0
- package/src/pages/index.js.map +1 -0
- package/src/pages/index.spec.ts +17 -0
- package/src/pages/schema.d.ts +7 -0
- package/src/pages/schema.js +3 -0
- package/src/pages/schema.js.map +1 -0
- package/src/pages/schema.json +44 -0
- package/src/setup/files/atomic/_atom.scss +7 -0
- package/src/setup/files/atomic/_component.scss +12 -0
- package/src/setup/files/atomic/_molecule.scss +7 -0
- package/src/setup/files/atomic/_organism.scss +7 -0
- package/src/setup/files/atomic/_page.scss +7 -0
- package/src/setup/files/atomic/_template.scss +7 -0
- package/src/setup/index.d.ts +2 -0
- package/src/setup/index.js +17 -0
- package/src/setup/index.js.map +1 -0
- package/src/setup/index.spec.ts +37 -0
package/README.md
ADDED
package/collection.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": ["@schematics/angular"],
|
|
3
|
+
"schematics": {
|
|
4
|
+
"atomic-component": {
|
|
5
|
+
"aliases": ["ac"],
|
|
6
|
+
"description": "Create an atomic component",
|
|
7
|
+
"factory": "./src/atomic-component/index#atomicComponent",
|
|
8
|
+
"schema": "./src/atomic-component/schema.json"
|
|
9
|
+
},
|
|
10
|
+
"atom": {
|
|
11
|
+
"description": "Create an atom.",
|
|
12
|
+
"factory": "./src/atomic-component/index#atom",
|
|
13
|
+
"schema": "./src/atomic-component/schema.json"
|
|
14
|
+
},
|
|
15
|
+
"molecule": {
|
|
16
|
+
"description": "Create a molecule.",
|
|
17
|
+
"factory": "./src/atomic-component/index#molecule",
|
|
18
|
+
"schema": "./src/atomic-component/schema.json"
|
|
19
|
+
},
|
|
20
|
+
"organism": {
|
|
21
|
+
"description": "Create a organism.",
|
|
22
|
+
"factory": "./src/atomic-component/index#organism",
|
|
23
|
+
"schema": "./src/atomic-component/schema.json"
|
|
24
|
+
},
|
|
25
|
+
"template": {
|
|
26
|
+
"description": "Create a template.",
|
|
27
|
+
"factory": "./src/atomic-component/index#template",
|
|
28
|
+
"schema": "./src/atomic-component/schema.json"
|
|
29
|
+
},
|
|
30
|
+
"frame": {
|
|
31
|
+
"description": "Create a template.",
|
|
32
|
+
"factory": "./src/atomic-component/index#frame",
|
|
33
|
+
"schema": "./src/atomic-component/schema.json"
|
|
34
|
+
},
|
|
35
|
+
"page": {
|
|
36
|
+
"description": "Create a page",
|
|
37
|
+
"factory": "./src/page/index#page",
|
|
38
|
+
"schema": "./src/atomic-component/schema.json"
|
|
39
|
+
},
|
|
40
|
+
"pages": {
|
|
41
|
+
"description": "Create a pages",
|
|
42
|
+
"factory": "./src/pages/index#pages",
|
|
43
|
+
"schema": "./src/pages/schema.json"
|
|
44
|
+
},
|
|
45
|
+
"ng-add": {
|
|
46
|
+
"description": "Add angular-atomic-schematics",
|
|
47
|
+
"factory": "./src/ng-add/index",
|
|
48
|
+
"schema": "./src/ng-add/schema.json"
|
|
49
|
+
},
|
|
50
|
+
"setup": {
|
|
51
|
+
"description": "Setup angular-atomic-schematics",
|
|
52
|
+
"factory": "./src/setup/index#setup",
|
|
53
|
+
"schema": "./src/ng-add//schema.json"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ng-atomic/schematics",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"schematics": "./collection.json",
|
|
5
|
+
"ng-add": {
|
|
6
|
+
"save": "devDependencies"
|
|
7
|
+
},
|
|
8
|
+
"main": "src/index.js",
|
|
9
|
+
"typings": "src/index.d.ts",
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"string-template": "^1.0.0"
|
|
12
|
+
},
|
|
13
|
+
"peerDependencies": {}
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const buildExpectedFilePaths: (path: string, name: string, rootPath: string, type: string) => string[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildExpectedFilePaths = void 0;
|
|
4
|
+
exports.buildExpectedFilePaths = (path, name, rootPath, type) => [
|
|
5
|
+
`${path}/${name}.module.ts`,
|
|
6
|
+
`${path}/${name}.${type}.scss`,
|
|
7
|
+
`${path}/${name}.${type}.spec.ts`,
|
|
8
|
+
`${path}/${name}.${type}.ts`,
|
|
9
|
+
`${path}/index.ts`,
|
|
10
|
+
].map(path => `${rootPath}/src/app/${path}`);
|
|
11
|
+
//# sourceMappingURL=build-expected-file-paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-expected-file-paths.js","sourceRoot":"","sources":["../../../../../libs/schematics/src/_testing/build-expected-file-paths.ts"],"names":[],"mappings":";;;AAAa,QAAA,sBAAsB,GAAG,CAAC,IAAY,EAAE,IAAY,EAAE,QAAgB,EAAE,IAAY,EAAE,EAAE,CAAC;IACpG,GAAG,IAAI,IAAI,IAAI,YAAY;IAC3B,GAAG,IAAI,IAAI,IAAI,IAAI,IAAI,OAAO;IAC9B,GAAG,IAAI,IAAI,IAAI,IAAI,IAAI,UAAU;IACjC,GAAG,IAAI,IAAI,IAAI,IAAI,IAAI,KAAK;IAC5B,GAAG,IAAI,WAAW;CACnB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,QAAQ,YAAY,IAAI,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const COLLECTION_PATH: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../../../libs/schematics/src/_testing/config.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAEhB,QAAA,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,uBAAuB,CAAC,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { UnitTestTree } from '@angular-devkit/schematics/testing';
|
|
2
|
+
export declare function createAppModule(tree: UnitTestTree, path?: string): UnitTestTree;
|
|
3
|
+
export declare function createAppModuleWithEffects(tree: UnitTestTree, path: string, effects?: string): UnitTestTree;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createAppModuleWithEffects = exports.createAppModule = void 0;
|
|
4
|
+
function createAppModule(tree, path) {
|
|
5
|
+
tree.create(path || '/src/app/app.module.ts', `
|
|
6
|
+
import { BrowserModule } from '@angular/platform-browser';
|
|
7
|
+
import { NgModule } from '@angular/core';
|
|
8
|
+
import { AppComponent } from './app.component';
|
|
9
|
+
|
|
10
|
+
@NgModule({
|
|
11
|
+
declarations: [
|
|
12
|
+
AppComponent
|
|
13
|
+
],
|
|
14
|
+
imports: [
|
|
15
|
+
BrowserModule
|
|
16
|
+
],
|
|
17
|
+
providers: [],
|
|
18
|
+
bootstrap: [AppComponent]
|
|
19
|
+
})
|
|
20
|
+
export class AppModule { }
|
|
21
|
+
`);
|
|
22
|
+
return tree;
|
|
23
|
+
}
|
|
24
|
+
exports.createAppModule = createAppModule;
|
|
25
|
+
function createAppModuleWithEffects(tree, path, effects) {
|
|
26
|
+
tree.create(path || '/src/app/app.module.ts', `
|
|
27
|
+
import { BrowserModule } from '@angular/platform-browser';
|
|
28
|
+
import { NgModule } from '@angular/core';
|
|
29
|
+
import { AppComponent } from './app.component';
|
|
30
|
+
import { EffectsModule } from '@ngrx/effects';
|
|
31
|
+
|
|
32
|
+
@NgModule({
|
|
33
|
+
declarations: [
|
|
34
|
+
AppComponent
|
|
35
|
+
],
|
|
36
|
+
imports: [
|
|
37
|
+
BrowserModule,
|
|
38
|
+
${effects}
|
|
39
|
+
],
|
|
40
|
+
providers: [],
|
|
41
|
+
bootstrap: [AppComponent]
|
|
42
|
+
})
|
|
43
|
+
export class AppModule { }
|
|
44
|
+
`);
|
|
45
|
+
return tree;
|
|
46
|
+
}
|
|
47
|
+
exports.createAppModuleWithEffects = createAppModuleWithEffects;
|
|
48
|
+
//# sourceMappingURL=create-app-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-app-module.js","sourceRoot":"","sources":["../../../../../libs/schematics/src/_testing/create-app-module.ts"],"names":[],"mappings":";;;AAEA,SAAgB,eAAe,CAC7B,IAAkB,EAClB,IAAa;IAEb,IAAI,CAAC,MAAM,CACT,IAAI,IAAI,wBAAwB,EAChC;;;;;;;;;;;;;;;;GAgBD,CACA,CAAC;IAEF,OAAO,IAAI,CAAC;AACd,CAAC;AA1BD,0CA0BC;AAED,SAAgB,0BAA0B,CACxC,IAAkB,EAClB,IAAY,EACZ,OAAgB;IAEhB,IAAI,CAAC,MAAM,CACT,IAAI,IAAI,wBAAwB,EAChC;;;;;;;;;;;;UAYM,OAAO;;;;;;GAMd,CACA,CAAC;IAEF,OAAO,IAAI,CAAC;AACd,CAAC;AA7BD,gEA6BC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createPackageJson = exports.packagePath = void 0;
|
|
4
|
+
exports.packagePath = '/package.json';
|
|
5
|
+
function createPackageJson(prefix, pkg, tree, version = '5.2.0', packagePath = '/package.json') {
|
|
6
|
+
tree.create(packagePath, `{
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@ngrx/${pkg}": "${prefix}${version}"
|
|
9
|
+
}
|
|
10
|
+
}`);
|
|
11
|
+
return tree;
|
|
12
|
+
}
|
|
13
|
+
exports.createPackageJson = createPackageJson;
|
|
14
|
+
//# sourceMappingURL=create-package.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-package.js","sourceRoot":"","sources":["../../../../../libs/schematics/src/_testing/create-package.ts"],"names":[],"mappings":";;;AAGa,QAAA,WAAW,GAAG,eAAe,CAAC;AAE3C,SAAgB,iBAAiB,CAC/B,MAAc,EACd,GAAW,EACX,IAAkB,EAClB,OAAO,GAAG,OAAO,EACjB,WAAW,GAAG,eAAe;IAE7B,IAAI,CAAC,MAAM,CACT,WAAW,EACX;;iBAEa,GAAG,OAAO,MAAM,GAAG,OAAO;;MAErC,CACH,CAAC;IAEF,OAAO,IAAI,CAAC;AACd,CAAC;AAjBD,8CAiBC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { SchematicTestRunner, UnitTestTree } from '@angular-devkit/schematics/testing';
|
|
2
|
+
export declare const defaultWorkspaceOptions: {
|
|
3
|
+
name: string;
|
|
4
|
+
newProjectRoot: string;
|
|
5
|
+
version: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const defaultAppOptions: {
|
|
8
|
+
name: string;
|
|
9
|
+
inlineStyle: boolean;
|
|
10
|
+
inlineTemplate: boolean;
|
|
11
|
+
viewEncapsulation: string;
|
|
12
|
+
routing: boolean;
|
|
13
|
+
style: string;
|
|
14
|
+
skipTests: boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare function getTestProjectPath(workspaceOptions?: any, options?: any): string;
|
|
17
|
+
export declare function createWorkspace(runner: SchematicTestRunner, host: UnitTestTree, workspaceOptions?: {
|
|
18
|
+
name: string;
|
|
19
|
+
newProjectRoot: string;
|
|
20
|
+
version: string;
|
|
21
|
+
}, options?: {
|
|
22
|
+
name: string;
|
|
23
|
+
inlineStyle: boolean;
|
|
24
|
+
inlineTemplate: boolean;
|
|
25
|
+
viewEncapsulation: string;
|
|
26
|
+
routing: boolean;
|
|
27
|
+
style: string;
|
|
28
|
+
skipTests: boolean;
|
|
29
|
+
}): Promise<UnitTestTree>;
|
|
30
|
+
export declare function createNxWorkspace(runner: SchematicTestRunner, host: UnitTestTree, workspaceOptions?: {
|
|
31
|
+
name: string;
|
|
32
|
+
newProjectRoot: string;
|
|
33
|
+
version: string;
|
|
34
|
+
}, options?: {
|
|
35
|
+
name: string;
|
|
36
|
+
inlineStyle: boolean;
|
|
37
|
+
inlineTemplate: boolean;
|
|
38
|
+
viewEncapsulation: string;
|
|
39
|
+
routing: boolean;
|
|
40
|
+
style: string;
|
|
41
|
+
skipTests: boolean;
|
|
42
|
+
}): Promise<UnitTestTree>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createNxWorkspace = exports.createWorkspace = exports.getTestProjectPath = exports.defaultAppOptions = exports.defaultWorkspaceOptions = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
exports.defaultWorkspaceOptions = {
|
|
6
|
+
name: 'workspace',
|
|
7
|
+
newProjectRoot: 'projects',
|
|
8
|
+
version: '6.0.0',
|
|
9
|
+
};
|
|
10
|
+
exports.defaultAppOptions = {
|
|
11
|
+
name: 'app',
|
|
12
|
+
inlineStyle: false,
|
|
13
|
+
inlineTemplate: false,
|
|
14
|
+
viewEncapsulation: 'Emulated',
|
|
15
|
+
routing: false,
|
|
16
|
+
style: 'scss',
|
|
17
|
+
skipTests: false,
|
|
18
|
+
};
|
|
19
|
+
function getTestProjectPath(workspaceOptions = exports.defaultWorkspaceOptions, options = exports.defaultAppOptions) {
|
|
20
|
+
return `/${workspaceOptions.newProjectRoot}/${options.name}`;
|
|
21
|
+
}
|
|
22
|
+
exports.getTestProjectPath = getTestProjectPath;
|
|
23
|
+
function createWorkspace(runner, host, workspaceOptions = exports.defaultWorkspaceOptions, options = exports.defaultAppOptions) {
|
|
24
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
host = yield runner.runExternalSchematicAsync('@schematics/angular', 'workspace', workspaceOptions).toPromise();
|
|
26
|
+
host = yield runner.runExternalSchematicAsync('@schematics/angular', 'application', options, host).toPromise();
|
|
27
|
+
host = yield runner.runExternalSchematicAsync('@schematics/angular', 'application', Object.assign(Object.assign({}, options), { name: 'app2' }), host).toPromise();
|
|
28
|
+
return host;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
exports.createWorkspace = createWorkspace;
|
|
32
|
+
function createNxWorkspace(runner, host, workspaceOptions = exports.defaultWorkspaceOptions, options = exports.defaultAppOptions) {
|
|
33
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
host = yield runner.runExternalSchematicAsync('@nrwl/angular', 'workspace', Object.assign(Object.assign({}, workspaceOptions), { cli: 'angular' })).toPromise();
|
|
35
|
+
host = yield runner.runExternalSchematicAsync('@nrwl/angular', 'application', options, host).toPromise();
|
|
36
|
+
return host;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
exports.createNxWorkspace = createNxWorkspace;
|
|
40
|
+
//# sourceMappingURL=create-workspace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-workspace.js","sourceRoot":"","sources":["../../../../../libs/schematics/src/_testing/create-workspace.ts"],"names":[],"mappings":";;;;AAEa,QAAA,uBAAuB,GAAG;IACrC,IAAI,EAAE,WAAW;IACjB,cAAc,EAAE,UAAU;IAC1B,OAAO,EAAE,OAAO;CACjB,CAAC;AAEW,QAAA,iBAAiB,GAAG;IAC/B,IAAI,EAAE,KAAK;IACX,WAAW,EAAE,KAAK;IAClB,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AC;IACd,CAAC;CAAA;AAPD,8CAOC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./build-expected-file-paths"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./config"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./create-app-module"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./create-workspace"), exports);
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/schematics/src/_testing/index.ts"],"names":[],"mappings":";;;AAAA,sEAA4C;AAC5C,mDAAyB;AACzB,8DAAoC;AACpC,6DAAmC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addPathToRoutes = void 0;
|
|
4
|
+
const ast_utils_1 = require("@nrwl/workspace/src/utils/ast-utils");
|
|
5
|
+
const ts = require("typescript");
|
|
6
|
+
const isVariableDeclaration = (n) => n.kind === ts.SyntaxKind.VariableDeclaration;
|
|
7
|
+
const isIdentifier = (n) => n.kind === ts.SyntaxKind.Identifier;
|
|
8
|
+
const isArrayLiteralExpression = (n) => n.kind === ts.SyntaxKind.ArrayLiteralExpression;
|
|
9
|
+
const matchText = (n, text) => n.getText() === text;
|
|
10
|
+
const hasMatchTextChild = (n, text) => {
|
|
11
|
+
return n.getChildren().findIndex(c => (isIdentifier(c) && matchText(c, text))) !== -1;
|
|
12
|
+
};
|
|
13
|
+
const isRoutesVariableDeclaration = (n) => isVariableDeclaration(n) && hasMatchTextChild(n, 'routes');
|
|
14
|
+
exports.addPathToRoutes = ({ route, routingModulePath, removeOtherRoutes }) => (host) => {
|
|
15
|
+
const src = ts.createSourceFile(routingModulePath, host.read(routingModulePath).toString('utf-8'), ts.ScriptTarget.Latest, true);
|
|
16
|
+
const nodes = ast_utils_1.getSourceNodes(src);
|
|
17
|
+
const routeNodes = nodes.filter(isRoutesVariableDeclaration).map((n) => {
|
|
18
|
+
return n.getChildren().filter(isArrayLiteralExpression).reverse()[0];
|
|
19
|
+
});
|
|
20
|
+
if (routeNodes.length === 1) {
|
|
21
|
+
const n = routeNodes[0];
|
|
22
|
+
const recorder = host.beginUpdate(routingModulePath);
|
|
23
|
+
const suffix = n.elements.length > 0 && !removeOtherRoutes ? ',' : '';
|
|
24
|
+
recorder.insertRight(n.getStart() + 1, `${route}${suffix}`);
|
|
25
|
+
host.commitUpdate(recorder);
|
|
26
|
+
}
|
|
27
|
+
return host;
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=add-path-to-routes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-path-to-routes.js","sourceRoot":"","sources":["../../../../../libs/schematics/src/_utilities/add-path-to-routes.ts"],"names":[],"mappings":";;;AACA,mEAAqE;AACrE,iCAAiC;AAEjC,MAAM,qBAAqB,GAAG,CAAC,CAAU,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC,UAAU,CAAC,mBAAmB,CAAC;AAC3F,MAAM,YAAY,GAAG,CAAC,CAAU,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC;AACzE,MAAM,wBAAwB,GAAG,CAAC,CAAU,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC,UAAU,CAAC,sBAAsB,CAAC;AACjG,MAAM,SAAS,GAAG,CAAC,CAAU,EAAE,IAAY,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,KAAK,IAAI,CAAC;AACrE,MAAM,iBAAiB,GAAG,CAAC,CAAU,EAAE,IAAY,EAAE,EAAE;IACtD,OAAO,CAAC,CAAC,WAAW,E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AC;QACtE,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE,GAAG,KAAK,GAAG,MAAM,EAAE,CAAC,CAAC;QAC5D,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;KAC5B;IAED,OAAO,IAAI,CAAC;AACb,CAAC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Tree } from '@angular-devkit/schematics';
|
|
2
|
+
export declare const addSchematicsConfig: ({ project, componentsDir }: any, type: string) => (host: Tree) => Tree;
|
|
3
|
+
export declare const setDefaultCollection: () => (host: Tree) => import("@angular-devkit/schematics/src/tree/interface").Tree;
|
|
4
|
+
export declare const addStyleIncludePath: ({ project, stylesDir }: any) => (host: Tree) => import("@angular-devkit/schematics/src/tree/interface").Tree;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addStyleIncludePath = exports.setDefaultCollection = exports.addSchematicsConfig = void 0;
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
const overwrite_1 = require("./overwrite");
|
|
6
|
+
const PACKAGE_NAME = 'angular-atomic-schematics';
|
|
7
|
+
exports.addSchematicsConfig = ({ project, componentsDir }, type) => (host) => {
|
|
8
|
+
const query = `projects.${project}.schematics.${PACKAGE_NAME}:${type}`;
|
|
9
|
+
return overwrite_1.overwrite(host, 'angular.json', json => (lodash_1.set(json, query, { 'path': `${componentsDir}/${type}s` }), json));
|
|
10
|
+
};
|
|
11
|
+
exports.setDefaultCollection = () => (host) => {
|
|
12
|
+
return overwrite_1.overwrite(host, 'angular.json', json => (lodash_1.set(json, `cli.defaultCollection`, PACKAGE_NAME), json));
|
|
13
|
+
};
|
|
14
|
+
exports.addStyleIncludePath = ({ project, stylesDir }) => (host) => {
|
|
15
|
+
const query = `projects.${project}.architect.build.options.stylePreprocessorOptions.includePaths`;
|
|
16
|
+
return overwrite_1.overwrite(host, 'angular.json', json => (lodash_1.set(json, query, [...new Set(lodash_1.get(json, query)).add(stylesDir)]), json));
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=angular-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"angular-config.js","sourceRoot":"","sources":["../../../../../libs/schematics/src/_utilities/angular-config.ts"],"names":[],"mappings":";;;AACA,mCAAkC;AAClC,2CAAwC;AAExC,MAAM,YAAY,GAAG,2BAA2B,CAAC;AAEpC,QAAA,mBAAmB,GAAG,CAAC,EAAC,OAAO,EAAE,aAAa,EAAM,EAAE,IAAY,EAAE,EAAE,CAAC,CAAC,IAAU,EAAQ,EAAE;IACxG,MAAM,KAAK,GAAG,YAAY,OAAO,eAAe,YAAY,IAAI,IAAI,EAAE,CAAC;IACvE,OAAO,qBAAS,CAAC,IAAI,EAAE,cAAc,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,YAAG,CAAC,IAAI,EAAE,KAAK,EAAE,EAAC,MAAM,EAAE,GAAG,aAAa,IAAI,IAAI,GAAG,EAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;AACjH,CAAC,CAAC;AAEW,QAAA,oBAAoB,GAAG,GAAG,EAAE,CAAC,CAAC,IAAU,EAAE,EAAE;IACxD,OAAO,qBAAS,CAAC,IAAI,EAAE,cAAc,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,YAAG,CAAC,IAAI,EAAE,uBAAuB,EAAE,YAAY,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;AAC1G,CAAC,CAAA;AAEY,QAAA,mBAAmB,GAAG,CAAC,EAAC,OAAO,EAAE,SAAS,EAAM,EAAE,EAAE,CAAC,CAAC,IAAU,EAAE,EAAE;IAChF,MAAM,KAAK,GAAG,YAAY,OAAO,gEAAgE,CAAC;IAClG,OAAO,qBAAS,CAAC,IAAI,EAAE,cAAc,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,YAAG,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,YAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;AACzH,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./add-path-to-routes"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./angular-config"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./package-config"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./ts-config"), exports);
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/schematics/src/_utilities/index.ts"],"names":[],"mappings":";;;AAAA,+DAAqC;AACrC,2DAAiC;AACjC,2DAAiC;AACjC,sDAA4B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.overwrite = void 0;
|
|
4
|
+
const jsonc_parser_1 = require("jsonc-parser");
|
|
5
|
+
function overwrite(host, file, callback) {
|
|
6
|
+
if (!host.exists(file))
|
|
7
|
+
return host;
|
|
8
|
+
const json = jsonc_parser_1.parse(host.read(file).toString('utf-8'));
|
|
9
|
+
host.overwrite(file, JSON.stringify(callback(json), null, 2));
|
|
10
|
+
return host;
|
|
11
|
+
}
|
|
12
|
+
exports.overwrite = overwrite;
|
|
13
|
+
//# sourceMappingURL=overwrite.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overwrite.js","sourceRoot":"","sources":["../../../../../libs/schematics/src/_utilities/overwrite.ts"],"names":[],"mappings":";;;AAEA,+CAAqC;AAErC,SAAgB,SAAS,CAAC,IAAU,EAAE,IAAY,EAAE,QAAkC;IACrF,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACpC,MAAM,IAAI,GAAG,oBAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;IACvD,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC9D,OAAO,IAAI,CAAC;AACb,CAAC;AALD,8BAKC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
8
|
+
import { Tree } from '@angular-devkit/schematics';
|
|
9
|
+
/** Adds a package to the package.json in the given host tree. */
|
|
10
|
+
export declare function addPackageToPackageJson(host: Tree, pkg: string, version: string, dependencies?: string): Tree;
|
|
11
|
+
/** Gets the version of the specified package by looking at the package.json in the given tree. */
|
|
12
|
+
export declare function getPackageVersionFromPackageJson(tree: Tree, name: string): string | null;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.getPackageVersionFromPackageJson = exports.addPackageToPackageJson = void 0;
|
|
11
|
+
/**
|
|
12
|
+
* Sorts the keys of the given object.
|
|
13
|
+
* @returns A new object instance with sorted keys
|
|
14
|
+
*/
|
|
15
|
+
function sortObjectByKeys(obj) {
|
|
16
|
+
return Object.keys(obj).sort().reduce((result, key) => (result[key] = obj[key]) && result, {});
|
|
17
|
+
}
|
|
18
|
+
/** Adds a package to the package.json in the given host tree. */
|
|
19
|
+
function addPackageToPackageJson(host, pkg, version, dependencies = 'dependencies') {
|
|
20
|
+
if (host.exists('package.json')) {
|
|
21
|
+
const sourceText = host.read('package.json').toString('utf-8');
|
|
22
|
+
const json = JSON.parse(sourceText);
|
|
23
|
+
if (!json[dependencies]) {
|
|
24
|
+
json[dependencies] = {};
|
|
25
|
+
}
|
|
26
|
+
if (!json[dependencies][pkg]) {
|
|
27
|
+
json[dependencies][pkg] = version;
|
|
28
|
+
json[dependencies] = sortObjectByKeys(json[dependencies]);
|
|
29
|
+
}
|
|
30
|
+
host.overwrite('package.json', JSON.stringify(json, null, 2));
|
|
31
|
+
}
|
|
32
|
+
return host;
|
|
33
|
+
}
|
|
34
|
+
exports.addPackageToPackageJson = addPackageToPackageJson;
|
|
35
|
+
/** Gets the version of the specified package by looking at the package.json in the given tree. */
|
|
36
|
+
function getPackageVersionFromPackageJson(tree, name) {
|
|
37
|
+
if (!tree.exists('package.json')) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
const packageJson = JSON.parse(tree.read('package.json').toString('utf8'));
|
|
41
|
+
if (packageJson.dependencies && packageJson.dependencies[name]) {
|
|
42
|
+
return packageJson.dependencies[name];
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
exports.getPackageVersionFromPackageJson = getPackageVersionFromPackageJson;
|
|
47
|
+
//# sourceMappingURL=package-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-config.js","sourceRoot":"","sources":["../../../../../libs/schematics/src/_utilities/package-config.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAIH;;;GAGG;AAC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M,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;IAE5E,IAAI,WAAW,CAAC,YAAY,IAAI,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE;QAC9D,OAAO,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;KACvC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAZD,4EAYC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addPathsToTsConfig = void 0;
|
|
4
|
+
const lodash_1 = require("lodash");
|
|
5
|
+
const overwrite_1 = require("./overwrite");
|
|
6
|
+
exports.addPathsToTsConfig = ({ componentsDir }) => (host) => {
|
|
7
|
+
return overwrite_1.overwrite(host, host.exists('tsconfig.base.json') ? 'tsconfig.base.json' : 'tsconfig.json', json => {
|
|
8
|
+
lodash_1.set(json, `compilerOptions.paths.@components`, [componentsDir]);
|
|
9
|
+
lodash_1.set(json, `compilerOptions.paths.@components/*`, [`${componentsDir}/*`]);
|
|
10
|
+
return json;
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=ts-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ts-config.js","sourceRoot":"","sources":["../../../../../libs/schematics/src/_utilities/ts-config.ts"],"names":[],"mappings":";;;AACA,mCAA6B;AAC7B,2CAAwC;AAE3B,QAAA,kBAAkB,GAAG,CAAC,EAAC,aAAa,EAAM,EAAE,EAAE,CAAC,CAAC,IAAU,EAAE,EAAE;IAC1E,OAAO,qBAAS,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,eAAe,EAAE,IAAI,CAAC,EAAE;QACzG,YAAG,CAAC,IAAI,EAAE,mCAAmC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;QAChE,YAAG,CAAC,IAAI,EAAE,qCAAqC,EAAE,CAAC,GAAG,aAAa,IAAI,CAAC,CAAC,CAAC;QACzE,OAAO,IAAI,CAAC;IACb,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Component, OnInit } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'atoms-example',
|
|
5
|
+
templateUrl: './example.atom.html',
|
|
6
|
+
styleUrls: ['./example.atom.scss']
|
|
7
|
+
})
|
|
8
|
+
export class ExampleAtom implements OnInit {
|
|
9
|
+
|
|
10
|
+
constructor() { }
|
|
11
|
+
|
|
12
|
+
ngOnInit(): void {
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { <%= classify(name) %>Module } from './<%= dasherize(name) %>.module';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Rule } from '@angular-devkit/schematics';
|
|
2
|
+
import { Schema } from './schema';
|
|
3
|
+
export declare const atomicComponent: (options: Schema) => Rule;
|
|
4
|
+
export declare const atom: (options: Schema) => Rule;
|
|
5
|
+
export declare const molecule: (options: Schema) => Rule;
|
|
6
|
+
export declare const organism: (options: Schema) => Rule;
|
|
7
|
+
export declare const template: (options: Schema) => Rule;
|
|
8
|
+
export declare const frame: (options: Schema) => Rule;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.frame = exports.template = exports.organism = exports.molecule = exports.atom = exports.atomicComponent = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
6
|
+
const strings = require("@angular-devkit/core/src/utils/strings");
|
|
7
|
+
const parse_name_1 = require("@schematics/angular/utility/parse-name");
|
|
8
|
+
const workspace_1 = require("@schematics/angular/utility/workspace");
|
|
9
|
+
const path_1 = require("path");
|
|
10
|
+
exports.atomicComponent = (options) => (host, _) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
11
|
+
var _a, _b;
|
|
12
|
+
(_a = options.prefix) !== null && _a !== void 0 ? _a : (options.prefix = 'extras');
|
|
13
|
+
options.path = path_1.join(yield workspace_1.createDefaultPath(host, options.project), (_b = options === null || options === void 0 ? void 0 : options.path) !== null && _b !== void 0 ? _b : '');
|
|
14
|
+
const { name, path, type } = options = Object.assign(Object.assign({}, options), parse_name_1.parseName(options.path, options.name));
|
|
15
|
+
delete options.styleHeader;
|
|
16
|
+
return schematics_1.chain([
|
|
17
|
+
schematics_1.externalSchematic('@schematics/angular', 'module', { name, path, project: options.project }),
|
|
18
|
+
schematics_1.externalSchematic('@schematics/angular', 'component', Object.assign(Object.assign({}, options), { export: true })),
|
|
19
|
+
// externalSchematic('angular-host-css-variable', 'component', {...options, styleHeader: format(options.styleHeader, { name, type }), export: true}),
|
|
20
|
+
schematics_1.mergeWith(schematics_1.apply(schematics_1.url('./files'), [schematics_1.applyTemplates(Object.assign(Object.assign({}, strings), { name })), schematics_1.move(path)])),
|
|
21
|
+
addExportIntoIndexTs(Object.assign({}, options))
|
|
22
|
+
]);
|
|
23
|
+
});
|
|
24
|
+
exports.atom = (options) => exports.atomicComponent(buildOptions(options, 'atom'));
|
|
25
|
+
exports.molecule = (options) => exports.atomicComponent(buildOptions(options, 'molecule'));
|
|
26
|
+
exports.organism = (options) => exports.atomicComponent(buildOptions(options, 'organism'));
|
|
27
|
+
exports.template = (options) => exports.atomicComponent(buildOptions(options, 'template'));
|
|
28
|
+
exports.frame = (options) => exports.atomicComponent(buildOptions(options, 'frame'));
|
|
29
|
+
const buildOptions = (options, type) => (Object.assign(Object.assign({}, options), { type: options.type || type, prefix: options.prefix || `${options.type || type}s` }));
|
|
30
|
+
const addExportIntoIndexTs = ({ path, name }) => (tree) => {
|
|
31
|
+
const indexTsPath = path_1.join(path, 'index.ts');
|
|
32
|
+
tree.exists(indexTsPath) || tree.create(indexTsPath, '');
|
|
33
|
+
const lines = tree.read(indexTsPath).toString('utf-8').split('\n').filter(line => line.length);
|
|
34
|
+
const line = `export { ${strings.classify(name)}Module } from './${strings.dasherize(name)}';`;
|
|
35
|
+
tree.overwrite(indexTsPath, (lines.includes(line) ? lines : [...lines, line]).join('\n'));
|
|
36
|
+
return tree;
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/schematics/src/atomic-component/index.ts"],"names":[],"mappings":";;;;AAAA,2DAGoC;AACpC,kEAAkE;AAClE,uEAAmE;AACnE,qEAA0E;AAE1E,+BAA4B;AAGf,QAAA,eAAe,GAAG,CAAC,OAAe,EAAQ,EAAE,CAAC,CAAO,IAAU,EAAE,CAAmB,EAAE,EAAE;;IACnG,MAAA,OAAO,CAAC,MAAM,oCAAd,OAAO,CAAC,MAAM,GAAK,QAAQ,EAAC;IAC5B,OAAO,CAAC,IAAI,GAAG,WAAI,CAAC,MAAM,6BAAiB,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,QAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,mCAAI,EAAE,CAAC,CAAC;IACzF,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,OAAO,mCAAO,OAAO,GAAK,sBAAS,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9F,OAAO,OAAO,CAAC,WAAW,CAAC;IAE3B,OAAO,kBAAK,CAAC;QACZ,8BAAiB,CAAC,qBAAqB,EAAE,QAAQ,EAAE,EAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAC,CAAC;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