extension-create 4.1.14 → 4.1.16

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.
package/dist/module.cjs CHANGED
@@ -606,7 +606,7 @@ const NETWORK_TIMEOUT_MS = (()=>{
606
606
  return Number.isFinite(raw) && raw > 0 ? raw : 60000;
607
607
  })();
608
608
  const CODELOAD_BASE = 'https://codeload.github.com/extension-js/examples/zip';
609
- const DEFAULT_TEMPLATES_REF = 'cb6a25377bd9516a1e55447a2010537019851ab2';
609
+ const DEFAULT_TEMPLATES_REF = 'd951b735ee5fbe904bba0c47d688527300d10e32';
610
610
  const BUNDLED_TEMPLATES = [
611
611
  "javascript"
612
612
  ];
@@ -1,4 +1,4 @@
1
- export declare const DEFAULT_TEMPLATES_REF = "cb6a25377bd9516a1e55447a2010537019851ab2";
1
+ export declare const DEFAULT_TEMPLATES_REF = "d951b735ee5fbe904bba0c47d688527300d10e32";
2
2
  export declare const BUNDLED_TEMPLATES: readonly string[];
3
3
  export declare const DEFAULT_TEMPLATE_NAME = "typescript";
4
4
  export declare const OFFLINE_FALLBACK_TEMPLATE = "javascript";
@@ -1,6 +1,6 @@
1
1
  {
2
- "createdWith": "extension-create@4.1.13",
2
+ "createdWith": "extension-create@4.1.15",
3
3
  "template": "typescript",
4
- "source": "https://codeload.github.com/extension-js/examples/zip/cb6a25377bd9516a1e55447a2010537019851ab2",
5
- "ref": "cb6a25377bd9516a1e55447a2010537019851ab2"
4
+ "source": "https://codeload.github.com/extension-js/examples/zip/d951b735ee5fbe904bba0c47d688527300d10e32",
5
+ "ref": "d951b735ee5fbe904bba0c47d688527300d10e32"
6
6
  }
@@ -9,7 +9,7 @@ Packaging your extension is local and free. Submitting the result to a
9
9
  store is what [extension.dev](https://docs.extension.dev/publish/overview?utm_source=store-md)
10
10
  does, and it sponsors Extension.js.
11
11
 
12
- Last updated: 2026-09-06
12
+ Last updated: 2026-09-09
13
13
 
14
14
  ## Listing
15
15
 
@@ -6,8 +6,9 @@
6
6
  "license": "MIT",
7
7
  "type": "module",
8
8
  "devDependencies": {
9
+ "@types/chrome": "^0.0.287",
9
10
  "typescript": "7.0.2",
10
- "extension": "^4.1.13"
11
+ "extension": "^4.1.15"
11
12
  },
12
13
  "scripts": {
13
14
  "dev": "extension dev",
@@ -24,21 +24,21 @@ if (!isFirefoxLike) {
24
24
  chrome.sidePanel.setPanelBehavior({openPanelOnActionClick: true})
25
25
  }
26
26
 
27
- chrome.runtime.onMessage.addListener((message) => {
27
+ chrome.runtime.onMessage.addListener((message, sender) => {
28
28
  if (!message || message.type !== 'openSidebar') return
29
29
 
30
+ // Every line here runs synchronously on purpose. sidePanel.open() is only
31
+ // allowed inside the user gesture that the content-script click carries, and
32
+ // a tabs.query callback outlives it: the panel then silently refuses to open.
33
+ // sender.tab is the tab the click came from, so no lookup is needed at all.
30
34
  chrome.sidePanel.setPanelBehavior({openPanelOnActionClick: true})
31
35
 
32
- if (!chrome.sidePanel.open) return
36
+ const tabId = sender.tab?.id
37
+ if (!chrome.sidePanel.open || tabId === undefined) return
33
38
 
34
- chrome.tabs.query({active: true, currentWindow: true}, (tabs) => {
35
- const activeTabId = tabs && tabs[0] && tabs[0].id
36
- if (!activeTabId) return
37
-
38
- try {
39
- chrome.sidePanel.open({tabId: activeTabId})
40
- } catch (error) {
41
- console.error(error)
42
- }
43
- })
39
+ try {
40
+ chrome.sidePanel.open({tabId})
41
+ } catch (error) {
42
+ console.error(error)
43
+ }
44
44
  })
package/package.json CHANGED
@@ -25,7 +25,7 @@
25
25
  "templates"
26
26
  ],
27
27
  "name": "extension-create",
28
- "version": "4.1.14",
28
+ "version": "4.1.16",
29
29
  "description": "The standalone extension creation engine for Extension.js",
30
30
  "author": {
31
31
  "name": "Cezar Augusto",
@@ -24,21 +24,21 @@ if (!isFirefoxLike) {
24
24
  chrome.sidePanel.setPanelBehavior({openPanelOnActionClick: true})
25
25
  }
26
26
 
27
- chrome.runtime.onMessage.addListener((message) => {
27
+ chrome.runtime.onMessage.addListener((message, sender) => {
28
28
  if (!message || message.type !== 'openSidebar') return
29
29
 
30
+ // Every line here runs synchronously on purpose. sidePanel.open() is only
31
+ // allowed inside the user gesture that the content-script click carries, and
32
+ // a tabs.query callback outlives it: the panel then silently refuses to open.
33
+ // sender.tab is the tab the click came from, so no lookup is needed at all.
30
34
  chrome.sidePanel.setPanelBehavior({openPanelOnActionClick: true})
31
35
 
32
- if (!chrome.sidePanel.open) return
36
+ const tabId = sender.tab?.id
37
+ if (!chrome.sidePanel.open || tabId === undefined) return
33
38
 
34
- chrome.tabs.query({active: true, currentWindow: true}, (tabs) => {
35
- const activeTabId = tabs?.[0]?.id
36
- if (!activeTabId) return
37
-
38
- try {
39
- chrome.sidePanel.open({tabId: activeTabId})
40
- } catch (error) {
41
- console.error(error)
42
- }
43
- })
39
+ try {
40
+ chrome.sidePanel.open({tabId})
41
+ } catch (error) {
42
+ console.error(error)
43
+ }
44
44
  })