@kithinji/pod 1.0.50 → 1.0.51

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/dist/index.js CHANGED
@@ -3871,8 +3871,10 @@ function useMyPlugin(options) {
3871
3871
  }
3872
3872
  const node = options.graph[args.path];
3873
3873
  if (!node) {
3874
- console.log(`File node not found in depend graph: ${args.path}`);
3875
- throw new Error("900");
3874
+ console.log(JSON.stringify(options.graph, null, 2));
3875
+ throw new Error(
3876
+ `File node not found in depend graph: ${args.path}`
3877
+ );
3876
3878
  }
3877
3879
  return clientTransformer.process(node, metadata);
3878
3880
  }
@@ -3896,52 +3898,39 @@ function findProjectRoot(startPath) {
3896
3898
  }
3897
3899
  return process.cwd();
3898
3900
  }
3899
- function resolvePathAlias(importPath, projectRoot) {
3900
- if (importPath.startsWith("@/")) {
3901
- const possiblePaths = [
3902
- path7.join(projectRoot, "src", importPath.slice(2)),
3903
- path7.join(projectRoot, importPath.slice(2))
3904
- ];
3905
- for (const possiblePath of possiblePaths) {
3906
- const extensions = ["", ".ts", ".tsx", ".js", ".jsx"];
3907
- for (const ext of extensions) {
3908
- const fullPath = possiblePath + ext;
3909
- if (fs3.existsSync(fullPath) && fs3.statSync(fullPath).isFile()) {
3910
- return fullPath;
3911
- }
3912
- }
3913
- const indexFiles = ["/index.ts", "/index.tsx", "/index.js", "/index.jsx"];
3914
- for (const indexFile of indexFiles) {
3915
- const fullPath = possiblePath + indexFile;
3916
- if (fs3.existsSync(fullPath) && fs3.statSync(fullPath).isFile()) {
3917
- return fullPath;
3918
- }
3919
- }
3901
+ function tryResolveWithExtensions(basePath) {
3902
+ const extensions = [".ts", ".tsx", ".js", ".jsx"];
3903
+ for (const ext of ["", ...extensions]) {
3904
+ const fullPath = basePath + ext;
3905
+ if (fs3.existsSync(fullPath) && fs3.statSync(fullPath).isFile()) {
3906
+ return fullPath;
3907
+ }
3908
+ }
3909
+ for (const ext of extensions) {
3910
+ const indexPath = path7.join(basePath, `index${ext}`);
3911
+ if (fs3.existsSync(indexPath) && fs3.statSync(indexPath).isFile()) {
3912
+ return indexPath;
3920
3913
  }
3921
3914
  }
3922
3915
  return null;
3923
3916
  }
3924
3917
  function resolveFilePath(fromFile, importPath) {
3918
+ const projectRoot = findProjectRoot(fromFile);
3925
3919
  if (importPath.startsWith("@/")) {
3926
- const projectRoot = findProjectRoot(fromFile);
3927
- const aliasResolved = resolvePathAlias(importPath, projectRoot);
3928
- if (aliasResolved) return aliasResolved;
3929
- }
3930
- if (!importPath.startsWith(".")) return null;
3931
- const dir = path7.dirname(fromFile);
3932
- const basePath = path7.resolve(dir, importPath);
3933
- const extensions = ["", ".ts", ".tsx", ".js", ".jsx"];
3934
- for (const ext of extensions) {
3935
- const fullPath = basePath + ext;
3936
- if (fs3.existsSync(fullPath) && fs3.statSync(fullPath).isFile())
3937
- return fullPath;
3938
- }
3939
- const indexFiles = ["/index.ts", "/index.tsx", "/index.js", "/index.jsx"];
3940
- for (const indexFile of indexFiles) {
3941
- const fullPath = basePath + indexFile;
3942
- if (fs3.existsSync(fullPath) && fs3.statSync(fullPath).isFile())
3943
- return fullPath;
3944
- }
3920
+ const base = path7.join(projectRoot, "src", importPath.slice(2));
3921
+ return tryResolveWithExtensions(base);
3922
+ }
3923
+ if (importPath.startsWith(".")) {
3924
+ const dir = path7.dirname(fromFile);
3925
+ const base = path7.resolve(dir, importPath);
3926
+ return tryResolveWithExtensions(base);
3927
+ }
3928
+ const rootBased = path7.join(projectRoot, importPath);
3929
+ const resolvedRoot = tryResolveWithExtensions(rootBased);
3930
+ if (resolvedRoot) return resolvedRoot;
3931
+ const srcBased = path7.join(projectRoot, "src", importPath);
3932
+ const resolvedSrc = tryResolveWithExtensions(srcBased);
3933
+ if (resolvedSrc) return resolvedSrc;
3945
3934
  return null;
3946
3935
  }
3947
3936
  function extractDecorators(decorators) {
@@ -7538,7 +7527,7 @@ async function compileFiles(entryPoints) {
7538
7527
 
7539
7528
  // src/index.ts
7540
7529
  var program = new Command();
7541
- program.name("pod").description("Pod cli tool").version("1.0.48");
7530
+ program.name("pod").description("Pod cli tool").version("1.0.51");
7542
7531
  program.command("new <name> [type]").description("Start a new Orca Project").action(async (name, type) => {
7543
7532
  const orca = async () => {
7544
7533
  await addNew(name);