@pandacss/config 0.0.0-dev-20230716135255 → 0.0.0-dev-20230718085443

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.
@@ -0,0 +1,21 @@
1
+ // src/resolve-ts-path-pattern.ts
2
+ var resolveTsPathPattern = (pathMappings, moduleSpecifier) => {
3
+ for (const mapping of pathMappings) {
4
+ const match = moduleSpecifier.match(mapping.pattern);
5
+ if (!match) {
6
+ continue;
7
+ }
8
+ for (const pathTemplate of mapping.paths) {
9
+ let starCount = 0;
10
+ const mappedId = pathTemplate.replace(/\*/g, () => {
11
+ const matchIndex = Math.min(++starCount, match.length - 1);
12
+ return match[matchIndex];
13
+ });
14
+ return mappedId;
15
+ }
16
+ }
17
+ };
18
+
19
+ export {
20
+ resolveTsPathPattern
21
+ };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,8 @@
1
+ import { P as PathMapping } from './ts-config-paths-d717c9e2.js';
2
+ export { c as convertTsPathsToRegexes } from './ts-config-paths-d717c9e2.js';
1
3
  import * as _pandacss_types from '@pandacss/types';
2
- import { Config, LoadConfigResult } from '@pandacss/types';
4
+ import { ConfigTsOptions, Config, LoadConfigResult } from '@pandacss/types';
5
+ import { TSConfig } from 'pkg-types';
3
6
  export { mergeConfigs } from './merge-config.mjs';
4
7
 
5
8
  declare function findConfigFile({ cwd, file }: {
@@ -7,15 +10,6 @@ declare function findConfigFile({ cwd, file }: {
7
10
  file?: string;
8
11
  }): string | void;
9
12
 
10
- type PathMapping = {
11
- pattern: RegExp;
12
- paths: string[];
13
- };
14
- /**
15
- * @see https://github.com/aleclarson/vite-tsconfig-paths/blob/e8f0acf7adfcfbf77edbe937f64b4e5d39557ad0/src/mappings.ts
16
- */
17
- declare function convertTsPathsToRegexes(paths: Record<string, string[]>, baseUrl: string): PathMapping[];
18
-
19
13
  type GetDepsOptions = {
20
14
  filename: string;
21
15
  ext: string;
@@ -24,12 +18,9 @@ type GetDepsOptions = {
24
18
  baseUrl: string | undefined;
25
19
  pathMappings: PathMapping[];
26
20
  foundModuleAliases: Map<string, string>;
21
+ compilerOptions?: TSConfig['compilerOptions'];
27
22
  };
28
- type GetConfigDependenciesTsOptions = {
29
- baseUrl?: string | undefined;
30
- pathMappings: PathMapping[];
31
- };
32
- declare function getConfigDependencies(filePath: string, tsOptions?: GetConfigDependenciesTsOptions): {
23
+ declare function getConfigDependencies(filePath: string, tsOptions?: ConfigTsOptions, compilerOptions?: TSConfig['compilerOptions']): {
33
24
  deps: Set<string>;
34
25
  aliases: Map<string, string>;
35
26
  };
@@ -55,4 +46,4 @@ declare function bundleConfigFile(options: ConfigFileOptions): Promise<{
55
46
  dependencies: string[];
56
47
  }>;
57
48
 
58
- export { GetConfigDependenciesTsOptions, GetDepsOptions, bundleConfigFile, convertTsPathsToRegexes, findConfigFile, getConfigDependencies, getResolvedConfig, loadConfigFile, resolveConfigFile };
49
+ export { GetDepsOptions, bundleConfigFile, findConfigFile, getConfigDependencies, getResolvedConfig, loadConfigFile, resolveConfigFile };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,8 @@
1
+ import { P as PathMapping } from './ts-config-paths-d717c9e2.js';
2
+ export { c as convertTsPathsToRegexes } from './ts-config-paths-d717c9e2.js';
1
3
  import * as _pandacss_types from '@pandacss/types';
2
- import { Config, LoadConfigResult } from '@pandacss/types';
4
+ import { ConfigTsOptions, Config, LoadConfigResult } from '@pandacss/types';
5
+ import { TSConfig } from 'pkg-types';
3
6
  export { mergeConfigs } from './merge-config.js';
4
7
 
5
8
  declare function findConfigFile({ cwd, file }: {
@@ -7,15 +10,6 @@ declare function findConfigFile({ cwd, file }: {
7
10
  file?: string;
8
11
  }): string | void;
9
12
 
10
- type PathMapping = {
11
- pattern: RegExp;
12
- paths: string[];
13
- };
14
- /**
15
- * @see https://github.com/aleclarson/vite-tsconfig-paths/blob/e8f0acf7adfcfbf77edbe937f64b4e5d39557ad0/src/mappings.ts
16
- */
17
- declare function convertTsPathsToRegexes(paths: Record<string, string[]>, baseUrl: string): PathMapping[];
18
-
19
13
  type GetDepsOptions = {
20
14
  filename: string;
21
15
  ext: string;
@@ -24,12 +18,9 @@ type GetDepsOptions = {
24
18
  baseUrl: string | undefined;
25
19
  pathMappings: PathMapping[];
26
20
  foundModuleAliases: Map<string, string>;
21
+ compilerOptions?: TSConfig['compilerOptions'];
27
22
  };
28
- type GetConfigDependenciesTsOptions = {
29
- baseUrl?: string | undefined;
30
- pathMappings: PathMapping[];
31
- };
32
- declare function getConfigDependencies(filePath: string, tsOptions?: GetConfigDependenciesTsOptions): {
23
+ declare function getConfigDependencies(filePath: string, tsOptions?: ConfigTsOptions, compilerOptions?: TSConfig['compilerOptions']): {
33
24
  deps: Set<string>;
34
25
  aliases: Map<string, string>;
35
26
  };
@@ -55,4 +46,4 @@ declare function bundleConfigFile(options: ConfigFileOptions): Promise<{
55
46
  dependencies: string[];
56
47
  }>;
57
48
 
58
- export { GetConfigDependenciesTsOptions, GetDepsOptions, bundleConfigFile, convertTsPathsToRegexes, findConfigFile, getConfigDependencies, getResolvedConfig, loadConfigFile, resolveConfigFile };
49
+ export { GetDepsOptions, bundleConfigFile, findConfigFile, getConfigDependencies, getResolvedConfig, loadConfigFile, resolveConfigFile };
package/dist/index.js CHANGED
@@ -74,6 +74,15 @@ function convertTsPathsToRegexes(paths, baseUrl) {
74
74
  }
75
75
  return resolved;
76
76
  }
77
+ function getPrefixLength(pattern) {
78
+ const prefixLength = pattern.indexOf("*");
79
+ return pattern.substr(0, prefixLength).length;
80
+ }
81
+ function escapeStringRegexp(string) {
82
+ return string.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/-/g, "\\x2d");
83
+ }
84
+
85
+ // src/resolve-ts-path-pattern.ts
77
86
  var resolveTsPathPattern = (pathMappings, moduleSpecifier) => {
78
87
  for (const mapping of pathMappings) {
79
88
  const match = moduleSpecifier.match(mapping.pattern);
@@ -90,13 +99,6 @@ var resolveTsPathPattern = (pathMappings, moduleSpecifier) => {
90
99
  }
91
100
  }
92
101
  };
93
- function getPrefixLength(pattern) {
94
- const prefixLength = pattern.indexOf("*");
95
- return pattern.substr(0, prefixLength).length;
96
- }
97
- function escapeStringRegexp(string) {
98
- return string.replace(/[|\\{}()[\]^$+?.]/g, "\\$&").replace(/-/g, "\\x2d");
99
- }
100
102
 
101
103
  // src/get-mod-deps.ts
102
104
  var import_typescript = __toESM(require("typescript"));
@@ -123,7 +125,7 @@ var importFromRegex = /import[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi;
123
125
  var requireRegex = /require\(['"`](.+)['"`]\)/gi;
124
126
  var exportRegex = /export[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi;
125
127
  function getDeps(opts, fromAlias) {
126
- const { filename, seen } = opts;
128
+ const { filename, seen, compilerOptions } = opts;
127
129
  const absoluteFile = resolveWithExtension(
128
130
  import_path3.default.resolve(opts.cwd, filename),
129
131
  jsExtensions.includes(opts.ext) ? jsResolutionOrder : tsResolutionOrder
@@ -160,7 +162,7 @@ function getDeps(opts, fromAlias) {
160
162
  getDeps(Object.assign({}, nextOpts, { filename: mod }));
161
163
  return;
162
164
  }
163
- const found = import_typescript.default.resolveModuleName(mod, absoluteFile, {}, import_typescript.default.sys).resolvedModule;
165
+ const found = import_typescript.default.resolveModuleName(mod, absoluteFile, compilerOptions ?? {}, import_typescript.default.sys).resolvedModule;
164
166
  if (found && found.extension === ".ts") {
165
167
  getDeps(Object.assign({}, nextOpts, { filename: found.resolvedFileName }));
166
168
  return;
@@ -173,7 +175,7 @@ function getDeps(opts, fromAlias) {
173
175
  getDeps(Object.assign({}, nextOpts, { filename: filename2 }), mod);
174
176
  });
175
177
  }
176
- function getConfigDependencies(filePath, tsOptions = { pathMappings: [] }) {
178
+ function getConfigDependencies(filePath, tsOptions = { pathMappings: [] }, compilerOptions) {
177
179
  if (filePath === null)
178
180
  return { deps: /* @__PURE__ */ new Set(), aliases: /* @__PURE__ */ new Map() };
179
181
  const foundModuleAliases = /* @__PURE__ */ new Map();
@@ -186,7 +188,8 @@ function getConfigDependencies(filePath, tsOptions = { pathMappings: [] }) {
186
188
  seen: deps,
187
189
  baseUrl: tsOptions.baseUrl,
188
190
  pathMappings: tsOptions.pathMappings ?? [],
189
- foundModuleAliases
191
+ foundModuleAliases,
192
+ compilerOptions
190
193
  });
191
194
  return { deps, aliases: foundModuleAliases };
192
195
  }
package/dist/index.mjs CHANGED
@@ -1,6 +1,9 @@
1
1
  import {
2
2
  mergeConfigs
3
3
  } from "./chunk-5FP5NJ64.mjs";
4
+ import {
5
+ resolveTsPathPattern
6
+ } from "./chunk-KG6DKI2S.mjs";
4
7
 
5
8
  // src/find-config.ts
6
9
  import findUp from "escalade/sync";
@@ -35,22 +38,6 @@ function convertTsPathsToRegexes(paths, baseUrl) {
35
38
  }
36
39
  return resolved;
37
40
  }
38
- var resolveTsPathPattern = (pathMappings, moduleSpecifier) => {
39
- for (const mapping of pathMappings) {
40
- const match = moduleSpecifier.match(mapping.pattern);
41
- if (!match) {
42
- continue;
43
- }
44
- for (const pathTemplate of mapping.paths) {
45
- let starCount = 0;
46
- const mappedId = pathTemplate.replace(/\*/g, () => {
47
- const matchIndex = Math.min(++starCount, match.length - 1);
48
- return match[matchIndex];
49
- });
50
- return mappedId;
51
- }
52
- }
53
- };
54
41
  function getPrefixLength(pattern) {
55
42
  const prefixLength = pattern.indexOf("*");
56
43
  return pattern.substr(0, prefixLength).length;
@@ -84,7 +71,7 @@ var importFromRegex = /import[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi;
84
71
  var requireRegex = /require\(['"`](.+)['"`]\)/gi;
85
72
  var exportRegex = /export[\s\S]*from[\s\S]*?['"](.{3,}?)['"]/gi;
86
73
  function getDeps(opts, fromAlias) {
87
- const { filename, seen } = opts;
74
+ const { filename, seen, compilerOptions } = opts;
88
75
  const absoluteFile = resolveWithExtension(
89
76
  path.resolve(opts.cwd, filename),
90
77
  jsExtensions.includes(opts.ext) ? jsResolutionOrder : tsResolutionOrder
@@ -121,7 +108,7 @@ function getDeps(opts, fromAlias) {
121
108
  getDeps(Object.assign({}, nextOpts, { filename: mod }));
122
109
  return;
123
110
  }
124
- const found = ts.resolveModuleName(mod, absoluteFile, {}, ts.sys).resolvedModule;
111
+ const found = ts.resolveModuleName(mod, absoluteFile, compilerOptions ?? {}, ts.sys).resolvedModule;
125
112
  if (found && found.extension === ".ts") {
126
113
  getDeps(Object.assign({}, nextOpts, { filename: found.resolvedFileName }));
127
114
  return;
@@ -134,7 +121,7 @@ function getDeps(opts, fromAlias) {
134
121
  getDeps(Object.assign({}, nextOpts, { filename: filename2 }), mod);
135
122
  });
136
123
  }
137
- function getConfigDependencies(filePath, tsOptions = { pathMappings: [] }) {
124
+ function getConfigDependencies(filePath, tsOptions = { pathMappings: [] }, compilerOptions) {
138
125
  if (filePath === null)
139
126
  return { deps: /* @__PURE__ */ new Set(), aliases: /* @__PURE__ */ new Map() };
140
127
  const foundModuleAliases = /* @__PURE__ */ new Map();
@@ -147,7 +134,8 @@ function getConfigDependencies(filePath, tsOptions = { pathMappings: [] }) {
147
134
  seen: deps,
148
135
  baseUrl: tsOptions.baseUrl,
149
136
  pathMappings: tsOptions.pathMappings ?? [],
150
- foundModuleAliases
137
+ foundModuleAliases,
138
+ compilerOptions
151
139
  });
152
140
  return { deps, aliases: foundModuleAliases };
153
141
  }
@@ -0,0 +1,8 @@
1
+ import { P as PathMapping } from './ts-config-paths-d717c9e2.js';
2
+
3
+ /**
4
+ * @see https://github.com/aleclarson/vite-tsconfig-paths/blob/e8f0acf7adfcfbf77edbe937f64b4e5d39557ad0/src/index.ts#LL231C57-L231C57
5
+ */
6
+ declare const resolveTsPathPattern: (pathMappings: PathMapping[], moduleSpecifier: string) => string | undefined;
7
+
8
+ export { resolveTsPathPattern };
@@ -0,0 +1,8 @@
1
+ import { P as PathMapping } from './ts-config-paths-d717c9e2.js';
2
+
3
+ /**
4
+ * @see https://github.com/aleclarson/vite-tsconfig-paths/blob/e8f0acf7adfcfbf77edbe937f64b4e5d39557ad0/src/index.ts#LL231C57-L231C57
5
+ */
6
+ declare const resolveTsPathPattern: (pathMappings: PathMapping[], moduleSpecifier: string) => string | undefined;
7
+
8
+ export { resolveTsPathPattern };
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/resolve-ts-path-pattern.ts
21
+ var resolve_ts_path_pattern_exports = {};
22
+ __export(resolve_ts_path_pattern_exports, {
23
+ resolveTsPathPattern: () => resolveTsPathPattern
24
+ });
25
+ module.exports = __toCommonJS(resolve_ts_path_pattern_exports);
26
+ var resolveTsPathPattern = (pathMappings, moduleSpecifier) => {
27
+ for (const mapping of pathMappings) {
28
+ const match = moduleSpecifier.match(mapping.pattern);
29
+ if (!match) {
30
+ continue;
31
+ }
32
+ for (const pathTemplate of mapping.paths) {
33
+ let starCount = 0;
34
+ const mappedId = pathTemplate.replace(/\*/g, () => {
35
+ const matchIndex = Math.min(++starCount, match.length - 1);
36
+ return match[matchIndex];
37
+ });
38
+ return mappedId;
39
+ }
40
+ }
41
+ };
42
+ // Annotate the CommonJS export names for ESM import in node:
43
+ 0 && (module.exports = {
44
+ resolveTsPathPattern
45
+ });
@@ -0,0 +1,6 @@
1
+ import {
2
+ resolveTsPathPattern
3
+ } from "./chunk-KG6DKI2S.mjs";
4
+ export {
5
+ resolveTsPathPattern
6
+ };
@@ -0,0 +1,10 @@
1
+ type PathMapping = {
2
+ pattern: RegExp;
3
+ paths: string[];
4
+ };
5
+ /**
6
+ * @see https://github.com/aleclarson/vite-tsconfig-paths/blob/e8f0acf7adfcfbf77edbe937f64b4e5d39557ad0/src/mappings.ts
7
+ */
8
+ declare function convertTsPathsToRegexes(paths: Record<string, string[]>, baseUrl: string): PathMapping[];
9
+
10
+ export { PathMapping as P, convertTsPathsToRegexes as c };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pandacss/config",
3
- "version": "0.0.0-dev-20230716135255",
3
+ "version": "0.0.0-dev-20230718085443",
4
4
  "description": "Find and load panda config",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -21,6 +21,11 @@
21
21
  "require": "./dist/merge-config.js",
22
22
  "import": "./dist/merge-config.mjs"
23
23
  },
24
+ "./ts-path": {
25
+ "types": "./dist/resolve-ts-path-pattern.d.ts",
26
+ "require": "./dist/resolve-ts-path-pattern.js",
27
+ "import": "./dist/resolve-ts-path-pattern.mjs"
28
+ },
24
29
  "./package.json": "./package.json"
25
30
  },
26
31
  "files": [
@@ -32,18 +37,18 @@
32
37
  "jiti": "^1.19.1",
33
38
  "merge-anything": "^5.1.7",
34
39
  "typescript": "^5.1.6",
35
- "@pandacss/error": "0.0.0-dev-20230716135255",
36
- "@pandacss/logger": "0.0.0-dev-20230716135255",
37
- "@pandacss/preset-base": "0.0.0-dev-20230716135255",
38
- "@pandacss/preset-panda": "0.0.0-dev-20230716135255",
39
- "@pandacss/types": "0.0.0-dev-20230716135255"
40
+ "@pandacss/error": "0.0.0-dev-20230718085443",
41
+ "@pandacss/logger": "0.0.0-dev-20230718085443",
42
+ "@pandacss/preset-base": "0.0.0-dev-20230718085443",
43
+ "@pandacss/preset-panda": "0.0.0-dev-20230718085443",
44
+ "@pandacss/types": "0.0.0-dev-20230718085443"
40
45
  },
41
46
  "devDependencies": {
42
47
  "pkg-types": "1.0.3"
43
48
  },
44
49
  "scripts": {
45
- "build": "pnpm tsup src/index.ts src/merge-config.ts --format=esm,cjs --shims --dts",
46
- "build-fast": "pnpm tsup src/index.ts src/merge-config.ts --format=esm,cjs --shims --no-dts",
50
+ "build": "pnpm tsup src/index.ts src/merge-config.ts src/resolve-ts-path-pattern.ts --format=esm,cjs --shims --dts",
51
+ "build-fast": "pnpm tsup src/index.ts src/merge-config.ts src/resolve-ts-path-pattern.ts --format=esm,cjs --shims --no-dts",
47
52
  "dev": "pnpm build-fast --watch"
48
53
  }
49
54
  }