andromeda_cms 0.6.3-aarch64-linux → 0.7.0-aarch64-linux

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 119aae39f2676f63cc5ce0fe5d1f1cd8635fb811af39de950a049b9d9ddf97f6
4
- data.tar.gz: 6b0bbdc28e7b648456ef1477bef50a2ad8eddd25f4dc945ed9f407ce39cbf248
3
+ metadata.gz: 1cb0afe4548c8a7270c56043a458dff76f10edd5ff53962d270ad2ebc635314c
4
+ data.tar.gz: 391889844851fd61fdbabe38f22fb6742b342e00cafce72436408a3575bfeb40
5
5
  SHA512:
6
- metadata.gz: d6f0c8e3e5d518b463b630d02ac2f27ceab60b8b5cc823395f5f5ebf82b38abc8b7f38cc1e85ff426182d6f41fb3d18b9212291dcc37cb109c62b99aaee7ff71
7
- data.tar.gz: f5fb16a3a322c2d153a6b4630edcde9b81ddbf01828e6a6ac648a87ad55011ce3b9af051a60213db65023e586b0742ac3e640a950dc20106218a51c773694f07
6
+ metadata.gz: db8fbc5f86041c84bb961095d11ad86b602e9abfcc78a966a523a31507c579812d0e0c8dd007c8fc8cfac8520f98439b0db6e82793464aa279d05a6b66a2058b
7
+ data.tar.gz: 64c792d0c1b29191d8434ba85ae94019430a442e0b1b46c5bc07ef8c6da70ea20ff3512d7dc1cf5cd0d3d26c7a3d1ba2c676a44b87ef59d3bdb1d38e47e73dd4
data/CHANGELOG.md CHANGED
@@ -5,6 +5,24 @@ All notable changes to this project are documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.7.0] - 2026-10-16
9
+
10
+ ### Changed
11
+
12
+ - YAML frontmatter is now read the way Astro 7.3.6 and later read it. Astro
13
+ replaced js-yaml with the `yaml` package (core schema, timestamps, merge
14
+ keys), and Andromeda follows. Plain scalars that only YAML 1.1 or Psych
15
+ treat as numbers are now strings, as they are in Astro: values with
16
+ underscores (`1_000`, `0x1_F`), the `0b` prefix, and signed hexadecimal
17
+ or octal (`-0x1F`). Numbers in the core schema are unchanged, including
18
+ `010` (10), `0o17`, `0x1F` and `1e3`.
19
+ - A mapping that repeats a key now raises `Andromeda::SyntaxError` at the
20
+ second key, with its line and column, as Astro does. It used to keep the
21
+ last value silently. Keys are compared after resolution, so `1` and `01`
22
+ collide while `1` and `"1"` do not; repeated `<<` merge keys are allowed.
23
+ Content that repeats a key will fail to build until the duplicate is
24
+ removed.
25
+
8
26
  ## [0.6.3] - 2026-10-16
9
27
 
10
28
  ### Fixed
@@ -208,6 +226,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
208
226
  - Generators: `andromeda:install`, `andromeda:collection`,
209
227
  `andromeda:component` and `andromeda:import_astro`.
210
228
 
229
+ [0.7.0]: https://github.com/AndromedaCMS/andromeda_cms/releases/tag/v0.7.0
211
230
  [0.6.3]: https://github.com/AndromedaCMS/andromeda_cms/releases/tag/v0.6.3
212
231
  [0.6.2]: https://github.com/AndromedaCMS/andromeda_cms/releases/tag/v0.6.2
213
232
  [0.6.1]: https://github.com/AndromedaCMS/andromeda_cms/releases/tag/v0.6.1
@@ -25,45 +25,53 @@ module Andromeda
25
25
  # a non-blank line is seen, no `---`/`+++` after it is a fence.
26
26
  LEADING_RE = /\A\uFEFF?(?:[ \t]*\r?\n)*/
27
27
 
28
- # Psych resolves plain scalars by YAML 1.1 rules; js-yaml, which Astro
29
- # uses, follows YAML 1.2's core schema. The two disagree on values that
30
- # really do appear in hand-written frontmatter, and a silent disagreement
31
- # is worse than an error: `time: 12:30` becoming the integer 45000 passes
32
- # every schema check and then displays nonsense. Each rule below mirrors
33
- # what js-yaml 4 does with the same plain scalar.
28
+ # Psych resolves plain scalars by YAML 1.1 rules; Astro 7.3.6 and later
29
+ # read frontmatter with the `yaml` package (core schema, `timestamp` tag,
30
+ # merge keys), which follows YAML 1.2's core schema. The two disagree on
31
+ # values that really do appear in hand-written frontmatter, and a silent
32
+ # disagreement is worse than an error: `time: 12:30` becoming the integer
33
+ # 45000 passes every schema check and then displays nonsense. Each rule
34
+ # below mirrors what that parser does with the same plain scalar.
34
35
  class ScalarScanner < Psych::ScalarScanner
35
36
  # 1.1-only booleans; 1.2 keeps them as strings.
36
37
  YAML_1_1_ONLY_BOOL = /\A(?:[Yy]es|YES|[Nn]o|NO|[Oo]n|ON|[Oo]ff|OFF|[Yy]|[Nn])\z/
37
38
  # 1.1 base-60 (`1:30`) and comma-grouped (`1,000`) numbers; 1.2 has
38
39
  # neither, so these stay strings.
39
40
  YAML_1_1_ONLY_NUMBER = /\A[-+]?[0-9][0-9_]*(?:(?::[0-5]?[0-9])+|(?:,[0-9_]+)+)(?:\.[0-9_]*)?\z/
40
- # 1.1 reads a leading zero as octal (`010` is 8); 1.2 reads it as decimal.
41
- LEADING_ZERO_DECIMAL = /\A[-+]?0[0-9_]+\z/
42
- # 1.2's explicit octal prefix, unknown to Psych.
43
- OCTAL = /\A[-+]?0o[0-7_]+\z/
44
- # 1.2 accepts an exponent without a decimal point (`1e3`); Psych does not.
45
- EXPONENT_FLOAT = /\A[-+]?(?:[0-9][0-9_]*(?:\.[0-9_]*)?|\.[0-9_]+)[eE][-+]?[0-9]+\z/
41
+ # The core schema's integers. A leading zero is plain decimal (`010` is
42
+ # 10, where 1.1 reads octal); `0o` octal and `0x` hex take no sign.
43
+ INTEGER = /\A[-+]?[0-9]+\z/
44
+ OCTAL = /\A0o[0-7]+\z/
45
+ HEX = /\A0x[0-9a-fA-F]+\z/
46
+ # The core schema's floats, including an exponent without a decimal
47
+ # point (`1e3`), which Psych rejects. `.inf`/`.nan` are left to Psych.
48
+ FLOAT = /\A[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)(?:[eE][-+]?[0-9]+)?\z/
49
+ # Number-like spellings Psych accepts but the core schema does not
50
+ # (`1_000`, `0b1010`, `-0x1F`, `0o1_7`); they stay strings.
51
+ NON_CORE_NUMBER = /\A[-+]?(?:0[xXbBoO][0-9a-fA-F_]+|(?:[0-9][0-9_]*(?:\.[0-9_]*)?|\.[0-9_]+)(?:[eE][-+]?[0-9_]+)?)\z/
46
52
 
47
53
  def tokenize(string)
48
54
  case string
49
55
  when YAML_1_1_ONLY_BOOL, YAML_1_1_ONLY_NUMBER then string
50
- when LEADING_ZERO_DECIMAL then Integer(string.delete("_"), 10)
51
- when OCTAL then Integer(string.delete("_"))
52
- when EXPONENT_FLOAT then Float(normalize_float(string.delete("_")))
56
+ when INTEGER then Integer(string, 10)
57
+ when OCTAL then Integer(string[2..], 8)
58
+ when HEX then Integer(string, 16)
59
+ when FLOAT then Float(normalize_float(string))
60
+ when NON_CORE_NUMBER then string
53
61
  else super
54
62
  end
55
63
  end
56
64
 
57
65
  private
58
66
 
59
- # Ruby's Float() rejects the `1.e3` and `.5e3` spellings YAML allows.
67
+ # Ruby's Float() rejects the `1.`, `1.e3` and `.5e3` spellings YAML allows.
60
68
  def normalize_float(string)
61
- string.sub(/\.(?=[eE])/, ".0").sub(/\A([-+]?)\./, "\\10.")
69
+ string.sub(/\.(?=[eE]|\z)/, ".0").sub(/\A([-+]?)\./, "\\10.")
62
70
  end
63
71
  end
64
72
 
65
- # Restricts `!!` tags to Date/Time (matching js-yaml's default schema,
66
- # which also has no notion of arbitrary Ruby classes) while still
73
+ # Restricts `!!` tags to Date/Time (matching the `yaml` package's core
74
+ # schema, which also has no notion of arbitrary Ruby classes) while still
67
75
  # permitting the two classes plain `YYYY-MM-DD`/timestamp scalars resolve
68
76
  # to, so unquoted dates round-trip instead of raising
69
77
  # Psych::DisallowedClass.
@@ -76,7 +84,7 @@ module Andromeda
76
84
  end
77
85
 
78
86
  # Plain (non-"safe") visitor so anchors/aliases resolve instead of
79
- # raising -- js-yaml allows them by default, and copied Astro content may
87
+ # raising -- the `yaml` package resolves them by default, and copied Astro content may
80
88
  # rely on them.
81
89
  class ToRuby < Psych::Visitors::ToRuby
82
90
  def initialize
@@ -199,6 +207,8 @@ module Andromeda
199
207
  return {} if node.nil?
200
208
 
201
209
  reject_alias_explosion!(node, path: path, content_start_line: content_start_line)
210
+ reject_duplicate_keys!(node, ScalarScanner.new(ClassLoader.new), path: path,
211
+ content_start_line: content_start_line)
202
212
  ToRuby.new.accept(node) || {}
203
213
  rescue Psych::SyntaxError => e
204
214
  # Psych's own #line/#column are 0-based and relative to `text` (the
@@ -305,6 +315,36 @@ module Andromeda
305
315
  end
306
316
  private_class_method :expanded_size
307
317
 
318
+ # Astro's `yaml` parser reports a repeated mapping key as an error, where
319
+ # Psych silently keeps the last value. Keys are compared after resolution,
320
+ # so `1` and `01` collide while `1` and `"1"` do not. Plain `<<` merge
321
+ # keys, alias keys and collection keys are left out.
322
+ def reject_duplicate_keys!(node, scanner, path:, content_start_line:)
323
+ if node.is_a?(Psych::Nodes::Mapping)
324
+ seen = {}
325
+ node.children.each_slice(2) do |key, _value|
326
+ next unless key.is_a?(Psych::Nodes::Scalar)
327
+ next if key.plain && key.value == "<<"
328
+
329
+ resolved = key.plain ? scanner.tokenize(key.value) : key.value
330
+ resolved = resolved.to_f if resolved.is_a?(Numeric)
331
+ if seen.key?(resolved)
332
+ raise syntax_error("duplicate key #{key.value.inspect}", path: path,
333
+ content_start_line: content_start_line,
334
+ relative_line: key.start_line,
335
+ relative_column: key.start_column)
336
+ end
337
+
338
+ seen[resolved] = true
339
+ end
340
+ end
341
+
342
+ node.children.to_a.each do |child|
343
+ reject_duplicate_keys!(child, scanner, path: path, content_start_line: content_start_line)
344
+ end
345
+ end
346
+ private_class_method :reject_duplicate_keys!
347
+
308
348
  def syntax_error(message, path:, content_start_line:, relative_line:, relative_column:)
309
349
  Andromeda::SyntaxError.new(
310
350
  message,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Andromeda
4
- VERSION = "0.6.3"
4
+ VERSION = "0.7.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: andromeda_cms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3
4
+ version: 0.7.0
5
5
  platform: aarch64-linux
6
6
  authors:
7
7
  - LIMHAUS Inc.