Skip to content

Commit

Permalink
Merge pull request #490 from live-codes/develop
Browse files Browse the repository at this point in the history
release v20
  • Loading branch information
hatemhosny authored Jan 17, 2024
2 parents 5e82f1c + 9982072 commit b9d8951
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 32 deletions.
30 changes: 14 additions & 16 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,36 @@ All notable changes to this project will be documented in this file. See [standa

---

## [sdk-v0.4.0](https://github.com/live-codes/livecodes/compare/v19...sdk-v0.4.0) (2024-01-17)

## [v20](https://github.com/live-codes/livecodes/compare/v19...v20) (2024-01-17)

### Features

* **Editor:** support editor themes ([7eaafeb](https://github.com/live-codes/livecodes/commit/7eaafeb325164186e9c05af57ad255a554c6b909))
* **SDK:** add `getPlaygroundUrl` function to SDK ([ef2105b](https://github.com/live-codes/livecodes/commit/ef2105bb773c09cf8e361a630e9b3e829256f44f))
* **SDK:** update options on changing props in react sdk ([0544540](https://github.com/live-codes/livecodes/commit/054454025d6ac9a605afc502f23120f4ba3f72da))
* **SDK:** update options on changing props in vue sdk ([04c8ae8](https://github.com/live-codes/livecodes/commit/04c8ae89e65c606c8715c53cc81cce7b4ebbcd17))
* **UI:** add buttons for project info and custom settings in editor toolbar ([e92a4f6](https://github.com/live-codes/livecodes/commit/e92a4f6924152730cc1294dcaf3fad3ffd628385))
* **UI:** add editor settings button to editor toolbar ([213cfc9](https://github.com/live-codes/livecodes/commit/213cfc955704a040b7bc4335e79380878804b328))
- **Editor:** support editor themes ([7eaafeb](https://github.com/live-codes/livecodes/commit/7eaafeb325164186e9c05af57ad255a554c6b909))
- **UI:** add buttons for project info and custom settings in editor toolbar ([e92a4f6](https://github.com/live-codes/livecodes/commit/e92a4f6924152730cc1294dcaf3fad3ffd628385))
- **UI:** add editor settings button to editor toolbar ([213cfc9](https://github.com/live-codes/livecodes/commit/213cfc955704a040b7bc4335e79380878804b328))

---

## [sdk-v0.4.0](https://github.com/live-codes/livecodes/compare/sdk-v0.3.0...sdk-v0.4.0) (2024-01-17)

### Features

- **SDK:** add `getPlaygroundUrl` function to SDK ([ef2105b](https://github.com/live-codes/livecodes/commit/ef2105bb773c09cf8e361a630e9b3e829256f44f))
- **SDK:** update options on changing props in react sdk ([0544540](https://github.com/live-codes/livecodes/commit/054454025d6ac9a605afc502f23120f4ba3f72da))
- **SDK:** update options on changing props in vue sdk ([04c8ae8](https://github.com/live-codes/livecodes/commit/04c8ae89e65c606c8715c53cc81cce7b4ebbcd17))

---

## [v19](https://github.com/live-codes/livecodes/compare/v18...v19) (2023-11-27)


### Bug Fixes

* **Templates:** fix solid template ([32732a0](https://github.com/live-codes/livecodes/commit/32732a0bc32a0660561d4d104379785877e755aa))

- **Templates:** fix solid template ([32732a0](https://github.com/live-codes/livecodes/commit/32732a0bc32a0660561d4d104379785877e755aa))

### Features

* **compilers:** upgrade Brython to v3.12.1 running Python v3.12 ([933f606](https://github.com/live-codes/livecodes/commit/933f606d960d9cea9b41534e944e6c2417902b77))
* **Types:** load types for imports from CDN URLs ([8d25463](https://github.com/live-codes/livecodes/commit/8d2546393591c49e1b698e707e731b2977ad8085))



- **compilers:** upgrade Brython to v3.12.1 running Python v3.12 ([933f606](https://github.com/live-codes/livecodes/commit/933f606d960d9cea9b41534e944e6c2417902b77))
- **Types:** load types for imports from CDN URLs ([8d25463](https://github.com/live-codes/livecodes/commit/8d2546393591c49e1b698e707e731b2977ad8085))

---

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "livecodes",
"version": "0.0.0",
"appVersion": "19",
"appVersion": "20",
"description": "Code Playground That Just Works!",
"author": "Hatem Hosny",
"license": "MIT",
Expand Down
6 changes: 3 additions & 3 deletions src/livecodes/compiler/__tests__/import-map.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ describe('Import map', () => {
`;

const importMap = {
'@codemirror/basic-setup': 'https://jspm.dev/@codemirror/basic-setup',
'@codemirror/basic-setup': 'https://esm.sh/@codemirror/basic-setup',
lodash: 'https://unpkg.com/lodash',
mylib: 'https://someurl/path/module',
similar2: 'https://jspm.dev/similar2',
similar2: 'https://esm.sh/similar2',
};

const map = createImportMap(code, config);
Expand Down Expand Up @@ -60,7 +60,7 @@ describe('Import map', () => {
`;

const expectedCode = `
import { EditorState, EditorView, basicSetup } from 'https://jspm.dev/@codemirror/basic-setup';
import { EditorState, EditorView, basicSetup } from 'https://esm.sh/@codemirror/basic-setup';
import fp from "https://unpkg.com/lodash/fp.js";
import { html } from 'http://localhost/@codemirror/lang-html';
import { flatten } from 'https://cdn.jsdelivr.net/gh/remeda/remeda@master/src/flatten.js';
Expand Down
8 changes: 4 additions & 4 deletions src/livecodes/services/__tests__/modulesService.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ describe('modulesService', () => {
test('CDN urls', () => {
const url = modulesService.getModuleUrl;

expect(url('uuid')).toEqual('https://jspm.dev/uuid');
expect(url('uuid')).toEqual('https://esm.sh/uuid');

expect(url('[email protected]')).toEqual('https://jspm.dev/[email protected]');
expect(url('[email protected]')).toEqual('https://esm.sh/[email protected]');

expect(url('[email protected]/sub/directory/file.js')).toEqual(
'https://jspm.dev/[email protected]/sub/directory/file.js',
'https://esm.sh/[email protected]/sub/directory/file.js',
);

expect(url('jspm:uuid')).toEqual('https://jspm.dev/uuid');

expect(url('npm:uuid')).toEqual('https://jspm.dev/uuid');
expect(url('npm:uuid')).toEqual('https://esm.sh/uuid');

expect(url('skypack:uuid')).toEqual('https://cdn.skypack.dev/uuid');

Expand Down
12 changes: 5 additions & 7 deletions src/livecodes/services/modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import type { CDN } from '../models';

declare const globalThis: { appCDN: CDN };

const moduleCDNs: CDN[] = ['jspm', 'esm.sh', 'skypack'];
const moduleCDNs: CDN[] = ['esm.sh', 'skypack', 'jspm'];
const npmCDNs: CDN[] = ['unpkg', 'jsdelivr', 'fastly.jsdelivr'];
const ghCDNs: CDN[] = ['fastly.jsdelivr.gh', 'jsdelivr.gh', 'statically'];

export const modulesService = {
getModuleUrl: (
moduleName: string,
{ isModule = true, defaultCDN = 'jspm' }: { isModule?: boolean; defaultCDN?: CDN } = {},
{ isModule = true, defaultCDN = 'esm.sh' }: { isModule?: boolean; defaultCDN?: CDN } = {},
) => {
moduleName = moduleName.replace(/#nobundle/g, '');

Expand All @@ -18,9 +18,7 @@ export const modulesService = {
return moduleUrl;
}

return isModule
? 'https://jspm.dev/' + moduleName
: 'https://cdn.jsdelivr.net/npm/' + moduleName;
return isModule ? 'https://esm.sh/' + moduleName : 'https://cdn.jsdelivr.net/npm/' + moduleName;
},

getUrl: (path: string, cdn?: CDN) =>
Expand Down Expand Up @@ -76,9 +74,9 @@ const getCdnUrl = (modName: string, isModule: boolean, defaultCDN?: CDN) => {
const TEMPLATES: Array<[RegExp, string]> = [
[/^(jspm:)(.+)/i, 'https://jspm.dev/$2'],

[/^(npm:)(.+)/i, 'https://jspm.dev/$2'],
[/^(npm:)(.+)/i, 'https://esm.sh/$2'],

[/^(node:)(.+)/i, 'https://jspm.dev/$2'],
[/^(node:)(.+)/i, 'https://esm.sh/$2'],

[/^(skypack:)(.+)/i, 'https://cdn.skypack.dev/$2'],

Expand Down
4 changes: 3 additions & 1 deletion src/livecodes/templates/starter/preact-starter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ render(<App name="Preact" />, document.body);
stylesheets: [],
scripts: [],
cssPreset: '',
imports: {},
types: {},
customSettings: {
defaultCDN: 'jspm',
},
};
1 change: 1 addition & 0 deletions src/livecodes/toolspane/test-imports.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { chaiUrl, vendorsBaseUrl } from '../vendors';

export const testImports = {
react: 'https://esm.sh/react?dev',
'@testing-library/dom': vendorsBaseUrl + '@testing-library/dom.js',
'@testing-library/jest-dom': vendorsBaseUrl + '@testing-library/jest-dom.js',
'@testing-library/react': vendorsBaseUrl + '@testing-library/react.js',
Expand Down

0 comments on commit b9d8951

Please sign in to comment.