@yeoman/types 1.5.0 → 1.7.0

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 ADDED
@@ -0,0 +1,15 @@
1
+ # @yeoman/types
2
+
3
+ [![NPM version][npm-image]][npm-url]
4
+ [![NPM Test](https://github.com/yeoman/yeoman-api/actions/workflows/ci.yml/badge.svg)](https://github.com/yeoman/yeoman-api/actions/workflows/ci.yml)
5
+
6
+ > Stable types for yeoman's generator/environment stack
7
+
8
+ Intended for internal yeoman generator/environment stack use.
9
+
10
+ ## License
11
+
12
+ MIT © [The Yeoman Team](http://yeoman.io)
13
+
14
+ [npm-image]: https://badge.fury.io/js/@yeoman%2Ftypes.svg
15
+ [npm-url]: https://npmjs.org/package/@yeoman/types
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeoman/types",
3
- "version": "1.5.0",
3
+ "version": "1.7.0",
4
4
  "private": false,
5
5
  "description": "Common API for yeoman's generator/environment stack",
6
6
  "keywords": [
@@ -24,9 +24,6 @@
24
24
  "clean-all": "rimraf node_modules",
25
25
  "test": ""
26
26
  },
27
- "dependencies": {
28
- "@yeoman/adapter": "^1.6.0"
29
- },
30
27
  "devDependencies": {
31
28
  "@types/node": "16.18.26",
32
29
  "@yeoman/adapter": "^1.6.0",
@@ -35,11 +32,14 @@
35
32
  },
36
33
  "peerDependencies": {
37
34
  "@types/node": ">=16.18.26",
38
- "@yeoman/adapter": "^1.6.0",
39
- "mem-fs": "^3.0.0",
40
- "mem-fs-editor": "^10.0.2"
35
+ "@yeoman/adapter": "^1.6.0 || ^2.0.0-beta.0",
36
+ "mem-fs": "^3.0.0 || ^4.0.0-beta.1",
37
+ "mem-fs-editor": "^10.0.2 || >=10.0.2"
41
38
  },
42
39
  "peerDependenciesMeta": {
40
+ "@yeoman/adapter": {
41
+ "optional": true
42
+ },
43
43
  "mem-fs": {
44
44
  "optional": true
45
45
  },
@@ -54,10 +54,5 @@
54
54
  "access": "public",
55
55
  "registry": "https://registry.npmjs.org/"
56
56
  },
57
- "acceptDependencies": {
58
- "@yeoman/adapter": "^2.0.0-beta.0",
59
- "mem-fs": "^4.0.0-beta.1",
60
- "mem-fs-editor": ">=10.0.2"
61
- },
62
- "gitHead": "c348c764066d1a6159ac9da52a7ab5a417904abb"
57
+ "gitHead": "470cd91302fc306da2e51656f187943c4d5edd03"
63
58
  }
@@ -67,13 +67,18 @@ export type BaseGeneratorMeta = {
67
67
  export type GeneratorMeta = BaseGeneratorMeta & {
68
68
  packageNamespace?: string;
69
69
  /** Import and find the Generator Class */
70
- importGenerator: () => Promise<GetGeneratorConstructor>;
70
+ importGenerator: <G extends BaseGenerator>() => Promise<
71
+ GetGeneratorConstructor<G> &
72
+ BaseGeneratorMeta & {
73
+ _meta?: GeneratorMeta;
74
+ }
75
+ >;
71
76
  /** Import the module `import(meta.resolved)` */
72
77
  importModule?: () => Promise<unknown>;
73
78
  /** Intantiate the Generator `env.instantiate(await meta.importGenerator())` */
74
- instantiate: (arguments_?: string[], options?: any) => Promise<BaseGenerator>;
79
+ instantiate: <G extends BaseGenerator>(arguments_?: string[], options?: any) => Promise<G>;
75
80
  /** Intantiate the Generator passing help option */
76
- instantiateHelp: () => Promise<BaseGenerator>;
81
+ instantiateHelp: <G extends BaseGenerator>() => Promise<G>;
77
82
  };
78
83
 
79
84
  export type InstantiateOptions<G extends BaseGenerator = BaseGenerator> = {
@@ -1,4 +1,5 @@
1
1
  import type { BaseEnvironment } from '../environment/environment.js';
2
+ import type { GeneratorMeta } from '../environment/methods-options.js';
2
3
  import type { GeneratorFeatures } from './generator-features.js';
3
4
  import type { GeneratorOptions } from './generator-options.js';
4
5
 
@@ -33,10 +34,12 @@ export type BaseGenerator<
33
34
 
34
35
  // Generator >= v5
35
36
  readonly features: F | undefined;
37
+
38
+ readonly _meta?: GeneratorMeta;
36
39
  };
37
40
 
38
- export type BaseGeneratorConstructor<
39
- O extends GeneratorOptions = GeneratorOptions,
40
- F extends GeneratorFeatures = GeneratorFeatures,
41
- > = (new (arguments_?: string[], options?: O, features?: F) => BaseGenerator<O, F>) &
42
- (new (options?: O, features?: F) => BaseGenerator<O, F>);
41
+ export type BaseGeneratorConstructor<O extends GeneratorOptions = GeneratorOptions, F extends GeneratorFeatures = GeneratorFeatures> = new (
42
+ arguments_?: string[],
43
+ options?: O,
44
+ features?: F,
45
+ ) => BaseGenerator<O, F>;
@@ -1,3 +1,4 @@
1
+ /* eslint-disable unicorn/prevent-abbreviations */
1
2
  import type { BaseGenerator, BaseGeneratorConstructor } from './generator.js';
2
3
 
3
4
  export type GetGeneratorOptions<T extends BaseGenerator = BaseGenerator> = T extends BaseGenerator<infer Options> ? Options : never;