@knighted/css 1.1.0 → 1.2.0-rc.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.
@@ -14,6 +14,9 @@ interface ManifestEntry {
14
14
  hash: string;
15
15
  }
16
16
  type SelectorModuleManifest = Record<string, ManifestEntry>;
17
+ type SidecarManifest = Record<string, {
18
+ file: string;
19
+ }>;
17
20
  interface TsconfigResolutionContext {
18
21
  absoluteBaseUrl?: string;
19
22
  matchPath?: MatchPath;
@@ -21,13 +24,16 @@ interface TsconfigResolutionContext {
21
24
  interface SelectorModuleProxyInfo {
22
25
  moduleSpecifier: string;
23
26
  includeDefault: boolean;
27
+ exportedNames?: Set<string>;
24
28
  }
29
+ export type GenerateTypesMode = 'module' | 'declaration';
25
30
  type CssWithMetaFn = typeof cssWithMeta;
26
31
  export interface GenerateTypesResult {
27
32
  selectorModulesWritten: number;
28
33
  selectorModulesRemoved: number;
29
34
  warnings: string[];
30
35
  manifestPath: string;
36
+ sidecarManifestPath?: string;
31
37
  }
32
38
  export interface GenerateTypesOptions {
33
39
  rootDir?: string;
@@ -37,6 +43,8 @@ export interface GenerateTypesOptions {
37
43
  autoStable?: boolean;
38
44
  hashed?: boolean;
39
45
  resolver?: CssResolver;
46
+ mode?: GenerateTypesMode;
47
+ manifestPath?: string;
40
48
  }
41
49
  type ModuleTypeDetector = () => ReturnType<typeof moduleType>;
42
50
  declare function resolvePackageRoot(): string;
@@ -53,6 +61,11 @@ declare function extractSelectorSourceSpecifier(specifier: string): string | und
53
61
  declare function resolveImportPath(resourceSpecifier: string, importerPath: string, rootDir: string, tsconfig?: TsconfigResolutionContext, resolver?: CssResolver, resolverFactory?: ReturnType<typeof createResolverFactory>, resolutionExtensions?: string[]): Promise<string | undefined>;
54
62
  declare function buildSelectorModuleManifestKey(resolvedPath: string): string;
55
63
  declare function buildSelectorModulePath(resolvedPath: string): string;
64
+ declare function buildDeclarationModuleSpecifier(resolvedPath: string): string;
65
+ declare function buildDeclarationPath(resolvedPath: string): string;
66
+ declare function formatDeclarationSource(selectors: Map<string, string>, proxyInfo: SelectorModuleProxyInfo, options?: {
67
+ hashed?: boolean;
68
+ }): string;
56
69
  declare function formatSelectorModuleSource(selectors: Map<string, string>, proxyInfo?: SelectorModuleProxyInfo, options?: {
57
70
  hashed?: boolean;
58
71
  selectorSource?: string;
@@ -60,9 +73,11 @@ declare function formatSelectorModuleSource(selectors: Map<string, string>, prox
60
73
  }): string;
61
74
  declare function readManifest(manifestPath: string): Promise<SelectorModuleManifest>;
62
75
  declare function writeManifest(manifestPath: string, manifest: SelectorModuleManifest): Promise<void>;
76
+ declare function writeSidecarManifest(manifestPath: string, manifest: SidecarManifest): Promise<void>;
63
77
  declare function removeStaleSelectorModules(previous: SelectorModuleManifest, next: SelectorModuleManifest): Promise<number>;
64
78
  declare function relativeToRoot(filePath: string, rootDir: string): string;
65
79
  declare function ensureSelectorModule(resolvedPath: string, selectors: Map<string, string>, previousManifest: SelectorModuleManifest, nextManifest: SelectorModuleManifest, selectorSource: string, proxyInfo?: SelectorModuleProxyInfo, hashed?: boolean): Promise<boolean>;
80
+ declare function ensureDeclarationModule(resolvedPath: string, selectors: Map<string, string>, previousManifest: SelectorModuleManifest, nextManifest: SelectorModuleManifest, proxyInfo: SelectorModuleProxyInfo, hashed?: boolean): Promise<boolean>;
66
81
  declare function resolveWithTsconfigPaths(specifier: string, tsconfig?: TsconfigResolutionContext): Promise<string | undefined>;
67
82
  declare function resolveWithExtensionFallback(candidatePath: string): Promise<string | undefined>;
68
83
  declare function resolveIndexFallback(candidatePath: string): Promise<string | undefined>;
@@ -70,7 +85,15 @@ declare function loadTsconfigResolutionContext(rootDir: string, loader?: typeof
70
85
  declare function normalizeTsconfigPaths(paths: Record<string, string[] | string> | undefined): Record<string, string[]> | undefined;
71
86
  declare function isNonRelativeSpecifier(specifier: string): boolean;
72
87
  declare function isStyleResource(filePath: string): boolean;
88
+ declare function isCssModuleResource(filePath: string): boolean;
89
+ declare function hasStyleImports(filePath: string, options: {
90
+ rootDir: string;
91
+ tsconfig?: TsconfigResolutionContext;
92
+ resolver?: CssResolver;
93
+ resolverFactory?: ReturnType<typeof createResolverFactory>;
94
+ }): Promise<boolean>;
73
95
  declare function resolveProxyInfo(manifestKey: string, selectorSource: string, resolvedPath: string, cache: Map<string, SelectorModuleProxyInfo | null>): Promise<SelectorModuleProxyInfo | null>;
96
+ declare function resolveDeclarationProxyInfo(manifestKey: string, resolvedPath: string, cache: Map<string, SelectorModuleProxyInfo | null>): Promise<SelectorModuleProxyInfo | null>;
74
97
  declare function createProjectPeerResolver(rootDir: string): (name: string) => Promise<any>;
75
98
  declare function getProjectRequire(rootDir: string): ReturnType<typeof createRequire>;
76
99
  declare function loadResolverModule(specifier: string, rootDir: string): Promise<CssResolver>;
@@ -83,6 +106,8 @@ export interface ParsedCliArgs {
83
106
  autoStable?: boolean;
84
107
  hashed?: boolean;
85
108
  resolver?: string;
109
+ mode: GenerateTypesMode;
110
+ manifestPath?: string;
86
111
  help?: boolean;
87
112
  }
88
113
  declare function parseCliArgs(argv: string[]): ParsedCliArgs;
@@ -107,23 +132,31 @@ export declare const __generateTypesInternals: {
107
132
  setImportMetaUrlProvider: typeof setImportMetaUrlProvider;
108
133
  isNonRelativeSpecifier: typeof isNonRelativeSpecifier;
109
134
  isStyleResource: typeof isStyleResource;
135
+ isCssModuleResource: typeof isCssModuleResource;
110
136
  resolveProxyInfo: typeof resolveProxyInfo;
137
+ resolveDeclarationProxyInfo: typeof resolveDeclarationProxyInfo;
111
138
  resolveWithExtensionFallback: typeof resolveWithExtensionFallback;
112
139
  resolveIndexFallback: typeof resolveIndexFallback;
113
140
  createProjectPeerResolver: typeof createProjectPeerResolver;
114
141
  getProjectRequire: typeof getProjectRequire;
115
142
  loadTsconfigResolutionContext: typeof loadTsconfigResolutionContext;
116
143
  resolveWithTsconfigPaths: typeof resolveWithTsconfigPaths;
144
+ hasStyleImports: typeof hasStyleImports;
117
145
  loadResolverModule: typeof loadResolverModule;
118
146
  parseCliArgs: typeof parseCliArgs;
119
147
  printHelp: typeof printHelp;
120
148
  reportCliResult: typeof reportCliResult;
121
149
  buildSelectorModuleManifestKey: typeof buildSelectorModuleManifestKey;
122
150
  buildSelectorModulePath: typeof buildSelectorModulePath;
151
+ buildDeclarationModuleSpecifier: typeof buildDeclarationModuleSpecifier;
123
152
  formatSelectorModuleSource: typeof formatSelectorModuleSource;
153
+ buildDeclarationPath: typeof buildDeclarationPath;
154
+ formatDeclarationSource: typeof formatDeclarationSource;
155
+ ensureDeclarationModule: typeof ensureDeclarationModule;
124
156
  ensureSelectorModule: typeof ensureSelectorModule;
125
157
  removeStaleSelectorModules: typeof removeStaleSelectorModules;
126
158
  readManifest: typeof readManifest;
127
159
  writeManifest: typeof writeManifest;
160
+ writeSidecarManifest: typeof writeSidecarManifest;
128
161
  };
129
162
  export {};