@rxap/ts-morph 1.1.0-dev.17 → 1.1.0-dev.18

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/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [1.1.0-dev.18](https://gitlab.com/rxap/packages/compare/@rxap/ts-morph@1.1.0-dev.17...@rxap/ts-morph@1.1.0-dev.18) (2024-03-11)
7
+
8
+ ### Bug Fixes
9
+
10
+ - add Overwrite options type ([abf5d68](https://gitlab.com/rxap/packages/commit/abf5d68e01b4883ebf865da740973d9a18c3e319))
11
+ - ensure no index out of change error occurs ([bdcd4e0](https://gitlab.com/rxap/packages/commit/bdcd4e0722e259ae5b50eeaf7e79d70034d50aa5))
12
+
13
+ ### Features
14
+
15
+ - add function CoerceNestCacheModuleImport ([8de41bf](https://gitlab.com/rxap/packages/commit/8de41bf32674dd652d6846377f28514553426af4))
16
+
6
17
  # [1.1.0-dev.17](https://gitlab.com/rxap/packages/compare/@rxap/ts-morph@1.1.0-dev.16...@rxap/ts-morph@1.1.0-dev.17) (2024-03-09)
7
18
 
8
19
  ### Features
package/README.md CHANGED
@@ -17,5 +17,5 @@ yarn add @rxap/ts-morph
17
17
  ```
18
18
  **Install peer dependencies:**
19
19
  ```bash
20
- yarn add @rxap/utilities@^16.1.0-dev.6 ts-morph@^18.0.0 tslib@2.6.2
20
+ yarn add @rxap/utilities@^16.1.0-dev.7 ts-morph@^18.0.0 tslib@2.6.2
21
21
  ```
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
- "version": "1.1.0-dev.17",
2
+ "version": "1.1.0-dev.18",
3
3
  "name": "@rxap/ts-morph",
4
4
  "license": "GPL-3.0-or-later",
5
5
  "dependencies": {
6
6
  "tslib": "2.6.2"
7
7
  },
8
8
  "peerDependencies": {
9
- "@rxap/utilities": "^16.1.0-dev.6",
9
+ "@rxap/utilities": "^16.1.0-dev.7",
10
10
  "ts-morph": "^18.0.0",
11
11
  "tslib": "2.6.2"
12
12
  },
@@ -30,7 +30,7 @@
30
30
  "packageGroup": [
31
31
  {
32
32
  "package": "@rxap/utilities",
33
- "version": "16.1.0-dev.6"
33
+ "version": "16.1.0-dev.7"
34
34
  }
35
35
  ]
36
36
  },
@@ -44,7 +44,7 @@
44
44
  "directory": "packages/ts-morph"
45
45
  },
46
46
  "type": "commonjs",
47
- "gitHead": "6509da30b5b69f86513087d24c999d910bc204d7",
47
+ "gitHead": "c3694cfb8d782e855262a1498a0e0618bfd7d1cd",
48
48
  "main": "./src/index.js",
49
49
  "types": "./src/index.d.ts"
50
50
  }
package/src/index.d.ts CHANGED
@@ -7,6 +7,7 @@ export * from './lib/nest/coerce-health-module';
7
7
  export * from './lib/nest/coerce-nest-app-config';
8
8
  export * from './lib/nest/coerce-nest-app-controller';
9
9
  export * from './lib/nest/coerce-nest-app-module';
10
+ export * from './lib/nest/coerce-nest-cache-module-import';
10
11
  export * from './lib/nest/coerce-nest-config-module-import';
11
12
  export * from './lib/nest/coerce-nest-controller';
12
13
  export * from './lib/nest/coerce-nest-environment-provider';
package/src/index.js CHANGED
@@ -11,6 +11,7 @@ tslib_1.__exportStar(require("./lib/nest/coerce-health-module"), exports);
11
11
  tslib_1.__exportStar(require("./lib/nest/coerce-nest-app-config"), exports);
12
12
  tslib_1.__exportStar(require("./lib/nest/coerce-nest-app-controller"), exports);
13
13
  tslib_1.__exportStar(require("./lib/nest/coerce-nest-app-module"), exports);
14
+ tslib_1.__exportStar(require("./lib/nest/coerce-nest-cache-module-import"), exports);
14
15
  tslib_1.__exportStar(require("./lib/nest/coerce-nest-config-module-import"), exports);
15
16
  tslib_1.__exportStar(require("./lib/nest/coerce-nest-controller"), exports);
16
17
  tslib_1.__exportStar(require("./lib/nest/coerce-nest-environment-provider"), exports);
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/ts-morph/src/index.ts"],"names":[],"mappings":";;;AAAA,cAAc;AACd,yEAA+C;AAC/C,0EAAgD;AAChD,mFAAyD;AACzD,+EAAqD;AACrD,8EAAoD;AACpD,0EAAgD;AAChD,4EAAkD;AAClD,gFAAsD;AACtD,4EAAkD;AAClD,sFAA4D;AAC5D,4EAAkD;AAClD,sFAA4D;AAC5D,iFAAuD;AACvD,mFAAyD;AACzD,+EAAqD;AACrD,iFAAuD;AACvD,wEAA8C;AAC9C,2EAAiD;AACjD,mFAAyD;AACzD,yFAA+D;AAC/D,kFAAwD;AACxD,0EAAgD;AAChD,8EAAoD;AACpD,2EAAiD;AACjD,0EAAgD;AAChD,0EAAgD;AAChD,4EAAkD;AAClD,iFAAuD;AACvD,mFAAyD;AACzD,YAAY;AAEZ,iBAAiB;AACjB,mFAAyD;AACzD,gFAAsD;AACtD,+EAAqD;AACrD,yEAA+C;AAC/C,4EAAkD;AAClD,uFAA6D;AAC7D,YAAY;AAEZ,UAAU;AACV,sEAA4C;AAC5C,4EAAkD;AAClD,qEAA2C;AAC3C,yEAA+C;AAC/C,oEAA0C;AAC1C,sEAA4C;AAC5C,6DAAmC;AACnC,iEAAuC;AACvC,4EAAkD;AAClD,4EAAkD;AAClD,+DAAqC;AACrC,4EAAkD;AAClD,4EAAkD;AAClD,mEAAyC;AACzC,kEAAwC;AACxC,4EAAkD;AAClD,+DAAqC;AACrC,8DAAoC;AACpC,8DAAoC;AACpC,8EAAoD;AACpD,0DAAgC;AAChC,6FAAmE;AACnE,0EAAgD;AAChD,2DAAiC;AACjC,gEAAsC;AACtC,kEAAwC;AACxC,4DAAkC;AAClC,iEAAuC;AACvC,2DAAiC;AACjC,YAAY"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/ts-morph/src/index.ts"],"names":[],"mappings":";;;AAAA,cAAc;AACd,yEAA+C;AAC/C,0EAAgD;AAChD,mFAAyD;AACzD,+EAAqD;AACrD,8EAAoD;AACpD,0EAAgD;AAChD,4EAAkD;AAClD,gFAAsD;AACtD,4EAAkD;AAClD,qFAA2D;AAC3D,sFAA4D;AAC5D,4EAAkD;AAClD,sFAA4D;AAC5D,iFAAuD;AACvD,mFAAyD;AACzD,+EAAqD;AACrD,iFAAuD;AACvD,wEAA8C;AAC9C,2EAAiD;AACjD,mFAAyD;AACzD,yFAA+D;AAC/D,kFAAwD;AACxD,0EAAgD;AAChD,8EAAoD;AACpD,2EAAiD;AACjD,0EAAgD;AAChD,0EAAgD;AAChD,4EAAkD;AAClD,iFAAuD;AACvD,mFAAyD;AACzD,YAAY;AAEZ,iBAAiB;AACjB,mFAAyD;AACzD,gFAAsD;AACtD,+EAAqD;AACrD,yEAA+C;AAC/C,4EAAkD;AAClD,uFAA6D;AAC7D,YAAY;AAEZ,UAAU;AACV,sEAA4C;AAC5C,4EAAkD;AAClD,qEAA2C;AAC3C,yEAA+C;AAC/C,oEAA0C;AAC1C,sEAA4C;AAC5C,6DAAmC;AACnC,iEAAuC;AACvC,4EAAkD;AAClD,4EAAkD;AAClD,+DAAqC;AACrC,4EAAkD;AAClD,4EAAkD;AAClD,mEAAyC;AACzC,kEAAwC;AACxC,4EAAkD;AAClD,+DAAqC;AACrC,8DAAoC;AACpC,8DAAoC;AACpC,8EAAoD;AACpD,0DAAgC;AAChC,6FAAmE;AACnE,0EAAgD;AAChD,2DAAiC;AACjC,gEAAsC;AACtC,kEAAwC;AACxC,4DAAkC;AAClC,iEAAuC;AACvC,2DAAiC;AACjC,YAAY"}
@@ -1,2 +1,2 @@
1
1
  import { StatementedNode, StatementStructures, WriterFunction } from 'ts-morph';
2
- export declare function CoerceStatements(node: StatementedNode, statements: (string | WriterFunction | StatementStructures)[] | string | WriterFunction): void;
2
+ export declare function CoerceStatements(node: StatementedNode, statements: (string | WriterFunction | StatementStructures)[] | string | WriterFunction, overwrite?: boolean): void;
@@ -1,9 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CoerceStatements = void 0;
4
- function CoerceStatements(node, statements) {
5
- if (node.getStatements().length ===
6
- 0) {
4
+ function CoerceStatements(node, statements, overwrite = false) {
5
+ if (overwrite) {
6
+ const length = node.getStatements().length;
7
+ if (length > 0) {
8
+ node.removeStatements([0, length - 1]);
9
+ }
10
+ }
11
+ if (node.getStatements().length === 0) {
7
12
  node.addStatements(statements);
8
13
  }
9
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"coerce-statements.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/coerce-statements.ts"],"names":[],"mappings":";;;AAMA,SAAgB,gBAAgB,CAC9B,IAAqB,EACrB,UAAuF;IAEvF,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC,MAAM;QAC7B,CAAC,EAAE;QACH,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;KAChC;AACH,CAAC;AARD,4CAQC"}
1
+ {"version":3,"file":"coerce-statements.js","sourceRoot":"","sources":["../../../../../packages/ts-morph/src/lib/coerce-statements.ts"],"names":[],"mappings":";;;AAMA,SAAgB,gBAAgB,CAC9B,IAAqB,EACrB,UAAuF,EACvF,SAAS,GAAG,KAAK;IAEjB,IAAI,SAAS,EAAE;QACb,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC,MAAM,CAAC;QAC3C,IAAI,MAAM,GAAG,CAAC,EAAE;YACd,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;SACxC;KACF;IACD,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE;QACrC,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;KAChC;AACH,CAAC;AAdD,4CAcC"}
@@ -0,0 +1,4 @@
1
+ import { SourceFile } from 'ts-morph';
2
+ import { CoerceNestModuleImportOptions } from './coerce-nest-module-import';
3
+ export type CoerceNestCacheModuleImportOptions = Omit<CoerceNestModuleImportOptions, 'moduleName'>;
4
+ export declare function CoerceNestCacheModuleImport(sourceFile: SourceFile, options: CoerceNestCacheModuleImportOptions): void;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CoerceNestCacheModuleImport = void 0;
4
+ const ts_morph_1 = require("ts-morph");
5
+ const coerce_nest_module_import_1 = require("./coerce-nest-module-import");
6
+ function CoerceNestCacheModuleImport(sourceFile, options) {
7
+ (0, coerce_nest_module_import_1.CoerceNestModuleImport)(sourceFile, Object.assign(Object.assign({}, options), { moduleName: 'CacheModule', structures: [
8
+ {
9
+ moduleSpecifier: '@nestjs/cache-manager',
10
+ namedImports: ['CacheModule'],
11
+ },
12
+ {
13
+ moduleSpecifier: '@rxap/nest-utilities',
14
+ namedImports: ['CacheModuleOptionsLoader'],
15
+ }
16
+ ], importWriter: w => {
17
+ w.writeLine('CacheModule.registerAsync(');
18
+ ts_morph_1.Writers.object({
19
+ useClass: 'CacheModuleOptionsLoader',
20
+ })(w);
21
+ w.write(')');
22
+ } }));
23
+ }
24
+ exports.CoerceNestCacheModuleImport = CoerceNestCacheModuleImport;
25
+ //# sourceMappingURL=coerce-nest-cache-module-import.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coerce-nest-cache-module-import.js","sourceRoot":"","sources":["../../../../../../packages/ts-morph/src/lib/nest/coerce-nest-cache-module-import.ts"],"names":[],"mappings":";;;AAAA,uCAGkB;AAClB,2EAGqC;AAIrC,SAAgB,2BAA2B,CACzC,UAAsB,EACtB,OAA2C;IAE3C,IAAA,kDAAsB,EACpB,UAAU,kCACL,OAAO,KACV,UAAU,EAAE,aAAa,EACzB,UAAU,EAAE;YACV;gBACE,eAAe,EAAE,uBAAuB;gBACxC,YAAY,EAAE,CAAE,aAAa,CAAE;aAChC;YACD;gBACE,eAAe,EAAE,sBAAsB;gBACvC,YAAY,EAAE,CAAE,0BAA0B,CAAE;aAC7C;SACF,EACD,YAAY,EAAE,CAAC,CAAC,EAAE;YAChB,CAAC,CAAC,SAAS,CAAC,4BAA4B,CAAC,CAAC;YAC1C,kBAAO,CAAC,MAAM,CAAC;gBACb,QAAQ,EAAE,0BAA0B;aACrC,CAAC,CAAC,CAAC,CAAC,CAAC;YACN,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACf,CAAC,IAEJ,CAAC;AACJ,CAAC;AA3BD,kEA2BC"}