@vixt/core 0.1.3 → 0.1.5

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.
@@ -1,7 +1,7 @@
1
1
  import { App, Plugin } from 'vue';
2
2
  import { Router, RouteRecord } from 'vue-router';
3
3
  import { Pinia } from 'pinia';
4
- import { f as VixtAppConfig } from '../shared/core.66c5bb58.mjs';
4
+ import { f as VixtAppConfig } from '../shared/core.accf0e85.mjs';
5
5
  import 'vite';
6
6
  import 'c12';
7
7
 
@@ -1,7 +1,7 @@
1
1
  import { App, Plugin } from 'vue';
2
2
  import { Router, RouteRecord } from 'vue-router';
3
3
  import { Pinia } from 'pinia';
4
- import { f as VixtAppConfig } from '../shared/core.66c5bb58.js';
4
+ import { f as VixtAppConfig } from '../shared/core.accf0e85.js';
5
5
  import 'vite';
6
6
  import 'c12';
7
7
 
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { V as VixtModule, M as ModuleOptions, a as Vixt, b as VixtOptions, c as VixtConfigLayer, d as ModuleDefinition } from './shared/core.66c5bb58.mjs';
2
- export { g as ModuleMeta, P as PluginOptions, f as VixtAppConfig, e as VixtConfigLayerMeta } from './shared/core.66c5bb58.mjs';
1
+ import { V as VixtModule, M as ModuleOptions, a as Vixt, b as VixtOptions, c as VixtConfigLayer, d as ModuleDefinition } from './shared/core.accf0e85.mjs';
2
+ export { g as ModuleMeta, P as PluginOptions, f as VixtAppConfig, e as VixtConfigLayerMeta } from './shared/core.accf0e85.mjs';
3
3
  import { TSConfig } from 'pkg-types';
4
4
  import Checker from 'vite-plugin-checker';
5
5
  import * as c12 from 'c12';
@@ -26,19 +26,17 @@ interface AppHead {
26
26
  interface AppOptions {
27
27
  head?: AppHead;
28
28
  /**
29
- * @default BASE_URL=/
29
+ * @default /
30
30
  */
31
31
  baseURL?: string;
32
32
  /**
33
- * @default '#app'
33
+ * @default 'app'
34
34
  */
35
35
  rootId?: string;
36
36
  /**
37
37
  * @default 'div'
38
38
  */
39
39
  rootTag?: string;
40
- /** content of main.ts */
41
- main?: string;
42
40
  /** transform main.ts */
43
41
  transformMain?: (code: string, vixt: Vixt) => string | undefined;
44
42
  css?: string[];
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { V as VixtModule, M as ModuleOptions, a as Vixt, b as VixtOptions, c as VixtConfigLayer, d as ModuleDefinition } from './shared/core.66c5bb58.js';
2
- export { g as ModuleMeta, P as PluginOptions, f as VixtAppConfig, e as VixtConfigLayerMeta } from './shared/core.66c5bb58.js';
1
+ import { V as VixtModule, M as ModuleOptions, a as Vixt, b as VixtOptions, c as VixtConfigLayer, d as ModuleDefinition } from './shared/core.accf0e85.js';
2
+ export { g as ModuleMeta, P as PluginOptions, f as VixtAppConfig, e as VixtConfigLayerMeta } from './shared/core.accf0e85.js';
3
3
  import { TSConfig } from 'pkg-types';
4
4
  import Checker from 'vite-plugin-checker';
5
5
  import * as c12 from 'c12';
@@ -26,19 +26,17 @@ interface AppHead {
26
26
  interface AppOptions {
27
27
  head?: AppHead;
28
28
  /**
29
- * @default BASE_URL=/
29
+ * @default /
30
30
  */
31
31
  baseURL?: string;
32
32
  /**
33
- * @default '#app'
33
+ * @default 'app'
34
34
  */
35
35
  rootId?: string;
36
36
  /**
37
37
  * @default 'div'
38
38
  */
39
39
  rootTag?: string;
40
- /** content of main.ts */
41
- main?: string;
42
40
  /** transform main.ts */
43
41
  transformMain?: (code: string, vixt: Vixt) => string | undefined;
44
42
  css?: string[];
package/dist/index.mjs CHANGED
@@ -111,6 +111,9 @@ function defineVixtModule(definition) {
111
111
  const configKey = module.meta?.configKey || module.meta?.name;
112
112
  const defaultOptions = typeof module.defaults === "function" ? module.defaults(vixt) : module.defaults;
113
113
  const resolvedOptions = defu(inlineOptions, configKey ? vixt.options[configKey] : {}, defaultOptions);
114
+ if (configKey) {
115
+ vixt.options[configKey] = resolvedOptions;
116
+ }
114
117
  return resolvedOptions;
115
118
  }
116
119
  function normalizedModule(inlineOptions, vixt) {
@@ -186,7 +189,7 @@ function generateMainTs(options, vixt) {
186
189
  fs.outputFileSync(path.resolve(rootDir, "src", "main.ts"), `// Generated by Vixt
187
190
  // This file transform from '${buildDir}/main.ts'
188
191
  `);
189
- const cssTemplate = options?.css?.map((css) => `import '${css}'`).reverse().join("\n");
192
+ const cssTemplate = options?.css?.map((css) => `import '${css}'`).join("\n");
190
193
  let appComponentImportTempate = "";
191
194
  let appConfigsImportTemplate = "";
192
195
  let appConfigsMergeTemplate = "";
@@ -242,22 +245,29 @@ const app = defineVixtModule({
242
245
  meta: { name: name$2, configKey: "app" },
243
246
  defaults: defaults$1,
244
247
  setup(options, vixt) {
245
- const indexHtmlCode = generateIndexHtml(options, vixt);
246
- const mainTsCode = generateMainTs(options, vixt);
248
+ const { buildDir, rootDir } = vixt.options;
249
+ fs.outputFileSync(path.resolve(rootDir, "index.html"), `<!-- Generated by Vixt -->
250
+ <!-- This file transform from '${buildDir}/index.html' -->
251
+ `);
252
+ fs.outputFileSync(path.resolve(rootDir, "src", "main.ts"), `// Generated by Vixt
253
+ // This file transform from '${buildDir}/main.ts'
254
+ `);
247
255
  return {
248
256
  name: name$2,
249
257
  transformIndexHtml: {
250
258
  order: "pre",
251
259
  handler() {
252
- return indexHtmlCode;
260
+ const code = generateIndexHtml(options, vixt);
261
+ return code;
253
262
  }
254
263
  },
255
264
  transform: {
256
265
  order: "pre",
257
- handler(code, id) {
266
+ handler(_, id) {
258
267
  if (!id.includes("/src/main.ts"))
259
268
  return;
260
- return mainTsCode;
269
+ const code = generateMainTs(options, vixt);
270
+ return code;
261
271
  }
262
272
  }
263
273
  };
@@ -351,7 +361,6 @@ interface ImportMetaEnv {
351
361
  }
352
362
  const name = "vixt:typescript";
353
363
  const defaults = {
354
- // references: ['types/vite-env.d.ts', 'types/shims.d.ts', 'types/global-components.d.ts'],
355
364
  tsConfig: {
356
365
  extends: "@vue/tsconfig/tsconfig.dom.json",
357
366
  compilerOptions: {
@@ -372,14 +381,14 @@ const typescript = defineVixtModule({
372
381
  meta: { name, configKey: "typescript" },
373
382
  defaults,
374
383
  setup(options, vixt) {
375
- generateTsConfig(options, vixt);
376
- generateVixtDts(options, vixt);
377
- genarateShims(options, vixt);
378
- genarateGlobalComponents(options, vixt);
379
384
  return [
380
385
  {
381
386
  name,
382
387
  configResolved(config) {
388
+ generateTsConfig(options, vixt);
389
+ generateVixtDts(options, vixt);
390
+ genarateShims(options, vixt);
391
+ genarateGlobalComponents(options, vixt);
383
392
  generateEnvDts(config.env, vixt);
384
393
  }
385
394
  },
@@ -30,17 +30,21 @@ interface VixtOptions extends Record<string, any> {
30
30
  */
31
31
  rootDir?: string;
32
32
  /**
33
- * @default '.vixt'
33
+ * @default '<rootDir>/.vixt'
34
34
  */
35
35
  buildDir?: string;
36
36
  /**
37
- * @default '.vixt/types'
37
+ * @default '<buildDir>/types'
38
38
  */
39
39
  buildTypesDir?: string;
40
40
  /**
41
- * @default '.vixt/layers'
41
+ * @default '<buildDir>/layers'
42
42
  */
43
43
  buildLayersDir?: string;
44
+ /**
45
+ * @default '<rootDir>/src'
46
+ */
47
+ srcDir?: string;
44
48
  /** modules */
45
49
  modules?: VixtModule[];
46
50
  /** use on configResolved */
@@ -30,17 +30,21 @@ interface VixtOptions extends Record<string, any> {
30
30
  */
31
31
  rootDir?: string;
32
32
  /**
33
- * @default '.vixt'
33
+ * @default '<rootDir>/.vixt'
34
34
  */
35
35
  buildDir?: string;
36
36
  /**
37
- * @default '.vixt/types'
37
+ * @default '<buildDir>/types'
38
38
  */
39
39
  buildTypesDir?: string;
40
40
  /**
41
- * @default '.vixt/layers'
41
+ * @default '<buildDir>/layers'
42
42
  */
43
43
  buildLayersDir?: string;
44
+ /**
45
+ * @default '<rootDir>/src'
46
+ */
47
+ srcDir?: string;
44
48
  /** modules */
45
49
  modules?: VixtModule[];
46
50
  /** use on configResolved */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vixt/core",
3
3
  "type": "module",
4
- "version": "0.1.3",
4
+ "version": "0.1.5",
5
5
  "author": "SoulLyoko<https://github.com/SoulLyoko>",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/SoulLyoko/vixt#readme",
@@ -31,7 +31,7 @@
31
31
  "pathe": "^1.1.2",
32
32
  "pkg-types": "^1.1.3",
33
33
  "tsx": "^4.16.2",
34
- "vite": "^5.3.3",
34
+ "vite": "^5.3.4",
35
35
  "vite-plugin-checker": "^0.7.1",
36
36
  "vue-tsc": "^2.0.26"
37
37
  },