@embeddables/cli 0.8.1 → 0.8.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.
@@ -1 +1 @@
1
- {"version":3,"file":"reverse.d.ts","sourceRoot":"","sources":["../../src/compiler/reverse.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAA;AAqnBzD,wBAAsB,cAAc,CAClC,UAAU,EAAE;IACV,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,QAAQ,EAAE,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC5B,cAAc,CAAC,EAAE,GAAG,EAAE,CAAA;IACtB,WAAW,CAAC,EAAE,GAAG,EAAE,CAAA;IACnB,UAAU,CAAC,EAAE,GAAG,EAAE,CAAA;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACnB,EACD,YAAY,EAAE,MAAM,EACpB,IAAI,CAAC,EAAE;IACL,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,YAAY,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAC5E,iBAkFF;AAghDD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAKpD"}
1
+ {"version":3,"file":"reverse.d.ts","sourceRoot":"","sources":["../../src/compiler/reverse.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,QAAQ,EAAiB,MAAM,YAAY,CAAA;AAqnBzD,wBAAsB,cAAc,CAClC,UAAU,EAAE;IACV,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,QAAQ,EAAE,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC5B,cAAc,CAAC,EAAE,GAAG,EAAE,CAAA;IACtB,WAAW,CAAC,EAAE,GAAG,EAAE,CAAA;IACnB,UAAU,CAAC,EAAE,GAAG,EAAE,CAAA;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACnB,EACD,YAAY,EAAE,MAAM,EACpB,IAAI,CAAC,EAAE;IACL,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,YAAY,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAC5E,iBAkFF;AAkiDD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAKpD"}
@@ -1189,6 +1189,19 @@ function htmlToJSXChildren(html, indent) {
1189
1189
  break;
1190
1190
  }
1191
1191
  }
1192
+ // Skip <!DOCTYPE ...>, <?xml ...?>, and other non-element tags that the
1193
+ // main tag regex cannot match. Without this guard `pos` would never
1194
+ // advance, causing an infinite loop.
1195
+ if (html[pos] === '<' && (html[pos + 1] === '!' || html[pos + 1] === '?')) {
1196
+ const gtIdx = html.indexOf('>', pos);
1197
+ if (gtIdx !== -1) {
1198
+ pos = gtIdx + 1;
1199
+ continue;
1200
+ }
1201
+ else {
1202
+ break;
1203
+ }
1204
+ }
1192
1205
  // Check for HTML tag
1193
1206
  const tagMatch = html.slice(pos).match(/^<(\/?)([a-zA-Z][a-zA-Z0-9]*)\s*([^>]*)>/);
1194
1207
  if (tagMatch) {
@@ -1360,8 +1373,13 @@ function htmlToJSXChildren(html, indent) {
1360
1373
  result.push(`${indentStr}<${tagName}${attrsStr} />`);
1361
1374
  continue;
1362
1375
  }
1363
- // Text content
1376
+ // Text content — if the next '<' is at the current position the character
1377
+ // wasn't consumed by any handler above. Skip it so we never stall.
1364
1378
  const textEnd = html.indexOf('<', pos);
1379
+ if (textEnd === pos) {
1380
+ pos++;
1381
+ continue;
1382
+ }
1365
1383
  if (textEnd === -1) {
1366
1384
  // Rest is text
1367
1385
  const text = html.slice(pos).trim();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embeddables/cli",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "embeddables": "./bin/embeddables.mjs"
@@ -45,6 +45,7 @@
45
45
  "test:verbose": "vitest --reporter verbose",
46
46
  "build:prompts": "node scripts/build-prompts.cjs",
47
47
  "prepack": "node scripts/readme-swap.cjs prepack",
48
+ "prepublishOnly": "npm run build",
48
49
  "postpack": "node scripts/readme-swap.cjs postpack"
49
50
  },
50
51
  "dependencies": {
@@ -1,13 +0,0 @@
1
- export interface CommandHistoryEntry {
2
- command: string;
3
- args: string[];
4
- exitCode: number;
5
- durationMs: number;
6
- timestamp: string;
7
- error?: string;
8
- }
9
- export declare function getHistoryFilePath(): string;
10
- export declare function readHistory(): CommandHistoryEntry[];
11
- export declare function writeHistoryEntry(entry: CommandHistoryEntry): void;
12
- export declare function getLastHistoryEntry(): CommandHistoryEntry | null;
13
- //# sourceMappingURL=command-history.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"command-history.d.ts","sourceRoot":"","sources":["../src/command-history.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED,wBAAgB,WAAW,IAAI,mBAAmB,EAAE,CAUnD;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,mBAAmB,GAAG,IAAI,CAMlE;AAED,wBAAgB,mBAAmB,IAAI,mBAAmB,GAAG,IAAI,CAGhE"}
@@ -1,34 +0,0 @@
1
- import fs from 'node:fs';
2
- import os from 'node:os';
3
- import path from 'node:path';
4
- const MAX_ENTRIES = 20;
5
- const HISTORY_DIR = path.join(os.homedir(), '.embeddables');
6
- const HISTORY_FILE = path.join(HISTORY_DIR, 'history.json');
7
- export function getHistoryFilePath() {
8
- return HISTORY_FILE;
9
- }
10
- export function readHistory() {
11
- try {
12
- if (!fs.existsSync(HISTORY_FILE))
13
- return [];
14
- const raw = fs.readFileSync(HISTORY_FILE, 'utf8');
15
- const parsed = JSON.parse(raw);
16
- if (!Array.isArray(parsed))
17
- return [];
18
- return parsed;
19
- }
20
- catch {
21
- return [];
22
- }
23
- }
24
- export function writeHistoryEntry(entry) {
25
- const history = readHistory();
26
- history.push(entry);
27
- const trimmed = history.slice(-MAX_ENTRIES);
28
- fs.mkdirSync(HISTORY_DIR, { recursive: true });
29
- fs.writeFileSync(HISTORY_FILE, JSON.stringify(trimmed, null, 2), 'utf8');
30
- }
31
- export function getLastHistoryEntry() {
32
- const history = readHistory();
33
- return history.length > 0 ? history[history.length - 1] : null;
34
- }
@@ -1,76 +0,0 @@
1
- export type DiffDepth = 'pages' | 'components' | 'props';
2
- export type RunDiffOptions = {
3
- id?: string;
4
- from?: string;
5
- to?: string;
6
- depth?: DiffDepth;
7
- color?: boolean;
8
- engine?: string;
9
- branch?: string;
10
- };
11
- export interface PageDiff {
12
- key: string;
13
- title?: string;
14
- status: 'added' | 'removed' | 'modified';
15
- components?: ComponentDiff[];
16
- }
17
- export interface ComponentDiff {
18
- id: string;
19
- key?: string;
20
- type?: string;
21
- status: 'added' | 'removed' | 'modified';
22
- props?: PropDiff[];
23
- }
24
- export interface PropDiff {
25
- name: string;
26
- status: 'added' | 'removed' | 'changed';
27
- from?: unknown;
28
- to?: unknown;
29
- }
30
- export interface SectionDiff {
31
- name: string;
32
- status: 'added' | 'removed' | 'modified';
33
- }
34
- export interface DiffSummary {
35
- pagesAdded: number;
36
- pagesRemoved: number;
37
- pagesModified: number;
38
- componentsAdded: number;
39
- componentsRemoved: number;
40
- componentsModified: number;
41
- propsAdded: number;
42
- propsRemoved: number;
43
- propsChanged: number;
44
- }
45
- export interface DiffResult {
46
- pages: PageDiff[];
47
- globalComponents: ComponentDiff[];
48
- sections: SectionDiff[];
49
- summary: DiffSummary;
50
- }
51
- type Colorizer = {
52
- red: (s: string) => string;
53
- green: (s: string) => string;
54
- yellow: (s: string) => string;
55
- gray: (s: string) => string;
56
- bold: (s: string) => string;
57
- cyan: (s: string) => string;
58
- dim: (s: string) => string;
59
- white: (s: string) => string;
60
- };
61
- export interface ParsedVersionSpec {
62
- version: string;
63
- branch?: string;
64
- }
65
- export declare function parseVersionSpecifier(spec: string): ParsedVersionSpec;
66
- export declare function versionLabel(spec: ParsedVersionSpec): string;
67
- export declare function resolveLocalVersion(embeddableId: string): Promise<Record<string, unknown>>;
68
- export declare function fetchCloudVersion(embeddableId: string, version: string, opts: {
69
- engine?: string;
70
- branch?: string;
71
- }): Promise<Record<string, unknown>>;
72
- export declare function computeDiff(from: Record<string, unknown>, to: Record<string, unknown>, depth: DiffDepth): DiffResult;
73
- export declare function renderDiff(diff: DiffResult, depth: DiffDepth, c: Colorizer): string[];
74
- export declare function runDiff(opts: RunDiffOptions): Promise<void>;
75
- export {};
76
- //# sourceMappingURL=diff.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../src/commands/diff.ts"],"names":[],"mappings":"AAkBA,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,YAAY,GAAG,OAAO,CAAA;AAExD,MAAM,MAAM,cAAc,GAAG;IAC3B,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,EAAE,CAAC,EAAE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