@vixt/core 0.1.5 → 0.1.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.
Files changed (2) hide show
  1. package/dist/index.mjs +10 -12
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -189,7 +189,7 @@ function generateMainTs(options, vixt) {
189
189
  fs.outputFileSync(path.resolve(rootDir, "src", "main.ts"), `// Generated by Vixt
190
190
  // This file transform from '${buildDir}/main.ts'
191
191
  `);
192
- const cssTemplate = options?.css?.map((css) => `import '${css}'`).join("\n");
192
+ const cssTemplate = options?.css?.map((css) => `import '${css}'`).join("\n") ?? "";
193
193
  let appComponentImportTempate = "";
194
194
  let appConfigsImportTemplate = "";
195
195
  let appConfigsMergeTemplate = "";
@@ -233,6 +233,7 @@ const defaults$1 = {
233
233
  rootId: "app",
234
234
  rootTag: "div",
235
235
  baseURL: "/",
236
+ css: [],
236
237
  head: {
237
238
  meta: [
238
239
  { charset: "utf-8" },
@@ -245,20 +246,18 @@ const app = defineVixtModule({
245
246
  meta: { name: name$2, configKey: "app" },
246
247
  defaults: defaults$1,
247
248
  setup(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
- `);
249
+ let indexHtmlCode;
250
+ let mainTsCode;
255
251
  return {
256
252
  name: name$2,
253
+ configResolved() {
254
+ indexHtmlCode = generateIndexHtml(options, vixt);
255
+ mainTsCode = generateMainTs(options, vixt);
256
+ },
257
257
  transformIndexHtml: {
258
258
  order: "pre",
259
259
  handler() {
260
- const code = generateIndexHtml(options, vixt);
261
- return code;
260
+ return indexHtmlCode;
262
261
  }
263
262
  },
264
263
  transform: {
@@ -266,8 +265,7 @@ const app = defineVixtModule({
266
265
  handler(_, id) {
267
266
  if (!id.includes("/src/main.ts"))
268
267
  return;
269
- const code = generateMainTs(options, vixt);
270
- return code;
268
+ return mainTsCode;
271
269
  }
272
270
  }
273
271
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vixt/core",
3
3
  "type": "module",
4
- "version": "0.1.5",
4
+ "version": "0.1.6",
5
5
  "author": "SoulLyoko<https://github.com/SoulLyoko>",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/SoulLyoko/vixt#readme",