@marko/language-tools 2.1.2 → 2.1.4

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
@@ -3075,31 +3075,35 @@ function getMeta(dir) {
3075
3075
  }
3076
3076
  return defaultMeta;
3077
3077
  }
3078
+ if (defaultMeta) {
3079
+ try {
3080
+ return loadMeta(dir);
3081
+ } catch {
3082
+ metaByDir.set(dir, defaultMeta);
3083
+ return defaultMeta;
3084
+ }
3085
+ }
3086
+ return loadMeta(dir);
3087
+ }
3088
+ function loadMeta(dir) {
3078
3089
  let cached = metaByDir.get(dir);
3079
3090
  if (!cached) {
3080
- try {
3081
- const require2 = (0, import_module.createRequire)(dir);
3082
- const configPath = require2.resolve("@marko/compiler/config");
3083
- cached = metaByCompiler.get(configPath);
3084
- if (!cached) {
3085
- const compiler = require2(import_path2.default.join(
3086
- configPath,
3087
- ".."
3088
- ));
3089
- const config = interopDefault(require2(configPath));
3090
- cached = {
3091
- compiler,
3092
- config: {
3093
- ...config,
3094
- cache: /* @__PURE__ */ new Map(),
3095
- translator: require2(config.translator)
3096
- }
3097
- };
3098
- compiler.configure(cached.config);
3099
- metaByCompiler.set(configPath, cached);
3100
- }
3101
- } catch (err) {
3102
- cached = getMeta();
3091
+ const require2 = (0, import_module.createRequire)(import_path2.default.join(dir, "_.js"));
3092
+ const configPath = require2.resolve("@marko/compiler/config");
3093
+ cached = metaByCompiler.get(configPath);
3094
+ if (!cached) {
3095
+ const compiler = require2(import_path2.default.dirname(configPath));
3096
+ const config = interopDefault(require2(configPath));
3097
+ cached = {
3098
+ compiler,
3099
+ config: {
3100
+ ...config,
3101
+ cache: /* @__PURE__ */ new Map(),
3102
+ translator: require2(config.translator)
3103
+ }
3104
+ };
3105
+ compiler.configure(cached.config);
3106
+ metaByCompiler.set(configPath, cached);
3103
3107
  }
3104
3108
  metaByDir.set(dir, cached);
3105
3109
  }
package/dist/index.mjs CHANGED
@@ -3043,31 +3043,35 @@ function getMeta(dir) {
3043
3043
  }
3044
3044
  return defaultMeta;
3045
3045
  }
3046
+ if (defaultMeta) {
3047
+ try {
3048
+ return loadMeta(dir);
3049
+ } catch {
3050
+ metaByDir.set(dir, defaultMeta);
3051
+ return defaultMeta;
3052
+ }
3053
+ }
3054
+ return loadMeta(dir);
3055
+ }
3056
+ function loadMeta(dir) {
3046
3057
  let cached = metaByDir.get(dir);
3047
3058
  if (!cached) {
3048
- try {
3049
- const require2 = createRequire(dir);
3050
- const configPath = require2.resolve("@marko/compiler/config");
3051
- cached = metaByCompiler.get(configPath);
3052
- if (!cached) {
3053
- const compiler = require2(path2.join(
3054
- configPath,
3055
- ".."
3056
- ));
3057
- const config = interopDefault(require2(configPath));
3058
- cached = {
3059
- compiler,
3060
- config: {
3061
- ...config,
3062
- cache: /* @__PURE__ */ new Map(),
3063
- translator: require2(config.translator)
3064
- }
3065
- };
3066
- compiler.configure(cached.config);
3067
- metaByCompiler.set(configPath, cached);
3068
- }
3069
- } catch (err) {
3070
- cached = getMeta();
3059
+ const require2 = createRequire(path2.join(dir, "_.js"));
3060
+ const configPath = require2.resolve("@marko/compiler/config");
3061
+ cached = metaByCompiler.get(configPath);
3062
+ if (!cached) {
3063
+ const compiler = require2(path2.dirname(configPath));
3064
+ const config = interopDefault(require2(configPath));
3065
+ cached = {
3066
+ compiler,
3067
+ config: {
3068
+ ...config,
3069
+ cache: /* @__PURE__ */ new Map(),
3070
+ translator: require2(config.translator)
3071
+ }
3072
+ };
3073
+ compiler.configure(cached.config);
3074
+ metaByCompiler.set(configPath, cached);
3071
3075
  }
3072
3076
  metaByDir.set(dir, cached);
3073
3077
  }
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type TS from "typescript/lib/tsserverlibrary";
3
2
  import type { TaglibLookup } from "@marko/babel-utils";
4
3
  import type * as Compiler from "@marko/compiler";
@@ -23,43 +22,7 @@ interface TypeLibs {
23
22
  declare const defaultTypeLibs: Partial<TypeLibs>;
24
23
  export declare function getCompiler(dir?: string): typeof Compiler;
25
24
  export declare function getCache(dir?: string): Map<any, any>;
26
- export declare function getConfig(dir?: string): Omit<{
27
- output?: "source" | "html" | "dom" | "hydrate" | "migrate" | undefined;
28
- errorRecovery?: boolean | undefined;
29
- applyFixes?: Map<number, unknown> | undefined;
30
- stripTypes?: boolean | undefined;
31
- runtimeId?: string | null | undefined;
32
- ast?: boolean | undefined;
33
- code?: boolean | undefined;
34
- writeVersionComment?: boolean | undefined;
35
- ignoreUnrecognizedTags?: boolean | undefined;
36
- sourceMaps?: boolean | "inline" | "both" | undefined;
37
- translator?: any;
38
- fileSystem?: typeof import("fs") | undefined;
39
- modules?: "esm" | "cjs" | undefined;
40
- resolveVirtualDependency?: ((filename: string, dep: {
41
- virtualPath: string;
42
- code: string;
43
- map?: any;
44
- }) => string) | null | undefined;
45
- hydrateIncludeImports?: RegExp | ((request: string) => boolean) | undefined;
46
- optimize?: boolean | undefined;
47
- cache?: Map<unknown, unknown> | undefined;
48
- hot?: boolean | undefined;
49
- meta?: boolean | undefined;
50
- babelConfig?: {
51
- [x: string]: unknown;
52
- ast?: boolean | null | undefined;
53
- code?: boolean | null | undefined;
54
- comments?: boolean | null | undefined;
55
- compact?: boolean | "auto" | null | undefined;
56
- caller?: {
57
- [x: string]: unknown;
58
- name?: string | undefined;
59
- } | undefined;
60
- minified?: boolean | null | undefined;
61
- } | undefined;
62
- }, "cache" | "translator"> & {
25
+ export declare function getConfig(dir?: string): Omit<Compiler.Config, "cache" | "translator"> & {
63
26
  cache: Map<any, any>;
64
27
  translator: {
65
28
  [x: string]: unknown;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@marko/language-tools",
3
3
  "description": "Marko Language Tools",
4
- "version": "2.1.2",
4
+ "version": "2.1.4",
5
5
  "bugs": "https://github.com/marko-js/language-server/issues/new?template=Bug_report.md",
6
6
  "peerDependencies": {
7
7
  "@marko/compiler": "^5.28.4"
@@ -14,11 +14,11 @@
14
14
  },
15
15
  "devDependencies": {
16
16
  "@babel/code-frame": "^7.22.5",
17
- "@marko/compiler": "^5.31.1",
17
+ "@marko/compiler": "^5.31.2",
18
18
  "@marko/translator-default": "^5.29.2",
19
19
  "@types/babel__code-frame": "^7.0.3",
20
20
  "@types/babel__helper-validator-identifier": "^7.15.0",
21
- "@typescript/vfs": "^1.4.0",
21
+ "@typescript/vfs": "^1.5.0",
22
22
  "marko": "^5.29.2",
23
23
  "mitata": "^0.1.6",
24
24
  "tsx": "^3.12.7"