Skip to content

Commit

Permalink
Merge branch 'main' into update-effects-to-standalone
Browse files Browse the repository at this point in the history
  • Loading branch information
markostanimirovic authored Dec 9, 2024
2 parents 0f9d962 + cb6e258 commit f83eb49
Show file tree
Hide file tree
Showing 43 changed files with 1,475 additions and 40 deletions.
2 changes: 1 addition & 1 deletion modules/component-store/schematics-core/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"outDir": "../../dist/modules/schematics-score",
"sourceMap": true,
"inlineSources": true,
"lib": ["es2018", "dom"],
"lib": ["es2022", "dom"],
"skipLibCheck": true,
"strict": true
},
Expand Down
80 changes: 80 additions & 0 deletions modules/component-store/schematics-core/utility/visitors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,86 @@ export function visitDecorator(
});
}

export function visitImportDeclaration(
node: ts.Node,
callback: (
importDeclaration: ts.ImportDeclaration,
moduleName?: string
) => void
) {
if (ts.isImportDeclaration(node)) {
const moduleSpecifier = node.moduleSpecifier.getText();
const moduleName = moduleSpecifier.replaceAll('"', '').replaceAll("'", '');

callback(node, moduleName);
}

ts.forEachChild(node, (child) => {
visitImportDeclaration(child, callback);
});
}

export function visitImportSpecifier(
node: ts.ImportDeclaration,
callback: (importSpecifier: ts.ImportSpecifier) => void
) {
const { importClause } = node;
if (!importClause) {
return;
}

const importClauseChildren = importClause.getChildren();
for (const namedImport of importClauseChildren) {
if (ts.isNamedImports(namedImport)) {
const namedImportChildren = namedImport.elements;
for (const importSpecifier of namedImportChildren) {
if (ts.isImportSpecifier(importSpecifier)) {
callback(importSpecifier);
}
}
}
}
}

export function visitTypeReference(
node: ts.Node,
callback: (typeReference: ts.TypeReferenceNode) => void
) {
if (ts.isTypeReferenceNode(node)) {
callback(node);
}

ts.forEachChild(node, (child) => {
visitTypeReference(child, callback);
});
}

export function visitTypeLiteral(
node: ts.Node,
callback: (typeLiteral: ts.TypeLiteralNode) => void
) {
if (ts.isTypeLiteralNode(node)) {
callback(node);
}

ts.forEachChild(node, (child) => {
visitTypeLiteral(child, callback);
});
}

export function visitCallExpression(
node: ts.Node,
callback: (callExpression: ts.CallExpression) => void
) {
if (ts.isCallExpression(node)) {
callback(node);
}

ts.forEachChild(node, (child) => {
visitCallExpression(child, callback);
});
}

function* visit(directory: DirEntry): IterableIterator<ts.SourceFile> {
for (const path of directory.subfiles) {
if (path.endsWith('.ts') && !path.endsWith('.d.ts')) {
Expand Down
2 changes: 1 addition & 1 deletion modules/component-store/tsconfig.schematics.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"sourceMap": true,
"inlineSources": true,
"lib": ["es2018", "dom"],
"lib": ["ES2022", "dom"],
"skipLibCheck": true,
"strict": true
},
Expand Down
2 changes: 1 addition & 1 deletion modules/component/schematics-core/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"outDir": "../../dist/modules/schematics-score",
"sourceMap": true,
"inlineSources": true,
"lib": ["es2018", "dom"],
"lib": ["es2022", "dom"],
"skipLibCheck": true,
"strict": true
},
Expand Down
80 changes: 80 additions & 0 deletions modules/component/schematics-core/utility/visitors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,86 @@ export function visitDecorator(
});
}

export function visitImportDeclaration(
node: ts.Node,
callback: (
importDeclaration: ts.ImportDeclaration,
moduleName?: string
) => void
) {
if (ts.isImportDeclaration(node)) {
const moduleSpecifier = node.moduleSpecifier.getText();
const moduleName = moduleSpecifier.replaceAll('"', '').replaceAll("'", '');

callback(node, moduleName);
}

ts.forEachChild(node, (child) => {
visitImportDeclaration(child, callback);
});
}

export function visitImportSpecifier(
node: ts.ImportDeclaration,
callback: (importSpecifier: ts.ImportSpecifier) => void
) {
const { importClause } = node;
if (!importClause) {
return;
}

const importClauseChildren = importClause.getChildren();
for (const namedImport of importClauseChildren) {
if (ts.isNamedImports(namedImport)) {
const namedImportChildren = namedImport.elements;
for (const importSpecifier of namedImportChildren) {
if (ts.isImportSpecifier(importSpecifier)) {
callback(importSpecifier);
}
}
}
}
}

export function visitTypeReference(
node: ts.Node,
callback: (typeReference: ts.TypeReferenceNode) => void
) {
if (ts.isTypeReferenceNode(node)) {
callback(node);
}

ts.forEachChild(node, (child) => {
visitTypeReference(child, callback);
});
}

export function visitTypeLiteral(
node: ts.Node,
callback: (typeLiteral: ts.TypeLiteralNode) => void
) {
if (ts.isTypeLiteralNode(node)) {
callback(node);
}

ts.forEachChild(node, (child) => {
visitTypeLiteral(child, callback);
});
}

export function visitCallExpression(
node: ts.Node,
callback: (callExpression: ts.CallExpression) => void
) {
if (ts.isCallExpression(node)) {
callback(node);
}

ts.forEachChild(node, (child) => {
visitCallExpression(child, callback);
});
}

function* visit(directory: DirEntry): IterableIterator<ts.SourceFile> {
for (const path of directory.subfiles) {
if (path.endsWith('.ts') && !path.endsWith('.d.ts')) {
Expand Down
2 changes: 1 addition & 1 deletion modules/component/tsconfig.schematics.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"sourceMap": true,
"inlineSources": true,
"lib": ["es2018", "dom"],
"lib": ["ES2022", "dom"],
"skipLibCheck": true,
"strict": true
},
Expand Down
2 changes: 1 addition & 1 deletion modules/data/schematics-core/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"outDir": "../../dist/modules/schematics-score",
"sourceMap": true,
"inlineSources": true,
"lib": ["es2018", "dom"],
"lib": ["es2022", "dom"],
"skipLibCheck": true,
"strict": true
},
Expand Down
80 changes: 80 additions & 0 deletions modules/data/schematics-core/utility/visitors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,86 @@ export function visitDecorator(
});
}

export function visitImportDeclaration(
node: ts.Node,
callback: (
importDeclaration: ts.ImportDeclaration,
moduleName?: string
) => void
) {
if (ts.isImportDeclaration(node)) {
const moduleSpecifier = node.moduleSpecifier.getText();
const moduleName = moduleSpecifier.replaceAll('"', '').replaceAll("'", '');

callback(node, moduleName);
}

ts.forEachChild(node, (child) => {
visitImportDeclaration(child, callback);
});
}

export function visitImportSpecifier(
node: ts.ImportDeclaration,
callback: (importSpecifier: ts.ImportSpecifier) => void
) {
const { importClause } = node;
if (!importClause) {
return;
}

const importClauseChildren = importClause.getChildren();
for (const namedImport of importClauseChildren) {
if (ts.isNamedImports(namedImport)) {
const namedImportChildren = namedImport.elements;
for (const importSpecifier of namedImportChildren) {
if (ts.isImportSpecifier(importSpecifier)) {
callback(importSpecifier);
}
}
}
}
}

export function visitTypeReference(
node: ts.Node,
callback: (typeReference: ts.TypeReferenceNode) => void
) {
if (ts.isTypeReferenceNode(node)) {
callback(node);
}

ts.forEachChild(node, (child) => {
visitTypeReference(child, callback);
});
}

export function visitTypeLiteral(
node: ts.Node,
callback: (typeLiteral: ts.TypeLiteralNode) => void
) {
if (ts.isTypeLiteralNode(node)) {
callback(node);
}

ts.forEachChild(node, (child) => {
visitTypeLiteral(child, callback);
});
}

export function visitCallExpression(
node: ts.Node,
callback: (callExpression: ts.CallExpression) => void
) {
if (ts.isCallExpression(node)) {
callback(node);
}

ts.forEachChild(node, (child) => {
visitCallExpression(child, callback);
});
}

function* visit(directory: DirEntry): IterableIterator<ts.SourceFile> {
for (const path of directory.subfiles) {
if (path.endsWith('.ts') && !path.endsWith('.d.ts')) {
Expand Down
2 changes: 1 addition & 1 deletion modules/data/tsconfig.schematics.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"sourceMap": true,
"inlineSources": true,
"lib": ["es2018", "dom"],
"lib": ["ES2022", "dom"],
"skipLibCheck": true,
"strict": true
},
Expand Down
2 changes: 1 addition & 1 deletion modules/effects/schematics-core/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"outDir": "../../dist/modules/schematics-score",
"sourceMap": true,
"inlineSources": true,
"lib": ["es2018", "dom"],
"lib": ["es2022", "dom"],
"skipLibCheck": true,
"strict": true
},
Expand Down
Loading

0 comments on commit f83eb49

Please sign in to comment.