@vixt/core 0.0.4 → 0.0.6

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.d.mts CHANGED
@@ -31,6 +31,10 @@ interface VixtModule<T extends ModuleOptions = ModuleOptions> {
31
31
  }
32
32
 
33
33
  interface VixtOptions extends Record<string, any> {
34
+ /**
35
+ * @default process.cwd()
36
+ */
37
+ rootDir?: string;
34
38
  /**
35
39
  * @default '.vixt'
36
40
  */
@@ -124,7 +128,7 @@ interface TypescriptOptions {
124
128
  })[];
125
129
  tsConfig?: TSConfig;
126
130
  /** https://github.com/fi3ework/vite-plugin-checker */
127
- typeCheck?: Parameters<typeof Checker>[0] | false;
131
+ typeCheck?: Parameters<typeof Checker>[0];
128
132
  }
129
133
  declare const typescript: VixtModule<TypescriptOptions>;
130
134
 
@@ -147,6 +151,7 @@ interface WarmupOptions {
147
151
  declare const warmup: VixtModule<WarmupOptions>;
148
152
 
149
153
  declare function defineVixtConfig(input: VixtOptions): VixtOptions;
154
+ declare const rootDir: string;
150
155
  declare const buildDir = ".vixt";
151
156
  declare const buildTypesDir = ".vixt/types";
152
157
  declare function loadVixtConfig(opts?: LoadConfigOptions<VixtOptions>): Promise<c12.ResolvedConfig<VixtOptions, c12.ConfigLayerMeta>>;
@@ -160,4 +165,4 @@ declare function applyLayerModules(layers?: VixtConfigLayer[]): Promise<VixtModu
160
165
  declare function loadVixt(opts?: LoadConfigOptions<VixtOptions>): Promise<Vixt>;
161
166
  declare function createVixtPlugin(loadOptions: LoadConfigOptions<VixtOptions>): (options?: VixtOptions | undefined) => vite.PluginOption;
162
167
 
163
- export { type AppHead, type AppOptions, type DevProxyOptions, type ModuleDefinition, type ModuleMeta, type ModuleOptions, type PluginOptions, type TypescriptOptions, type Vixt, type VixtConfigLayer, type VixtModule, type VixtOptions, type WarmupOptions, alias, app, applyLayerModules, buildDir, buildTypesDir, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule, devProxy, installModule, loadVixt, loadVixtConfig, resolveLayersDirs, transformProxy, typescript, warmup };
168
+ export { type AppHead, type AppOptions, type DevProxyOptions, type ModuleDefinition, type ModuleMeta, type ModuleOptions, type PluginOptions, type TypescriptOptions, type Vixt, type VixtConfigLayer, type VixtModule, type VixtOptions, type WarmupOptions, alias, app, applyLayerModules, buildDir, buildTypesDir, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule, devProxy, installModule, loadVixt, loadVixtConfig, resolveLayersDirs, rootDir, transformProxy, typescript, warmup };
package/dist/index.d.ts CHANGED
@@ -31,6 +31,10 @@ interface VixtModule<T extends ModuleOptions = ModuleOptions> {
31
31
  }
32
32
 
33
33
  interface VixtOptions extends Record<string, any> {
34
+ /**
35
+ * @default process.cwd()
36
+ */
37
+ rootDir?: string;
34
38
  /**
35
39
  * @default '.vixt'
36
40
  */
@@ -124,7 +128,7 @@ interface TypescriptOptions {
124
128
  })[];
125
129
  tsConfig?: TSConfig;
126
130
  /** https://github.com/fi3ework/vite-plugin-checker */
127
- typeCheck?: Parameters<typeof Checker>[0] | false;
131
+ typeCheck?: Parameters<typeof Checker>[0];
128
132
  }
129
133
  declare const typescript: VixtModule<TypescriptOptions>;
130
134
 
@@ -147,6 +151,7 @@ interface WarmupOptions {
147
151
  declare const warmup: VixtModule<WarmupOptions>;
148
152
 
149
153
  declare function defineVixtConfig(input: VixtOptions): VixtOptions;
154
+ declare const rootDir: string;
150
155
  declare const buildDir = ".vixt";
151
156
  declare const buildTypesDir = ".vixt/types";
152
157
  declare function loadVixtConfig(opts?: LoadConfigOptions<VixtOptions>): Promise<c12.ResolvedConfig<VixtOptions, c12.ConfigLayerMeta>>;
@@ -160,4 +165,4 @@ declare function applyLayerModules(layers?: VixtConfigLayer[]): Promise<VixtModu
160
165
  declare function loadVixt(opts?: LoadConfigOptions<VixtOptions>): Promise<Vixt>;
161
166
  declare function createVixtPlugin(loadOptions: LoadConfigOptions<VixtOptions>): (options?: VixtOptions | undefined) => vite.PluginOption;
162
167
 
163
- export { type AppHead, type AppOptions, type DevProxyOptions, type ModuleDefinition, type ModuleMeta, type ModuleOptions, type PluginOptions, type TypescriptOptions, type Vixt, type VixtConfigLayer, type VixtModule, type VixtOptions, type WarmupOptions, alias, app, applyLayerModules, buildDir, buildTypesDir, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule, devProxy, installModule, loadVixt, loadVixtConfig, resolveLayersDirs, transformProxy, typescript, warmup };
168
+ export { type AppHead, type AppOptions, type DevProxyOptions, type ModuleDefinition, type ModuleMeta, type ModuleOptions, type PluginOptions, type TypescriptOptions, type Vixt, type VixtConfigLayer, type VixtModule, type VixtOptions, type WarmupOptions, alias, app, applyLayerModules, buildDir, buildTypesDir, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule, devProxy, installModule, loadVixt, loadVixtConfig, resolveLayersDirs, rootDir, transformProxy, typescript, warmup };
package/dist/index.mjs CHANGED
@@ -10,11 +10,12 @@ import { loadConfig } from 'c12';
10
10
  const name$5 = "vixt:alias";
11
11
  const alias = defineVixtModule({
12
12
  meta: { name: name$5 },
13
- setup() {
13
+ setup(_, vixt) {
14
14
  return {
15
15
  name: name$5,
16
16
  config() {
17
17
  return {
18
+ root: vixt.options.rootDir,
18
19
  resolve: {
19
20
  alias: {
20
21
  "@": `${path.resolve(cwd(), "src")}`,
@@ -74,6 +75,7 @@ async function applyLayerModules(layers) {
74
75
  function defineVixtConfig(input) {
75
76
  return input;
76
77
  }
78
+ const rootDir = cwd();
77
79
  const buildDir = ".vixt";
78
80
  const buildTypesDir = `${buildDir}/types`;
79
81
  function loadVixtConfig(opts) {
@@ -81,6 +83,7 @@ function loadVixtConfig(opts) {
81
83
  name: "vixt",
82
84
  ...opts,
83
85
  defaults: {
86
+ rootDir,
84
87
  buildDir,
85
88
  buildTypesDir,
86
89
  ...opts?.defaults
@@ -106,14 +109,14 @@ function resolveHeadTag(tag, attrs) {
106
109
  const attrsStr = Object.entries(attrs).filter(([k]) => k !== "children").map(([k, v]) => `${k}="${v}"`).join(" ");
107
110
  return attrs?.children ? `<${tag} ${attrsStr}>${attrs.children}</${tag}>` : `<${tag} ${attrsStr} />`;
108
111
  }
109
- function generateIndexHtml(options, vixt, config) {
110
- const { buildDir: buildDir2 } = vixt.options;
112
+ function generateIndexHtml(options, vixt) {
113
+ const { buildDir: buildDir2, rootDir } = vixt.options;
111
114
  const { head = {}, rootTag, rootId, main, loadingTemplate: loading = "" } = options || {};
112
115
  const headTemplate = Object.entries(head).filter(([k]) => k !== "noscript").map(([tag, attrs]) => attrs.map((e) => resolveHeadTag(tag, e))).flat().join("\n");
113
116
  const noscriptTemplate = Object.entries(head).filter(([k]) => k === "noscript").map(([tag, attrs]) => attrs.map((e) => resolveHeadTag(tag, e))).flat().join("\n");
114
117
  let loadingTemplate = "";
115
118
  if (/^\.|\//.test(loading)) {
116
- const loadingTemplatePath = path.resolve(config.root, loading);
119
+ const loadingTemplatePath = path.resolve(rootDir, loading);
117
120
  if (fs.existsSync(loadingTemplatePath)) {
118
121
  loadingTemplate = fs.readFileSync(loadingTemplatePath, "utf-8");
119
122
  }
@@ -135,7 +138,7 @@ ${noscriptTemplate}
135
138
  </body>
136
139
  </html>
137
140
  `;
138
- fs.outputFileSync(path.resolve(config.root, `${buildDir2}/index.html`), code);
141
+ fs.outputFileSync(path.resolve(rootDir, `${buildDir2}/index.html`), code);
139
142
  return code;
140
143
  }
141
144
  const name$4 = "vixt:app";
@@ -156,11 +159,9 @@ const app = defineVixtModule({
156
159
  meta: { name: name$4, configKey: "app" },
157
160
  defaults: defaults$2,
158
161
  setup(options, vixt) {
162
+ generateIndexHtml(options, vixt);
159
163
  return {
160
164
  name: name$4,
161
- configResolved(config) {
162
- generateIndexHtml(options, vixt, config);
163
- },
164
165
  transformIndexHtml: {
165
166
  order: "pre",
166
167
  handler() {
@@ -303,7 +304,7 @@ const defaults$1 = {
303
304
  "./**/*"
304
305
  ]
305
306
  },
306
- typeCheck: { vueTsc: true, enableBuild: false, overlay: { initialIsOpen: false } }
307
+ typeCheck: { enableBuild: false, overlay: { initialIsOpen: false } }
307
308
  };
308
309
  const typescript = defineVixtModule({
309
310
  meta: { name: name$1, configKey: "typescript" },
@@ -319,7 +320,7 @@ const typescript = defineVixtModule({
319
320
  genarateShims(options, vixt, config);
320
321
  }
321
322
  },
322
- options.typeCheck && Checker(options.typeCheck)
323
+ Checker(options.typeCheck ?? {})
323
324
  ];
324
325
  }
325
326
  });
@@ -371,4 +372,4 @@ function createVixtPlugin(loadOptions) {
371
372
  });
372
373
  }
373
374
 
374
- export { alias, app, applyLayerModules, buildDir, buildTypesDir, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule, devProxy, installModule, loadVixt, loadVixtConfig, resolveLayersDirs, transformProxy, typescript, warmup };
375
+ export { alias, app, applyLayerModules, buildDir, buildTypesDir, config, createVixtPlugin, defineVitePlugin, defineVixtConfig, defineVixtModule, devProxy, installModule, loadVixt, loadVixtConfig, resolveLayersDirs, rootDir, transformProxy, typescript, warmup };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vixt/core",
3
3
  "type": "module",
4
- "version": "0.0.4",
4
+ "version": "0.0.6",
5
5
  "author": "SoulLyoko<https://github.com/SoulLyoko>",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/SoulLyoko/vixt#readme",
@@ -28,8 +28,8 @@
28
28
  "pkg-types": "^1.1.1",
29
29
  "tsx": "^4.16.0",
30
30
  "vite": "^5.3.2",
31
- "vite-plugin-checker": "^0.6.4",
32
- "vue-tsc": "^1.8.27"
31
+ "vite-plugin-checker": "^0.7.0",
32
+ "vue-tsc": "^2.0.24"
33
33
  },
34
34
  "scripts": {
35
35
  "build": "unbuild"