@farm.js/core 0.1.14 → 0.1.15

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.
@@ -14322,9 +14322,10 @@ function collectIsolatedClientBoundaries(ownerPath, root, options = {}) {
14322
14322
  const importedBindings = getStaticImportBindings(content);
14323
14323
  let estimatedBoundaryCount2 = 0;
14324
14324
  for (const specifier of new Set(getImportSpecifiers(content))) {
14325
- const importedPath = resolveImportedModuleSourcePath(moduleSourcePath, specifier, root);
14325
+ const imported = resolveImportedModule(moduleSourcePath, specifier, root);
14326
+ const importedPath = imported.path;
14326
14327
  if (!importedPath) continue;
14327
- if (!specifier.startsWith(".") && !specifier.startsWith("/")) {
14328
+ if (!imported.local) {
14328
14329
  const packageMetadata = inspectPackageClientBoundary(importedPath, root, /* @__PURE__ */ new Set());
14329
14330
  if (packageMetadata.shouldHydrate) {
14330
14331
  if (options.staticPackageBoundaries) {
@@ -14392,8 +14393,8 @@ function inspectClientModuleMetadata(resolvedPath, root, visited, inspectIslandE
14392
14393
  let importsClientBoundary = false;
14393
14394
  let importedIslandStrategy = null;
14394
14395
  for (const specifier of getImportSpecifiers(content)) {
14395
- const importedPath = resolveImportedModuleSourcePath(resolvedPath, specifier, root);
14396
- const importedMetadata = !specifier.startsWith(".") && !specifier.startsWith("/") ? inspectPackageClientBoundary(importedPath, root, visited) : inspectClientModuleMetadata(importedPath, root, visited, false);
14396
+ const imported = resolveImportedModule(resolvedPath, specifier, root);
14397
+ const importedMetadata = imported.local ? inspectClientModuleMetadata(imported.path, root, visited, false) : inspectPackageClientBoundary(imported.path, root, visited);
14397
14398
  if (importedMetadata.isClientComponent || importedMetadata.shouldHydrate) {
14398
14399
  importsClientBoundary = true;
14399
14400
  if (importedIslandStrategy === null) {
@@ -14518,6 +14519,161 @@ function isTypeOnlyNamedClause(tokens, startIndex, endIndex) {
14518
14519
  }
14519
14520
  return true;
14520
14521
  }
14522
+ function resolveImportedModule(importerPath, specifier, root) {
14523
+ if (specifier.startsWith(".") || specifier.startsWith("/")) {
14524
+ return { path: resolveImportedModuleSourcePath(importerPath, specifier, root), local: true };
14525
+ }
14526
+ const aliased = resolveProjectAliasSourcePath(specifier, root);
14527
+ if (aliased !== void 0) return { path: aliased, local: true };
14528
+ return { path: resolvePackageModuleSourcePath(importerPath, specifier, root), local: false };
14529
+ }
14530
+ function resolveProjectAliasSourcePath(specifier, root) {
14531
+ if (!root) return void 0;
14532
+ const projectRoot = import_path5.default.resolve(root);
14533
+ let match;
14534
+ for (const alias of getProjectImportAliases(projectRoot)) {
14535
+ const captured = matchProjectImportAlias(alias, specifier);
14536
+ if (captured === null) continue;
14537
+ if (!match || alias.prefix.length > match.alias.prefix.length) match = { alias, captured };
14538
+ }
14539
+ if (!match) return void 0;
14540
+ return resolveSourceCandidate(
14541
+ match.alias.targets.map(
14542
+ (target) => import_path5.default.normalize(match.alias.wildcard ? target.replace("*", match.captured) : target)
14543
+ )
14544
+ );
14545
+ }
14546
+ function matchProjectImportAlias(alias, specifier) {
14547
+ if (!alias.wildcard) return specifier === alias.prefix ? "" : null;
14548
+ if (specifier.length < alias.prefix.length + alias.suffix.length || !specifier.startsWith(alias.prefix) || !specifier.endsWith(alias.suffix)) {
14549
+ return null;
14550
+ }
14551
+ return specifier.slice(alias.prefix.length, specifier.length - alias.suffix.length);
14552
+ }
14553
+ function getProjectImportAliases(projectRoot) {
14554
+ const stamp = PROJECT_ALIAS_FILES.map((file) => {
14555
+ try {
14556
+ return String(import_fs2.default.statSync(import_path5.default.join(projectRoot, file)).mtimeMs);
14557
+ } catch {
14558
+ return "-";
14559
+ }
14560
+ }).join(":");
14561
+ const cached = projectImportAliasCache.get(projectRoot);
14562
+ if (cached?.stamp === stamp) return cached.aliases;
14563
+ const aliases = [
14564
+ ...readTsconfigPathAliases(projectRoot),
14565
+ ...readPackageImportAliases(projectRoot)
14566
+ ];
14567
+ if (!aliases.some((alias) => alias.prefix === "@/")) {
14568
+ aliases.push({
14569
+ prefix: "@/",
14570
+ suffix: "",
14571
+ wildcard: true,
14572
+ targets: [import_path5.default.join(projectRoot, "src", "*")]
14573
+ });
14574
+ }
14575
+ projectImportAliasCache.set(projectRoot, { stamp, aliases });
14576
+ return aliases;
14577
+ }
14578
+ function readTsconfigPathAliases(projectRoot) {
14579
+ for (const name2 of ["tsconfig.json", "jsconfig.json"]) {
14580
+ const configPath = import_path5.default.join(projectRoot, name2);
14581
+ if (!import_fs2.default.existsSync(configPath)) continue;
14582
+ const resolved = readTsconfigPaths(configPath, /* @__PURE__ */ new Set());
14583
+ if (!resolved?.paths) return [];
14584
+ const base = resolved.baseUrl ?? resolved.pathsDirectory;
14585
+ return Object.entries(resolved.paths).flatMap(([pattern, targets]) => {
14586
+ if (!Array.isArray(targets)) return [];
14587
+ const wildcardIndex = pattern.indexOf("*");
14588
+ return [
14589
+ {
14590
+ prefix: wildcardIndex === -1 ? pattern : pattern.slice(0, wildcardIndex),
14591
+ suffix: wildcardIndex === -1 ? "" : pattern.slice(wildcardIndex + 1),
14592
+ wildcard: wildcardIndex !== -1,
14593
+ targets: targets.filter((target) => typeof target === "string").map((target) => import_path5.default.resolve(base, target))
14594
+ }
14595
+ ];
14596
+ });
14597
+ }
14598
+ return [];
14599
+ }
14600
+ function readTsconfigPaths(configPath, visited) {
14601
+ if (visited.has(configPath)) return null;
14602
+ visited.add(configPath);
14603
+ const config = readJsonWithComments(configPath);
14604
+ if (!config) return null;
14605
+ const directory = import_path5.default.dirname(configPath);
14606
+ const parents = (Array.isArray(config.extends) ? config.extends : [config.extends]).filter(
14607
+ (parent) => typeof parent === "string" && parent.startsWith(".")
14608
+ );
14609
+ let inherited = null;
14610
+ for (const parent of parents) {
14611
+ const parentPath = import_path5.default.resolve(
14612
+ directory,
14613
+ parent.endsWith(".json") ? parent : `${parent}.json`
14614
+ );
14615
+ inherited = readTsconfigPaths(parentPath, visited) ?? inherited;
14616
+ }
14617
+ const options = config.compilerOptions ?? {};
14618
+ const baseUrl = typeof options.baseUrl === "string" ? import_path5.default.resolve(directory, options.baseUrl) : inherited?.baseUrl;
14619
+ if (options.paths && typeof options.paths === "object") {
14620
+ return { paths: options.paths, pathsDirectory: directory, baseUrl };
14621
+ }
14622
+ return inherited ? { ...inherited, baseUrl } : { pathsDirectory: directory, baseUrl };
14623
+ }
14624
+ function readPackageImportAliases(projectRoot) {
14625
+ const imports = readPackageJson(import_path5.default.join(projectRoot, "package.json"))?.imports;
14626
+ if (!imports || typeof imports !== "object") return [];
14627
+ return Object.entries(imports).flatMap(([pattern, value]) => {
14628
+ const target = resolveConditionalExportTarget(value);
14629
+ if (!pattern.startsWith("#") || !target?.startsWith("./")) return [];
14630
+ const wildcardIndex = pattern.indexOf("*");
14631
+ return [
14632
+ {
14633
+ prefix: wildcardIndex === -1 ? pattern : pattern.slice(0, wildcardIndex),
14634
+ suffix: wildcardIndex === -1 ? "" : pattern.slice(wildcardIndex + 1),
14635
+ wildcard: wildcardIndex !== -1,
14636
+ targets: [import_path5.default.resolve(projectRoot, target)]
14637
+ }
14638
+ ];
14639
+ });
14640
+ }
14641
+ function readJsonWithComments(filePath) {
14642
+ let source;
14643
+ try {
14644
+ source = import_fs2.default.readFileSync(filePath, "utf8");
14645
+ } catch {
14646
+ return null;
14647
+ }
14648
+ let output = "";
14649
+ let inString = false;
14650
+ for (let index = 0; index < source.length; index++) {
14651
+ const char = source[index];
14652
+ if (inString) {
14653
+ output += char;
14654
+ if (char === "\\") output += source[++index] ?? "";
14655
+ else if (char === '"') inString = false;
14656
+ continue;
14657
+ }
14658
+ if (char === '"') {
14659
+ inString = true;
14660
+ output += char;
14661
+ } else if (char === "/" && source[index + 1] === "/") {
14662
+ while (index < source.length && source[index] !== "\n") index++;
14663
+ output += "\n";
14664
+ } else if (char === "/" && source[index + 1] === "*") {
14665
+ const end = source.indexOf("*/", index + 2);
14666
+ index = end === -1 ? source.length : end + 1;
14667
+ } else {
14668
+ output += char;
14669
+ }
14670
+ }
14671
+ try {
14672
+ return JSON.parse(output.replace(/,(\s*[}\]])/g, "$1"));
14673
+ } catch {
14674
+ return null;
14675
+ }
14676
+ }
14521
14677
  function resolveImportedModuleSourcePath(importerPath, specifier, root) {
14522
14678
  if (!specifier.startsWith(".") && !specifier.startsWith("/")) {
14523
14679
  return resolvePackageModuleSourcePath(importerPath, specifier, root);
@@ -14648,7 +14804,7 @@ function resolveSourceCandidate(candidates) {
14648
14804
  }
14649
14805
  return null;
14650
14806
  }
14651
- var import_fs2, import_path5, import_url3, FARM_ISOLATED_HYDRATION_MAX_BOUNDARIES, RESOLVABLE_SOURCE_EXTENSIONS, REGEXP_PREFIX_PUNCTUATION, REGEXP_PREFIX_KEYWORDS, PARSER_SENSITIVE_JSX_CONTAINERS;
14807
+ var import_fs2, import_path5, import_url3, FARM_ISOLATED_HYDRATION_MAX_BOUNDARIES, RESOLVABLE_SOURCE_EXTENSIONS, REGEXP_PREFIX_PUNCTUATION, REGEXP_PREFIX_KEYWORDS, PARSER_SENSITIVE_JSX_CONTAINERS, projectImportAliasCache, PROJECT_ALIAS_FILES;
14652
14808
  var init_client_component = __esm({
14653
14809
  "src/utils/client-component.ts"() {
14654
14810
  "use strict";
@@ -14754,6 +14910,16 @@ var init_client_component = __esm({
14754
14910
  __name(inspectPackageClientBoundary, "inspectPackageClientBoundary");
14755
14911
  __name(getImportSpecifiers, "getImportSpecifiers");
14756
14912
  __name(isTypeOnlyNamedClause, "isTypeOnlyNamedClause");
14913
+ __name(resolveImportedModule, "resolveImportedModule");
14914
+ projectImportAliasCache = /* @__PURE__ */ new Map();
14915
+ PROJECT_ALIAS_FILES = ["tsconfig.json", "jsconfig.json", "package.json"];
14916
+ __name(resolveProjectAliasSourcePath, "resolveProjectAliasSourcePath");
14917
+ __name(matchProjectImportAlias, "matchProjectImportAlias");
14918
+ __name(getProjectImportAliases, "getProjectImportAliases");
14919
+ __name(readTsconfigPathAliases, "readTsconfigPathAliases");
14920
+ __name(readTsconfigPaths, "readTsconfigPaths");
14921
+ __name(readPackageImportAliases, "readPackageImportAliases");
14922
+ __name(readJsonWithComments, "readJsonWithComments");
14757
14923
  __name(resolveImportedModuleSourcePath, "resolveImportedModuleSourcePath");
14758
14924
  __name(resolvePackageModuleSourcePath, "resolvePackageModuleSourcePath");
14759
14925
  __name(findPackageDirectory, "findPackageDirectory");
@@ -20221,7 +20387,7 @@ var init_server3 = __esm({
20221
20387
  var version;
20222
20388
  var init_package = __esm({
20223
20389
  "package.json"() {
20224
- version = "0.1.14";
20390
+ version = "0.1.15";
20225
20391
  }
20226
20392
  });
20227
20393
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  build
3
- } from "../chunk-U6CRU23N.mjs";
3
+ } from "../chunk-FBHGHMOA.mjs";
4
4
  import "../chunk-S3FNNQHR.mjs";
5
5
  import "../chunk-655RLQQL.mjs";
6
6
  import "../chunk-NJ47VORC.mjs";
@@ -16,7 +16,7 @@ import {
16
16
  import "../chunk-XZNTNMHT.mjs";
17
17
  import "../chunk-F5D4XEAS.mjs";
18
18
  import "../chunk-H77NVNJ2.mjs";
19
- import "../chunk-J2F5LFQ2.mjs";
19
+ import "../chunk-JRF3C33L.mjs";
20
20
  import "../chunk-27JNCYEK.mjs";
21
21
  import "../chunk-DHDVMXYK.mjs";
22
22
  import "../chunk-ZMSZZXOR.mjs";
@@ -83,7 +83,7 @@ import {
83
83
  } from "../chunk-KI3MESHB.mjs";
84
84
  import "../chunk-QVKYGNVM.mjs";
85
85
  import "../chunk-Z2RZJZIZ.mjs";
86
- import "../chunk-DNCKVMSV.mjs";
86
+ import "../chunk-UE75PB52.mjs";
87
87
  import "../chunk-54UPOYFS.mjs";
88
88
  import "../chunk-WNSDDRNU.mjs";
89
89
  import "../chunk-JPLUGGRV.mjs";
@@ -583,7 +583,7 @@ body {
583
583
  `;
584
584
 
585
585
  // package.json
586
- var version = "0.1.14";
586
+ var version = "0.1.15";
587
587
 
588
588
  // src/version.ts
589
589
  var FARM_VERSION = version;
@@ -7,7 +7,7 @@ import {
7
7
  } from "../chunk-XAXTTBUT.mjs";
8
8
  import {
9
9
  FARM_VERSION
10
- } from "../chunk-DNCKVMSV.mjs";
10
+ } from "../chunk-UE75PB52.mjs";
11
11
  import {
12
12
  __name
13
13
  } from "../chunk-LPEX4YW6.mjs";
@@ -57,7 +57,7 @@ function isTrue(value) {
57
57
  __name(isTrue, "isTrue");
58
58
 
59
59
  // package.json
60
- var version = "0.1.14";
60
+ var version = "0.1.15";
61
61
 
62
62
  // src/version.ts
63
63
  var FARM_VERSION = version;
@@ -3,7 +3,7 @@ import {
3
3
  } from "../chunk-BOYNDCZL.mjs";
4
4
  import {
5
5
  FARM_VERSION
6
- } from "../chunk-DNCKVMSV.mjs";
6
+ } from "../chunk-UE75PB52.mjs";
7
7
  import {
8
8
  __name
9
9
  } from "../chunk-LPEX4YW6.mjs";
package/dist/plugin.cjs CHANGED
@@ -19055,9 +19055,10 @@ function collectIsolatedClientBoundaries(ownerPath, root, options = {}) {
19055
19055
  const importedBindings = getStaticImportBindings(content);
19056
19056
  let estimatedBoundaryCount2 = 0;
19057
19057
  for (const specifier of new Set(getImportSpecifiers(content))) {
19058
- const importedPath = resolveImportedModuleSourcePath(moduleSourcePath, specifier, root);
19058
+ const imported = resolveImportedModule(moduleSourcePath, specifier, root);
19059
+ const importedPath = imported.path;
19059
19060
  if (!importedPath) continue;
19060
- if (!specifier.startsWith(".") && !specifier.startsWith("/")) {
19061
+ if (!imported.local) {
19061
19062
  const packageMetadata = inspectPackageClientBoundary(importedPath, root, /* @__PURE__ */ new Set());
19062
19063
  if (packageMetadata.shouldHydrate) {
19063
19064
  if (options.staticPackageBoundaries) {
@@ -19126,8 +19127,8 @@ function inspectClientModuleMetadata(resolvedPath, root, visited, inspectIslandE
19126
19127
  let importsClientBoundary = false;
19127
19128
  let importedIslandStrategy = null;
19128
19129
  for (const specifier of getImportSpecifiers(content)) {
19129
- const importedPath = resolveImportedModuleSourcePath(resolvedPath, specifier, root);
19130
- const importedMetadata = !specifier.startsWith(".") && !specifier.startsWith("/") ? inspectPackageClientBoundary(importedPath, root, visited) : inspectClientModuleMetadata(importedPath, root, visited, false);
19130
+ const imported = resolveImportedModule(resolvedPath, specifier, root);
19131
+ const importedMetadata = imported.local ? inspectClientModuleMetadata(imported.path, root, visited, false) : inspectPackageClientBoundary(imported.path, root, visited);
19131
19132
  if (importedMetadata.isClientComponent || importedMetadata.shouldHydrate) {
19132
19133
  importsClientBoundary = true;
19133
19134
  if (importedIslandStrategy === null) {
@@ -19256,6 +19257,171 @@ function isTypeOnlyNamedClause(tokens, startIndex, endIndex) {
19256
19257
  return true;
19257
19258
  }
19258
19259
  __name(isTypeOnlyNamedClause, "isTypeOnlyNamedClause");
19260
+ function resolveImportedModule(importerPath, specifier, root) {
19261
+ if (specifier.startsWith(".") || specifier.startsWith("/")) {
19262
+ return { path: resolveImportedModuleSourcePath(importerPath, specifier, root), local: true };
19263
+ }
19264
+ const aliased = resolveProjectAliasSourcePath(specifier, root);
19265
+ if (aliased !== void 0) return { path: aliased, local: true };
19266
+ return { path: resolvePackageModuleSourcePath(importerPath, specifier, root), local: false };
19267
+ }
19268
+ __name(resolveImportedModule, "resolveImportedModule");
19269
+ var projectImportAliasCache = /* @__PURE__ */ new Map();
19270
+ var PROJECT_ALIAS_FILES = ["tsconfig.json", "jsconfig.json", "package.json"];
19271
+ function resolveProjectAliasSourcePath(specifier, root) {
19272
+ if (!root) return void 0;
19273
+ const projectRoot = import_path4.default.resolve(root);
19274
+ let match;
19275
+ for (const alias of getProjectImportAliases(projectRoot)) {
19276
+ const captured = matchProjectImportAlias(alias, specifier);
19277
+ if (captured === null) continue;
19278
+ if (!match || alias.prefix.length > match.alias.prefix.length) match = { alias, captured };
19279
+ }
19280
+ if (!match) return void 0;
19281
+ return resolveSourceCandidate(
19282
+ match.alias.targets.map(
19283
+ (target) => import_path4.default.normalize(match.alias.wildcard ? target.replace("*", match.captured) : target)
19284
+ )
19285
+ );
19286
+ }
19287
+ __name(resolveProjectAliasSourcePath, "resolveProjectAliasSourcePath");
19288
+ function matchProjectImportAlias(alias, specifier) {
19289
+ if (!alias.wildcard) return specifier === alias.prefix ? "" : null;
19290
+ if (specifier.length < alias.prefix.length + alias.suffix.length || !specifier.startsWith(alias.prefix) || !specifier.endsWith(alias.suffix)) {
19291
+ return null;
19292
+ }
19293
+ return specifier.slice(alias.prefix.length, specifier.length - alias.suffix.length);
19294
+ }
19295
+ __name(matchProjectImportAlias, "matchProjectImportAlias");
19296
+ function getProjectImportAliases(projectRoot) {
19297
+ const stamp = PROJECT_ALIAS_FILES.map((file) => {
19298
+ try {
19299
+ return String(import_fs2.default.statSync(import_path4.default.join(projectRoot, file)).mtimeMs);
19300
+ } catch {
19301
+ return "-";
19302
+ }
19303
+ }).join(":");
19304
+ const cached = projectImportAliasCache.get(projectRoot);
19305
+ if (cached?.stamp === stamp) return cached.aliases;
19306
+ const aliases = [
19307
+ ...readTsconfigPathAliases(projectRoot),
19308
+ ...readPackageImportAliases(projectRoot)
19309
+ ];
19310
+ if (!aliases.some((alias) => alias.prefix === "@/")) {
19311
+ aliases.push({
19312
+ prefix: "@/",
19313
+ suffix: "",
19314
+ wildcard: true,
19315
+ targets: [import_path4.default.join(projectRoot, "src", "*")]
19316
+ });
19317
+ }
19318
+ projectImportAliasCache.set(projectRoot, { stamp, aliases });
19319
+ return aliases;
19320
+ }
19321
+ __name(getProjectImportAliases, "getProjectImportAliases");
19322
+ function readTsconfigPathAliases(projectRoot) {
19323
+ for (const name2 of ["tsconfig.json", "jsconfig.json"]) {
19324
+ const configPath = import_path4.default.join(projectRoot, name2);
19325
+ if (!import_fs2.default.existsSync(configPath)) continue;
19326
+ const resolved = readTsconfigPaths(configPath, /* @__PURE__ */ new Set());
19327
+ if (!resolved?.paths) return [];
19328
+ const base = resolved.baseUrl ?? resolved.pathsDirectory;
19329
+ return Object.entries(resolved.paths).flatMap(([pattern, targets]) => {
19330
+ if (!Array.isArray(targets)) return [];
19331
+ const wildcardIndex = pattern.indexOf("*");
19332
+ return [
19333
+ {
19334
+ prefix: wildcardIndex === -1 ? pattern : pattern.slice(0, wildcardIndex),
19335
+ suffix: wildcardIndex === -1 ? "" : pattern.slice(wildcardIndex + 1),
19336
+ wildcard: wildcardIndex !== -1,
19337
+ targets: targets.filter((target) => typeof target === "string").map((target) => import_path4.default.resolve(base, target))
19338
+ }
19339
+ ];
19340
+ });
19341
+ }
19342
+ return [];
19343
+ }
19344
+ __name(readTsconfigPathAliases, "readTsconfigPathAliases");
19345
+ function readTsconfigPaths(configPath, visited) {
19346
+ if (visited.has(configPath)) return null;
19347
+ visited.add(configPath);
19348
+ const config = readJsonWithComments(configPath);
19349
+ if (!config) return null;
19350
+ const directory = import_path4.default.dirname(configPath);
19351
+ const parents = (Array.isArray(config.extends) ? config.extends : [config.extends]).filter(
19352
+ (parent) => typeof parent === "string" && parent.startsWith(".")
19353
+ );
19354
+ let inherited = null;
19355
+ for (const parent of parents) {
19356
+ const parentPath = import_path4.default.resolve(
19357
+ directory,
19358
+ parent.endsWith(".json") ? parent : `${parent}.json`
19359
+ );
19360
+ inherited = readTsconfigPaths(parentPath, visited) ?? inherited;
19361
+ }
19362
+ const options = config.compilerOptions ?? {};
19363
+ const baseUrl = typeof options.baseUrl === "string" ? import_path4.default.resolve(directory, options.baseUrl) : inherited?.baseUrl;
19364
+ if (options.paths && typeof options.paths === "object") {
19365
+ return { paths: options.paths, pathsDirectory: directory, baseUrl };
19366
+ }
19367
+ return inherited ? { ...inherited, baseUrl } : { pathsDirectory: directory, baseUrl };
19368
+ }
19369
+ __name(readTsconfigPaths, "readTsconfigPaths");
19370
+ function readPackageImportAliases(projectRoot) {
19371
+ const imports = readPackageJson(import_path4.default.join(projectRoot, "package.json"))?.imports;
19372
+ if (!imports || typeof imports !== "object") return [];
19373
+ return Object.entries(imports).flatMap(([pattern, value]) => {
19374
+ const target = resolveConditionalExportTarget(value);
19375
+ if (!pattern.startsWith("#") || !target?.startsWith("./")) return [];
19376
+ const wildcardIndex = pattern.indexOf("*");
19377
+ return [
19378
+ {
19379
+ prefix: wildcardIndex === -1 ? pattern : pattern.slice(0, wildcardIndex),
19380
+ suffix: wildcardIndex === -1 ? "" : pattern.slice(wildcardIndex + 1),
19381
+ wildcard: wildcardIndex !== -1,
19382
+ targets: [import_path4.default.resolve(projectRoot, target)]
19383
+ }
19384
+ ];
19385
+ });
19386
+ }
19387
+ __name(readPackageImportAliases, "readPackageImportAliases");
19388
+ function readJsonWithComments(filePath) {
19389
+ let source;
19390
+ try {
19391
+ source = import_fs2.default.readFileSync(filePath, "utf8");
19392
+ } catch {
19393
+ return null;
19394
+ }
19395
+ let output = "";
19396
+ let inString = false;
19397
+ for (let index = 0; index < source.length; index++) {
19398
+ const char = source[index];
19399
+ if (inString) {
19400
+ output += char;
19401
+ if (char === "\\") output += source[++index] ?? "";
19402
+ else if (char === '"') inString = false;
19403
+ continue;
19404
+ }
19405
+ if (char === '"') {
19406
+ inString = true;
19407
+ output += char;
19408
+ } else if (char === "/" && source[index + 1] === "/") {
19409
+ while (index < source.length && source[index] !== "\n") index++;
19410
+ output += "\n";
19411
+ } else if (char === "/" && source[index + 1] === "*") {
19412
+ const end = source.indexOf("*/", index + 2);
19413
+ index = end === -1 ? source.length : end + 1;
19414
+ } else {
19415
+ output += char;
19416
+ }
19417
+ }
19418
+ try {
19419
+ return JSON.parse(output.replace(/,(\s*[}\]])/g, "$1"));
19420
+ } catch {
19421
+ return null;
19422
+ }
19423
+ }
19424
+ __name(readJsonWithComments, "readJsonWithComments");
19259
19425
  function resolveImportedModuleSourcePath(importerPath, specifier, root) {
19260
19426
  if (!specifier.startsWith(".") && !specifier.startsWith("/")) {
19261
19427
  return resolvePackageModuleSourcePath(importerPath, specifier, root);
@@ -24708,7 +24874,7 @@ _setFarmThemeServerSnapshotResolver(() => {
24708
24874
  });
24709
24875
 
24710
24876
  // package.json
24711
- var version = "0.1.14";
24877
+ var version = "0.1.15";
24712
24878
 
24713
24879
  // src/version.ts
24714
24880
  var FARM_VERSION = version;
package/dist/plugin.mjs CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  PluginManager,
5
5
  definePlugin,
6
6
  farmPlugin
7
- } from "./chunk-J2F5LFQ2.mjs";
7
+ } from "./chunk-JRF3C33L.mjs";
8
8
  import "./chunk-27JNCYEK.mjs";
9
9
  import "./chunk-DHDVMXYK.mjs";
10
10
  import "./chunk-ZMSZZXOR.mjs";
@@ -69,7 +69,7 @@ import "./chunk-YMCXWPWK.mjs";
69
69
  import "./chunk-KI3MESHB.mjs";
70
70
  import "./chunk-QVKYGNVM.mjs";
71
71
  import "./chunk-Z2RZJZIZ.mjs";
72
- import "./chunk-DNCKVMSV.mjs";
72
+ import "./chunk-UE75PB52.mjs";
73
73
  import "./chunk-54UPOYFS.mjs";
74
74
  import "./chunk-WNSDDRNU.mjs";
75
75
  import "./chunk-JPLUGGRV.mjs";