sommark 5.0.1 → 5.0.2

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.
@@ -18,7 +18,7 @@ export function registerHostSettings(settings) {
18
18
  hostSettings = settings || {};
19
19
  }
20
20
 
21
- const version = "5.0.1";
21
+ const version = "5.0.2";
22
22
 
23
23
  const SomMark = {
24
24
  version,
package/core/lexer.js CHANGED
@@ -347,7 +347,12 @@ function lexer(src, filename = "anonymous") {
347
347
  if (char === "$" && next === "{") {
348
348
  {
349
349
  const hasExplicitKeyword = last_non_junk_type === TOKEN_TYPES.STATIC_KEYWORD || last_non_junk_type === TOKEN_TYPES.RUNTIME_KEYWORD;
350
- if (!hasExplicitKeyword) addToken(TOKEN_TYPES.STATIC_KEYWORD, "static");
350
+ if (!hasExplicitKeyword) {
351
+ // Zero-width: synthetic token has no source presence, must not shift position
352
+ tokens.push({ type: TOKEN_TYPES.STATIC_KEYWORD, value: "static", source: filename, range: { start: { line, character }, end: { line, character } } });
353
+ prev_type = TOKEN_TYPES.STATIC_KEYWORD;
354
+ last_non_junk_type = TOKEN_TYPES.STATIC_KEYWORD;
355
+ }
351
356
  addToken(TOKEN_TYPES.LOGIC_OPEN, "${");
352
357
  i += 2;
353
358
 
@@ -220,6 +220,7 @@ async function generateOutput(ast, i, format, mapper_file, security = {}, parent
220
220
 
221
221
  // smark-raw block — body collected verbatim by lexer, bypasses normal body processing pipeline
222
222
  if (node.type === BLOCK && (node.props?.["smark-raw"] === "true" || node.props?.["smark-raw"] === true)) {
223
+ if (generateRuntimeOutput) return "";
223
224
  const rawContent = node.body?.map(n => String(n.text || "")).join("") || "";
224
225
  const { "smark-raw": _, ...cleanArgs } = node.props;
225
226
  const transpiledArgs = await transpileArgs(cleanArgs);
@@ -802,7 +802,12 @@ function lexer(src, filename = "anonymous") {
802
802
  if (char === "$" && next === "{") {
803
803
  {
804
804
  const hasExplicitKeyword = last_non_junk_type === TOKEN_TYPES.STATIC_KEYWORD || last_non_junk_type === TOKEN_TYPES.RUNTIME_KEYWORD;
805
- if (!hasExplicitKeyword) addToken(TOKEN_TYPES.STATIC_KEYWORD, "static");
805
+ if (!hasExplicitKeyword) {
806
+ // Zero-width: synthetic token has no source presence, must not shift position
807
+ tokens.push({ type: TOKEN_TYPES.STATIC_KEYWORD, value: "static", source: filename, range: { start: { line, character }, end: { line, character } } });
808
+ TOKEN_TYPES.STATIC_KEYWORD;
809
+ last_non_junk_type = TOKEN_TYPES.STATIC_KEYWORD;
810
+ }
806
811
  addToken(TOKEN_TYPES.LOGIC_OPEN, "${");
807
812
  i += 2;
808
813
 
@@ -8587,7 +8592,7 @@ function registerHostSettings(settings) {
8587
8592
  hostSettings = settings || {};
8588
8593
  }
8589
8594
 
8590
- const version = "5.0.1";
8595
+ const version = "5.0.2";
8591
8596
 
8592
8597
  const SomMark$1 = {
8593
8598
  version,
@@ -10153,6 +10158,7 @@ async function generateOutput(ast, i, format, mapper_file, security = {}, parent
10153
10158
 
10154
10159
  // smark-raw block — body collected verbatim by lexer, bypasses normal body processing pipeline
10155
10160
  if (node.type === BLOCK && (node.props?.["smark-raw"] === "true" || node.props?.["smark-raw"] === true)) {
10161
+ if (generateRuntimeOutput) return "";
10156
10162
  const rawContent = node.body?.map(n => String(n.text || "")).join("") || "";
10157
10163
  const { "smark-raw": _, ...cleanArgs } = node.props;
10158
10164
  const transpiledArgs = await transpileArgs(cleanArgs);
@@ -802,7 +802,12 @@ function lexer(src, filename = "anonymous") {
802
802
  if (char === "$" && next === "{") {
803
803
  {
804
804
  const hasExplicitKeyword = last_non_junk_type === TOKEN_TYPES.STATIC_KEYWORD || last_non_junk_type === TOKEN_TYPES.RUNTIME_KEYWORD;
805
- if (!hasExplicitKeyword) addToken(TOKEN_TYPES.STATIC_KEYWORD, "static");
805
+ if (!hasExplicitKeyword) {
806
+ // Zero-width: synthetic token has no source presence, must not shift position
807
+ tokens.push({ type: TOKEN_TYPES.STATIC_KEYWORD, value: "static", source: filename, range: { start: { line, character }, end: { line, character } } });
808
+ TOKEN_TYPES.STATIC_KEYWORD;
809
+ last_non_junk_type = TOKEN_TYPES.STATIC_KEYWORD;
810
+ }
806
811
  addToken(TOKEN_TYPES.LOGIC_OPEN, "${");
807
812
  i += 2;
808
813
 
@@ -9062,6 +9067,7 @@ async function generateOutput(ast, i, format, mapper_file, security = {}, parent
9062
9067
 
9063
9068
  // smark-raw block — body collected verbatim by lexer, bypasses normal body processing pipeline
9064
9069
  if (node.type === BLOCK && (node.props?.["smark-raw"] === "true" || node.props?.["smark-raw"] === true)) {
9070
+ if (generateRuntimeOutput) return "";
9065
9071
  const rawContent = node.body?.map(n => String(n.text || "")).join("") || "";
9066
9072
  const { "smark-raw": _, ...cleanArgs } = node.props;
9067
9073
  const transpiledArgs = await transpileArgs(cleanArgs);
@@ -452,7 +452,12 @@ function lexer(src, filename = "anonymous") {
452
452
  if (char === "$" && next === "{") {
453
453
  {
454
454
  const hasExplicitKeyword = last_non_junk_type === TOKEN_TYPES.STATIC_KEYWORD || last_non_junk_type === TOKEN_TYPES.RUNTIME_KEYWORD;
455
- if (!hasExplicitKeyword) addToken(TOKEN_TYPES.STATIC_KEYWORD, "static");
455
+ if (!hasExplicitKeyword) {
456
+ // Zero-width: synthetic token has no source presence, must not shift position
457
+ tokens.push({ type: TOKEN_TYPES.STATIC_KEYWORD, value: "static", source: filename, range: { start: { line, character }, end: { line, character } } });
458
+ TOKEN_TYPES.STATIC_KEYWORD;
459
+ last_non_junk_type = TOKEN_TYPES.STATIC_KEYWORD;
460
+ }
456
461
  addToken(TOKEN_TYPES.LOGIC_OPEN, "${");
457
462
  i += 2;
458
463
 
@@ -473,7 +473,12 @@ function lexer(src, filename = "anonymous") {
473
473
  if (char === "$" && next === "{") {
474
474
  {
475
475
  const hasExplicitKeyword = last_non_junk_type === TOKEN_TYPES.STATIC_KEYWORD || last_non_junk_type === TOKEN_TYPES.RUNTIME_KEYWORD;
476
- if (!hasExplicitKeyword) addToken(TOKEN_TYPES.STATIC_KEYWORD, "static");
476
+ if (!hasExplicitKeyword) {
477
+ // Zero-width: synthetic token has no source presence, must not shift position
478
+ tokens.push({ type: TOKEN_TYPES.STATIC_KEYWORD, value: "static", source: filename, range: { start: { line, character }, end: { line, character } } });
479
+ TOKEN_TYPES.STATIC_KEYWORD;
480
+ last_non_junk_type = TOKEN_TYPES.STATIC_KEYWORD;
481
+ }
477
482
  addToken(TOKEN_TYPES.LOGIC_OPEN, "${");
478
483
  i += 2;
479
484
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sommark",
3
- "version": "5.0.1",
3
+ "version": "5.0.2",
4
4
  "description": "SomMark is a template language that compiles to multiple output formats — HTML, JSON, YAML, TOML, CSV, Markdown, XML, and more.",
5
5
  "main": "index.js",
6
6
  "files": [