Skip to content

Commit 56c912c

Browse files
committed
chore: bump version to v1.0.8
1 parent 5d84f0e commit 56c912c

File tree

3 files changed

+39
-6
lines changed

3 files changed

+39
-6
lines changed

CHANGELOG.md

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @dschz/load-script
22

3+
## 1.0.8
4+
5+
### Patch Changes
6+
7+
- updates readme badges
8+
39
## 1.0.7
410

511
### Patch Changes
@@ -10,7 +16,7 @@
1016

1117
### Patch Changes
1218

13-
- make loadScript SSR safe with isBrowser guard to ensure function only runs in browser environments.
19+
- **🛡️ SSR Safety**: Safe to import and use in server-side rendering and non-browser environments with graceful error handling
1420

1521
## 1.0.5
1622

@@ -44,6 +50,33 @@
4450

4551
## 1.0.0
4652

47-
### Major Changes
53+
**Initial Release**: Complete utility function for dynamically loading external scripts into the browser with advanced features and safety guarantees.
54+
55+
### Features
56+
57+
- **🔄 Smart Caching**: Prevents duplicate script injection via intelligent in-memory caching by script `src` URL
58+
- **⚡ Framework Agnostic**: Works with any JavaScript framework or vanilla JS applications
59+
- **📝 Full TypeScript Support**: Comprehensive type definitions with intellisense and autocomplete support
60+
- **🎯 Flexible Script Attributes**: Support for all standard HTML script attributes including:
61+
- `async` and `defer` execution modes
62+
- `type` specification (text/javascript, module, importmap, etc.)
63+
- `integrity` for subresource integrity verification
64+
- `nonce` for Content Security Policy compliance
65+
- `crossOrigin` and `referrerPolicy` for CORS handling
66+
- `fetchPriority` for resource loading optimization
67+
- Custom `data-*` attributes support
68+
69+
### Technical Details
70+
71+
- **DOM Integration**: Flexible container targeting with fallback to `document.head`
72+
- **Promise-Based API**: Async/await compatible with proper error handling
73+
- **Event Handling**: Built-in `onLoad` and `onError` callback support
74+
- **Content Injection**: Support for both `innerHTML` and `textContent` with security considerations
75+
- **Cache Management**: Automatic cache invalidation when scripts are removed from DOM
76+
- **Type Safety**: Comprehensive TypeScript definitions for all HTML script element properties
77+
78+
### API
4879

49-
- Utility function to dynamically load external scripts into the browser.
80+
- `loadScript(src, options?, container?)` - Main function returning `Promise<HTMLScriptElement>`
81+
- `LoadScriptOptions` - Comprehensive options interface with full HTML script attribute support
82+
- Built-in type definitions for `CrossOrigin`, `FetchPriority`, `ReferrerPolicy`, and `ScriptType`

jsr.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"name": "@dschz/load-script",
3-
"version": "1.0.7",
3+
"version": "1.0.8",
44
"license": "MIT",
55
"exports": "./src/index.ts",
66
"publish": {
7-
"include": ["LICENSE", "README.md", "src/**/*.ts"],
7+
"include": ["LICENSE", "README.md", "CHANGELOG.md", "src/**/*.ts"],
88
"exclude": ["**/*.test.ts"]
99
}
1010
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@dschz/load-script",
3-
"version": "1.0.7",
3+
"version": "1.0.8",
44
"description": "Dynamically load scripts in the browser with caching.",
55
"type": "module",
66
"author": "Daniel Sanchez <dsanc89@icloud.com>",

0 commit comments

Comments
 (0)