spooder 4.2.2 → 4.2.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 (3) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/src/api.ts +4 -3
package/README.md CHANGED
@@ -1008,7 +1008,7 @@ generate_hash_subs(40).then(...);
1008
1008
  > [!NOTE]
1009
1009
  > SHA-1 hashes are `40` characters. Git is transitioning to SHA-256, which are `64` characters. Short hashes of `7` are generally sufficient for cache-busting.
1010
1010
 
1011
- Use a different prefix other than `$hash=` by passing it as the first parameter.
1011
+ Use a different prefix other than `hash=` by passing it as the first parameter.
1012
1012
 
1013
1013
  ```ts
1014
1014
  generate_hash_subs(7, '$#').then(subs => hash_sub_table = subs).catch(caution);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "spooder",
3
3
  "type": "module",
4
- "version": "4.2.2",
4
+ "version": "4.2.4",
5
5
  "exports": {
6
6
  ".": {
7
7
  "bun": "./src/api.ts",
package/src/api.ts CHANGED
@@ -142,11 +142,12 @@ export function parse_template(template: string, replacements: Record<string, st
142
142
  for (const loop_entry of loop_entries)
143
143
  for (const index of indicies)
144
144
  content_parts[index] = loop_entry;
145
-
146
- i += loop_content.length + 6;
145
+
146
+ result += content_parts.join('');
147
147
  } else {
148
148
  result += '{$' + buffer + '}' + loop_content + '{/for}';
149
149
  }
150
+ i += loop_content.length + 6;
150
151
  }
151
152
  } else {
152
153
  result += replacements[buffer] ?? '{$' + buffer + '}';
@@ -162,7 +163,7 @@ export function parse_template(template: string, replacements: Record<string, st
162
163
  return result;
163
164
  }
164
165
 
165
- export async function generate_hash_subs(length = 7, prefix = '$hash='): Promise<Record<string, string>> {
166
+ export async function generate_hash_subs(length = 7, prefix = 'hash='): Promise<Record<string, string>> {
166
167
  const cmd = ['git', 'ls-tree', '-r', 'HEAD'];
167
168
  const process = Bun.spawn(cmd, {
168
169
  stdout: 'pipe',