Skip to content

Commit

Permalink
Add warning message when using network
Browse files Browse the repository at this point in the history
  • Loading branch information
pomber committed Aug 5, 2024
1 parent b6ec951 commit 8b41d67
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 23 deletions.
12 changes: 0 additions & 12 deletions .changeset/pre.json

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/seven-buckets-walk.md

This file was deleted.

10 changes: 10 additions & 0 deletions lib/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# @code-hike/lighter

## 1.0.0

### Major Changes

- b6ec951: Drop CJS and use dynamic imports for grammars

### Patch Changes

- Add warning message when using network

## 1.0.0-beta.0

### Major Changes
Expand Down
2 changes: 1 addition & 1 deletion lib/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@code-hike/lighter",
"type": "module",
"version": "1.0.0-beta.0",
"version": "1.0.0",
"description": "Code Hike's syntax highlighter",
"license": "MIT",
"exports": {
Expand Down
3 changes: 3 additions & 0 deletions lib/src/network.browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ const LIGHTER_VERSION = "__LIGHTER_VERSION__";
// /grammars/${name}.json
// /themes/${name}.json
export async function fetchJSON(endpoint: string) {
console.warn(
`Code Hike warning: Fetching resource from network "${endpoint}"`
);
const r = await fetch(`https://lighter.codehike.org/${endpoint}.json`);
// console.log(`https://lighter.codehike.org/${endpoint}.json`, r.status);
if (!r.ok) {
Expand Down
4 changes: 3 additions & 1 deletion lib/src/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ const LIGHTER_VERSION = "__LIGHTER_VERSION__";
// /grammars/${name}.json
// /themes/${name}.json
export async function fetchJSON(endpoint: string) {
console.warn("[WARN] Code Hike:", "fetching resource from network", endpoint);
console.warn(
`Code Hike warning: Fetching resource from network "${endpoint}"`
);
if (typeof fetch === "function") {
// console.log(`using fetch`, `https://lighter.codehike.org/${endpoint}.json`);
const r = await fetch(`https://lighter.codehike.org/${endpoint}.json`);
Expand Down
8 changes: 8 additions & 0 deletions test/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# lighter-test

## 0.1.48

### Patch Changes

- Updated dependencies
- Updated dependencies [b6ec951]
- @code-hike/lighter@1.0.0

## 0.1.48-beta.0

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "lighter-test",
"private": true,
"type": "module",
"version": "0.1.48-beta.0",
"version": "0.1.48",
"dependencies": {
"@code-hike/lighter": "1.0.0-beta.0"
"@code-hike/lighter": "1.0.0"
}
}
8 changes: 8 additions & 0 deletions web/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# lighter-web

## 0.1.48

### Patch Changes

- Updated dependencies
- Updated dependencies [b6ec951]
- @code-hike/lighter@1.0.0

## 0.1.48-beta.0

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions web/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"private": "true",
"version": "0.1.48-beta.0",
"version": "0.1.48",
"name": "lighter-web",
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"dependencies": {
"@code-hike/lighter": "1.0.0-beta.0",
"@code-hike/lighter": "1.0.0",
"next": "13.4.10",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Expand Down

0 comments on commit 8b41d67

Please sign in to comment.