shopify-theme-devtools 1.1.3 → 2.0.0

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 +102 -28
  2. package/dist/theme-devtools.js +5847 -3288
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,54 +1,128 @@
1
1
  # Shopify Theme Devtools
2
2
 
3
- In-browser devtools panel for Shopify theme development. Inspect Liquid context, metafields, theme settings, cart state, and sections.
3
+ [![npm version](https://img.shields.io/npm/v/shopify-theme-devtools.svg)](https://www.npmjs.com/package/shopify-theme-devtools)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
5
+ [![jsDelivr hits](https://img.shields.io/jsdelivr/npm/hm/shopify-theme-devtools)](https://www.jsdelivr.com/package/npm/shopify-theme-devtools)
4
6
 
5
- ## Installation
7
+ A powerful in-browser developer tools panel for Shopify theme development. Inspect Liquid objects, metafields, cart state, detect Liquid errors, debug network requests, and much more — all without leaving the browser.
8
+
9
+ ## Features
10
+
11
+ - **Liquid Object Inspector** — Browse `shop`, `product`, `collection`, `customer`, `cart` and more with deep search
12
+ - **Metafields Viewer** — Explore metafields across all resources and namespaces
13
+ - **Live Cart State** — Real-time cart updates with add/remove/clear actions
14
+ - **Liquid Error Detection** — Automatically detects `Liquid error`, Drop objects, missing snippets/assets
15
+ - **Network Monitor** — Captures failed fetch/XHR requests
16
+ - **Console Capture** — Intercepts `console.log`, `console.table`, `console.group` with persistence
17
+ - **SEO Inspector** — Meta tags, Open Graph, structured data
18
+ - **Analytics Viewer** — Google Analytics, Facebook Pixel tracking codes
19
+ - **Storage Inspector** — localStorage, sessionStorage, and cookies
20
+ - **Localization** — Markets, currencies, languages, and country data
21
+
22
+ ## Quick Start
23
+
24
+ **1. Add the snippet to your theme**
25
+
26
+ Copy the Liquid bridge to your theme's snippets folder:
27
+
28
+ ```
29
+ snippets/theme-devtools-bridge.liquid
30
+ ```
31
+
32
+ You can find it in [`src/liquid/theme-devtools-bridge.liquid`](src/liquid/theme-devtools-bridge.liquid) or install via npm:
6
33
 
7
34
  ```bash
8
35
  npm install shopify-theme-devtools
36
+ # Then copy node_modules/shopify-theme-devtools/src/liquid/theme-devtools-bridge.liquid to your snippets/
9
37
  ```
10
38
 
11
- ## Setup
12
-
13
- 1. Copy `src/liquid/theme-devtools-bridge.liquid` to your theme's `snippets/` folder
39
+ **2. Include in your layout**
14
40
 
15
- 2. Add to `layout/theme.liquid` before `</body>`:
41
+ Add this line to `layout/theme.liquid` just before `</body>`:
16
42
 
17
43
  ```liquid
18
44
  {% render 'theme-devtools-bridge' %}
19
45
  ```
20
46
 
21
- Only renders on development/preview themes, safe to leave in production.
47
+ **3. You're done!**
48
+
49
+ The devtools panel will automatically appear on unpublished/development themes. It's safe to commit — it won't render on your live published theme.
22
50
 
23
51
  ## Usage
24
52
 
25
- Toggle panel: `Cmd+Shift+D` (Mac) / `Ctrl+Shift+D` (Windows)
26
-
27
- **Panels:**
28
- - **Objects** Inspect Liquid objects (shop, product, collection, customer, etc.)
29
- - **Metafields** — Browse metafields by resource
30
- - **Settings** — View theme and section settings
31
- - **Sections** — List and highlight rendered sections
32
- - **Cart** Live cart state with actions
33
- - **Info** — Theme, template, and request info
34
- - **Analytics** View analytics and tracking data
35
- - **Apps** Installed apps information
36
- - **Cookies** Browser cookies inspector
37
- - **Storage** LocalStorage and SessionStorage viewer
38
- - **Localization** Markets, currencies, and languages
39
- - **SEO** Meta tags and SEO information
40
- - **Console** Liquid debug console
41
-
42
- Click any property to copy its Liquid path.
53
+ | Action | Shortcut |
54
+ |--------|----------|
55
+ | Toggle Panel | `Cmd+Shift+D` (Mac) / `Ctrl+Shift+D` (Windows) |
56
+ | Copy Liquid Path | Click any property key |
57
+
58
+ ### Panels
59
+
60
+ | Panel | Description |
61
+ |-------|-------------|
62
+ | **Objects** | Inspect Liquid objects with deep search filtering |
63
+ | **Metafields** | Browse metafields by resource and namespace |
64
+ | **Cart** | Live cart state with manipulation actions |
65
+ | **Locale** | Markets, currencies, languages |
66
+ | **Analytics** | Tracking codes and analytics data |
67
+ | **SEO** | Meta tags, Open Graph, structured data |
68
+ | **Apps** | Installed Shopify apps |
69
+ | **Console** | Captured logs with Liquid error detection |
70
+ | **Cookies** | Browser cookies viewer |
71
+ | **Storage** | localStorage & sessionStorage inspector |
72
+ | **Info** | Theme, template, and request metadata |
73
+
74
+ ## Console Panel Features
75
+
76
+ The Console panel goes beyond basic logging:
77
+
78
+ - **Liquid Error Detection** — Scans the DOM for `Liquid error`, `Liquid syntax error`, Drop objects (`#<ProductDrop:0x...>`), and schema errors
79
+ - **Network Errors** — Captures failed fetch and XHR requests with status, timing, and URL
80
+ - **Log Persistence** — Logs persist across page navigations within a session
81
+ - **`console.table` Support** — Renders tables properly
82
+ - **`console.group` Support** — Collapsible log groups
83
+ - **Smart Grouping** — Deduplicates repeated errors with counts
84
+
85
+ ## Configuration
86
+
87
+ By default, the devtools load from jsDelivr CDN. For local development:
88
+
89
+ ```liquid
90
+ {%- assign devtools_local = true -%}
91
+ {% render 'theme-devtools-bridge' %}
92
+ ```
93
+
94
+ Then run the dev server:
95
+
96
+ ```bash
97
+ npm run dev # Starts at localhost:9999
98
+ ```
43
99
 
44
100
  ## Development
45
101
 
46
102
  ```bash
103
+ # Install dependencies
47
104
  npm install
48
- npm run dev # Dev server at localhost:9999
49
- npm run build # Production build
105
+
106
+ # Start dev server (localhost:9999)
107
+ npm run dev
108
+
109
+ # Build for production
110
+ npm run build
50
111
  ```
51
112
 
113
+ ## How It Works
114
+
115
+ 1. The Liquid bridge snippet extracts context (objects, metafields, settings) and injects it as JSON
116
+ 2. The JavaScript bundle reads this context and renders the devtools panel
117
+ 3. Only renders on unpublished themes (checks `theme.role != 'main'`)
118
+ 4. Uses Shadow DOM for style isolation — won't affect your theme styles
119
+
120
+ ## Tech Stack
121
+
122
+ - [Lit](https://lit.dev/) — Lightweight Web Components
123
+ - [Vite](https://vitejs.dev/) — Fast build tooling
124
+ - Single IIFE bundle (~48KB gzipped)
125
+
52
126
  ## License
53
127
 
54
- [MIT](LICENSE)
128
+ [MIT](LICENSE) — Built by [@yakohere](https://github.com/yakohere)