tw-framework 1.0.2 → 1.0.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.
Files changed (2) hide show
  1. package/dist/tw.mjs +35 -8
  2. package/package.json +1 -1
package/dist/tw.mjs CHANGED
@@ -16445,6 +16445,15 @@ var init_types4 = __esm({
16445
16445
  }
16446
16446
  });
16447
16447
 
16448
+ // ../../packages/compiler/tw/codegen/version.ts
16449
+ var TW_VERSION, TW_GENERATOR_META;
16450
+ var init_version = __esm({
16451
+ "../../packages/compiler/tw/codegen/version.ts"() {
16452
+ TW_VERSION = "1.0.4";
16453
+ TW_GENERATOR_META = `<meta name="generator" content="TW Framework ${TW_VERSION}">`;
16454
+ }
16455
+ });
16456
+
16448
16457
  // ../../packages/image/tw/index.ts
16449
16458
  var tw_exports = {};
16450
16459
  __export(tw_exports, {
@@ -18166,6 +18175,9 @@ function generateHead(program, ctx) {
18166
18175
  if (!/name="viewport"/i.test(headChildren)) {
18167
18176
  parts.push(' <meta name="viewport" content="width=device-width, initial-scale=1.0">');
18168
18177
  }
18178
+ if (!/name="generator"/i.test(headChildren)) {
18179
+ parts.push(` ${TW_GENERATOR_META}`);
18180
+ }
18169
18181
  const description = getDirectiveValue(program, "description");
18170
18182
  if (description) {
18171
18183
  parts.push(` <meta name="description" content="${escapeHTML(description)}">`);
@@ -18711,6 +18723,7 @@ var VOID_TAGS5, BOOLEAN_ATTRS2, CSS_CHUNKS, CSS_ROUTE_CHUNKS, CSS_CAPTURE, activ
18711
18723
  var init_html2 = __esm({
18712
18724
  "../../packages/compiler/tw/codegen/html.ts"() {
18713
18725
  init_types4();
18726
+ init_version();
18714
18727
  init_builtin_components();
18715
18728
  init_eval();
18716
18729
  init_tss();
@@ -20079,6 +20092,7 @@ function emitHeadContent(gen, program, ctx) {
20079
20092
  gen.emit("head-content", `<title>${escapeHTML2(title)}</title>`, { critical: true });
20080
20093
  gen.emit("head-content", '<meta charset="UTF-8">', { critical: true });
20081
20094
  gen.emit("head-content", '<meta name="viewport" content="width=device-width, initial-scale=1.0">', { critical: true });
20095
+ gen.emit("head-content", TW_GENERATOR_META, { critical: true });
20082
20096
  if (ctx.inlineStyles.length > 0) {
20083
20097
  gen.emit("head-content", `<style>${ctx.inlineStyles.join("\n")}</style>`, { critical: true });
20084
20098
  }
@@ -20127,6 +20141,7 @@ function isTruthy3(val) {
20127
20141
  var BufferPool, bufferPool, StreamingHTMLGenerator;
20128
20142
  var init_streaming = __esm({
20129
20143
  "../../packages/compiler/tw/codegen/streaming.ts"() {
20144
+ init_version();
20130
20145
  BufferPool = class {
20131
20146
  pool = [];
20132
20147
  poolSize = 4;
@@ -53392,11 +53407,13 @@ async function devCommand() {
53392
53407
  const _fu = import.meta.url.replace("file://", "");
53393
53408
  const _srcDir = _fu.substring(0, _fu.lastIndexOf("/"));
53394
53409
  const _bd = globalThis.__TW_BUNDLE_DIR;
53395
- const runtimePath = _bd ? resolve5(_bd, "../../..", "packages/runtime/tw/client/hydration-runtime.js") : resolve5(_srcDir, "../../../..", "packages/runtime/tw/client/hydration-runtime.js");
53396
- if (existsSync15(runtimePath)) {
53397
- return new Response(readFileSync9(runtimePath, "utf-8"), {
53398
- headers: { "Content-Type": "application/javascript; charset=utf-8" }
53399
- });
53410
+ const runtimeCandidates = _bd ? [resolve5(_bd, "hydration-runtime.js"), resolve5(_srcDir, "../../../..", "packages/runtime/tw/client/hydration-runtime.js")] : [resolve5(_srcDir, "../../../..", "packages/runtime/tw/client/hydration-runtime.js")];
53411
+ for (const runtimePath of runtimeCandidates) {
53412
+ if (existsSync15(runtimePath)) {
53413
+ return new Response(readFileSync9(runtimePath, "utf-8"), {
53414
+ headers: { "Content-Type": "application/javascript; charset=utf-8" }
53415
+ });
53416
+ }
53400
53417
  }
53401
53418
  return new Response("// runtime not found", { status: 404 });
53402
53419
  }
@@ -53719,8 +53736,8 @@ async function serveCommand() {
53719
53736
  const envPath = join17(rootDir, ".env");
53720
53737
  if (existsSync18(envPath)) {
53721
53738
  try {
53722
- const { readFileSync: readFileSync15 } = await import("node:fs");
53723
- for (const line of readFileSync15(envPath, "utf-8").split("\n")) {
53739
+ const { readFileSync: readFileSync16 } = await import("node:fs");
53740
+ for (const line of readFileSync16(envPath, "utf-8").split("\n")) {
53724
53741
  const m = /^\s*([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)\s*$/.exec(line);
53725
53742
  if (m && !(m[1] in process.env)) {
53726
53743
  process.env[m[1]] = m[2].replace(/^["']|["']$/g, "");
@@ -54534,7 +54551,17 @@ var helpText = `
54534
54551
 
54535
54552
  // tw/commands/index.ts
54536
54553
  await init_build();
54537
- var VERSION = "1.0.0";
54554
+ import { readFileSync as readFileSync15 } from "node:fs";
54555
+ import { join as join26 } from "node:path";
54556
+ var VERSION = (() => {
54557
+ try {
54558
+ const bd = globalThis.__TW_BUNDLE_DIR;
54559
+ const pj = bd ? join26(bd, "..", "package.json") : new URL("../../package.json", import.meta.url).pathname;
54560
+ return JSON.parse(readFileSync15(pj, "utf-8")).version ?? "0.0.0";
54561
+ } catch {
54562
+ return "0.0.0";
54563
+ }
54564
+ })();
54538
54565
  var commands = {
54539
54566
  create: createCommand,
54540
54567
  dev: devCommand,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tw-framework",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Full-stack web framework \u2014 own template language (.tw), styling (.tss), compiler and VDOM; runs on Bun and Node",
5
5
  "type": "module",
6
6
  "main": "./dist/tw.mjs",