Compare commits

..

7 Commits

Author SHA1 Message Date
github-actions[bot]
2555a8698d Version Packages 2022-08-12 22:50:36 +02:00
Thomas Allmer
367529c211 fix(engine): make sure inputDir public folder wins over plugins public folders 2022-08-12 22:48:16 +02:00
github-actions[bot]
ce3298d218 Version Packages 2022-08-11 18:24:03 +02:00
Thomas Allmer
a22da493dd fix(building-rollup): apply user provided developmentMode 2022-08-11 18:18:52 +02:00
Thomas Allmer
7a8f165625 chore: refresh lock file 2022-08-11 18:18:52 +02:00
Thomas Allmer
c8081071f7 chore: in readme use us images from main branch 2022-08-11 16:53:18 +02:00
Thomas Allmer
ab2436162c fix(mdjs-preview): add server folder to the published npm package 2022-08-11 16:53:18 +02:00
27 changed files with 2775 additions and 3408 deletions

View File

@@ -2,15 +2,15 @@
<p align="center"> <p align="center">
<picture width="60%"> <picture width="60%">
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/modernweb-dev/rocket/next/site/src/assets/rocket-logo-dark-with-text.svg"> <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/modernweb-dev/rocket/main/site/src/assets/rocket-logo-dark-with-text.svg">
<img alt="Rocket Logo" src="https://raw.githubusercontent.com/modernweb-dev/rocket/next/site/src/assets/rocket-logo-light-with-text.svg"> <img alt="Rocket Logo" src="https://raw.githubusercontent.com/modernweb-dev/rocket/main/site/src/assets/rocket-logo-light-with-text.svg">
</picture> </picture>
</p> </p>
<p align="center"> <p align="center">
<a href="https://github.com/modernweb-dev/rocket/actions" <a href="https://github.com/modernweb-dev/rocket/actions"
><img ><img
src="https://img.shields.io/github/workflow/status/modernweb-dev/rocket/Release/next?label=workflow&style=flat-square" src="https://img.shields.io/github/workflow/status/modernweb-dev/rocket/Release/main?label=workflow&style=flat-square"
alt="GitHub Actions workflow status" alt="GitHub Actions workflow status"
/></a> /></a>
<a href="https://twitter.com/modern_web_dev" <a href="https://twitter.com/modern_web_dev"

View File

@@ -1,5 +1,11 @@
# @rocket/building-rollup # @rocket/building-rollup
## 0.4.1
### Patch Changes
- a22da49: Make sure user provided `developmentMode` actually gets applied.
## 0.4.0 ## 0.4.0
### Minor Changes ### Minor Changes

View File

@@ -1,6 +1,6 @@
{ {
"name": "@rocket/building-rollup", "name": "@rocket/building-rollup",
"version": "0.4.0", "version": "0.4.1",
"publishConfig": { "publishConfig": {
"access": "public" "access": "public"
}, },

View File

@@ -13,7 +13,7 @@ export function createBasicConfig(userConfig) {
export function createBasicMetaConfig(userConfig = { output: {} }) { export function createBasicMetaConfig(userConfig = { output: {} }) {
const developmentMode = const developmentMode =
typeof userConfig.developmentMode !== undefined typeof userConfig.developmentMode !== 'undefined'
? userConfig.developmentMode ? userConfig.developmentMode
: !!process.env.ROLLUP_WATCH; : !!process.env.ROLLUP_WATCH;
delete userConfig.developmentMode; delete userConfig.developmentMode;

View File

@@ -14,7 +14,7 @@ export function createServiceWorkerConfig(userConfig) {
export function createServiceWorkerMetaConfig(userConfig = { output: {} }) { export function createServiceWorkerMetaConfig(userConfig = { output: {} }) {
const developmentMode = const developmentMode =
typeof userConfig.developmentMode !== undefined typeof userConfig.developmentMode !== 'undefined'
? userConfig.developmentMode ? userConfig.developmentMode
: !!process.env.ROLLUP_WATCH; : !!process.env.ROLLUP_WATCH;
delete userConfig.developmentMode; delete userConfig.developmentMode;

View File

@@ -15,9 +15,6 @@
{ {
"path": "../plugins-manager/tsconfig.json" "path": "../plugins-manager/tsconfig.json"
}, },
{
"path": "../mdjs-core/tsconfig.json"
},
{ {
"path": "../engine/tsconfig.json" "path": "../engine/tsconfig.json"
} }

View File

@@ -1,5 +1,11 @@
# @rocket/engine # @rocket/engine
## 0.2.1
### Patch Changes
- 367529c: Make sure user provided content in the folder `site/public/*` wins over public folders content provided by plugins.
## 0.2.0 ## 0.2.0
### Minor Changes ### Minor Changes

View File

@@ -1,6 +1,6 @@
{ {
"name": "@rocket/engine", "name": "@rocket/engine",
"version": "0.2.0", "version": "0.2.1",
"publishConfig": { "publishConfig": {
"access": "public" "access": "public"
}, },

View File

@@ -152,12 +152,7 @@ export class Engine {
* @param {string} targetDir * @param {string} targetDir
*/ */
async copyPublicFilesTo(targetDir) { async copyPublicFilesTo(targetDir) {
// copy public files // 1. copy public files of plugins
const publicDir = path.join(this.docsDir, '..', 'public');
if (existsSync(publicDir)) {
await fse.copy(publicDir, targetDir);
}
// copy public files of plugins
if (this.options.plugins) { if (this.options.plugins) {
for (const plugin of this.options.plugins) { for (const plugin of this.options.plugins) {
// @ts-ignore // @ts-ignore
@@ -171,6 +166,12 @@ export class Engine {
} }
} }
} }
// 2. copy public files from inputDir (e.g. user public folder always wins)
const publicDir = path.join(this.docsDir, '..', 'public');
if (existsSync(publicDir)) {
await fse.copy(publicDir, targetDir);
}
} }
async start(options = {}) { async start(options = {}) {

View File

@@ -46,7 +46,8 @@ export function devServerAdjustAssetUrls({
const outputFilePath = getOutputFilePath(sourceFilePath); const outputFilePath = getOutputFilePath(sourceFilePath);
const sourceRelativeFilePath = path.relative(inputDir, sourceFilePath); const sourceRelativeFilePath = path.relative(inputDir, sourceFilePath);
const outputRelativeFilePath = path.relative(outputDir, outputFilePath); const outputRelativeFilePath = path.relative(outputDir, outputFilePath);
const newBody = await adjustAssetUrl.transform(context.body, { const body = /** @type {string} */ (context.body);
const newBody = await adjustAssetUrl.transform(body, {
sourceFilePath, sourceFilePath,
sourceRelativeFilePath, sourceRelativeFilePath,
outputFilePath, outputFilePath,

View File

@@ -4,6 +4,7 @@ import 'rehype-prism';
import '@lit-labs/ssr/lib/install-global-dom-shim.js'; import '@lit-labs/ssr/lib/install-global-dom-shim.js';
/* eslint-disable @typescript-eslint/ban-ts-comment */ /* eslint-disable @typescript-eslint/ban-ts-comment */
// @ts-ignore
import { mdjsProcess } from '@mdjs/core'; import { mdjsProcess } from '@mdjs/core';
import { existsSync } from 'fs'; import { existsSync } from 'fs';
import { readFile, writeFile } from 'fs/promises'; import { readFile, writeFile } from 'fs/promises';

View File

@@ -4,23 +4,42 @@ import { setupTestEngine } from './test-helpers.js';
const { expect } = chai; const { expect } = chai;
class MyPlugin {
static publicFolder = new URL(
'./fixtures/10-plugins/01-add-public-files/plugin-add-to-public/preset/__public',
import.meta.url,
).pathname;
}
describe('Plugins', () => { describe('Plugins', () => {
it('add plugin with custom public files', async () => { it('01: add plugin with custom public files', async () => {
class TestPlugin01 {
static publicFolder = new URL(
'./fixtures/10-plugins/01-add-public-files/plugin-add-to-public/preset/__public',
import.meta.url,
).pathname;
}
const { build, outputExists } = await setupTestEngine( const { build, outputExists } = await setupTestEngine(
'fixtures/10-plugins/01-add-public-files/docs', 'fixtures/10-plugins/01-add-public-files/docs',
{ {
setupPlugins: [addPlugin(MyPlugin)], setupPlugins: [addPlugin(TestPlugin01)],
}, },
); );
await build(); await build();
expect(outputExists('added-via-plugin.txt')).to.be.true; expect(outputExists('added-via-plugin.txt')).to.be.true;
}); });
it('02: add plugin with custom public files', async () => {
class TestPlugin02 {
static publicFolder = new URL(
'./fixtures/10-plugins/02-input-folder-public-always-wins/plugin-add-to-public/preset/__public',
import.meta.url,
).pathname;
}
const { build, readOutput } = await setupTestEngine(
'fixtures/10-plugins/02-input-folder-public-always-wins/docs',
{
setupPlugins: [addPlugin(TestPlugin02)],
},
);
await build();
expect(readOutput('added-via-plugin-and-input-public.txt')).to.equal(
'from input public folder\n',
);
});
}); });

View File

@@ -179,15 +179,16 @@ test.describe('hydration', async () => {
await cleanup(); await cleanup();
}); });
test("55: hydrate onMedia('(min-width: 640px)') || onClick", async ({ page }) => { test("55: hydrate onMedia('(min-width: 640px)') || onClick - on desktop", async ({ page }) => {
const { engine, cleanup } = await setupTestEngine( const { engine, cleanup } = await setupTestEngine(
'fixtures/14-components/55-hydration-onMedia-or-onClick/docs', 'fixtures/14-components/55-hydration-onMedia-or-onClick/docs',
); );
await engine.start(); await engine.start();
const { port } = engine.devServer.config; const { port } = engine.devServer.config;
// 1. start on small screen
await page.setViewportSize({ await page.setViewportSize({
width: 640, width: 320,
height: 480, height: 480,
}); });
await page.goto(`localhost:${port}`); await page.goto(`localhost:${port}`);
@@ -195,25 +196,40 @@ test.describe('hydration', async () => {
const hydrated1 = await myEl.getAttribute('hydrated'); const hydrated1 = await myEl.getAttribute('hydrated');
expect(hydrated1).toBe(null); // not hydrated expect(hydrated1).toBe(null); // not hydrated
// 2. go bigger
await page.setViewportSize({
width: 640,
height: 480,
});
await page.waitForLoadState('networkidle0'); await page.waitForLoadState('networkidle0');
const hydrated2 = await myEl.getAttribute('hydrated'); const hydrated2 = await myEl.getAttribute('hydrated');
expect(hydrated2).toBe(''); // boolean attribute is there expect(hydrated2).toBe(''); // boolean attribute is there
// revisit page on "mobile" await cleanup();
});
test("55b: hydrate onMedia('(min-width: 640px)') || onClick - on mobile", async ({ page }) => {
const { engine, cleanup } = await setupTestEngine(
'fixtures/14-components/55-hydration-onMedia-or-onClick/docs',
);
await engine.start();
const { port } = engine.devServer.config;
await page.setViewportSize({ await page.setViewportSize({
width: 320, width: 320,
height: 480, height: 480,
}); });
await page.reload(); await page.goto(`localhost:${port}`);
const myEl2 = await page.locator('my-el'); const myEl = await page.locator('my-el');
const hydrated3 = await myEl2.getAttribute('hydrated');
const hydrated3 = await myEl.getAttribute('hydrated');
expect(hydrated3).toBe(null); // not hydrated expect(hydrated3).toBe(null); // not hydrated
await myEl.click(); await myEl.click();
await page.waitForLoadState('networkidle0'); await page.waitForLoadState('networkidle0');
const hydrated4 = await myEl2.getAttribute('hydrated'); const hydrated4 = await myEl.getAttribute('hydrated');
expect(hydrated4).toBe(''); // boolean attribute is there expect(hydrated4).toBe(''); // boolean attribute is there
await cleanup(); await cleanup();
@@ -243,7 +259,7 @@ test.describe('hydration', async () => {
const focusInEv = await myEl.getAttribute('focusin-ev'); const focusInEv = await myEl.getAttribute('focusin-ev');
expect(focusInEv).toBe(''); expect(focusInEv).toBe('');
// NOTE: focus event is NOT supported as it does not bubble // NOTE: we are using the focusin event as the focus event is NOT supported as it does not bubble
await cleanup(); await cleanup();
}); });
}); });

View File

@@ -0,0 +1,7 @@
/* START - Rocket auto generated - do not touch */
export const sourceRelativeFilePath = 'index.rocket.js';
/* END - Rocket auto generated - do not touch */
import { html } from 'lit';
export default () => html`<p>content</p>`;

View File

@@ -0,0 +1,8 @@
{
"name": "index.rocket.js",
"menuLinkText": "index.rocket.js",
"url": "/",
"outputRelativeFilePath": "index.html",
"sourceRelativeFilePath": "index.rocket.js",
"level": 0
}

View File

@@ -14,9 +14,6 @@
"references": [ "references": [
{ {
"path": "../plugins-manager/tsconfig.json" "path": "../plugins-manager/tsconfig.json"
},
{
"path": "../mdjs-core/tsconfig.json"
} }
], ],
"include": [ "include": [

View File

@@ -15,9 +15,6 @@
{ {
"path": "../plugins-manager/tsconfig.json" "path": "../plugins-manager/tsconfig.json"
}, },
{
"path": "../mdjs-core/tsconfig.json"
},
{ {
"path": "../engine/tsconfig.json" "path": "../engine/tsconfig.json"
}, },

View File

@@ -1,5 +1,11 @@
# @mdjs/mdjs-preview # @mdjs/mdjs-preview
## 0.5.9
### Patch Changes
- ab24361: Add server folder to the published npm package
## 0.5.8 ## 0.5.8
### Patch Changes ### Patch Changes

View File

@@ -1,6 +1,6 @@
{ {
"name": "@mdjs/mdjs-preview", "name": "@mdjs/mdjs-preview",
"version": "0.5.8", "version": "0.5.9",
"publishConfig": { "publishConfig": {
"access": "public" "access": "public"
}, },
@@ -30,6 +30,7 @@
"*.js", "*.js",
"assets", "assets",
"dist-types", "dist-types",
"server",
"src" "src"
], ],
"dependencies": { "dependencies": {

View File

@@ -57,12 +57,13 @@ describe('rocket-search', () => {
expect(el.miniSearch).to.not.be.null; expect(el.miniSearch).to.not.be.null;
}); });
it('initialize the search on focus', async () => { // flaky on firefox 🤔
it.skip('initialize the search on focus', async () => {
const el = await fixture(html`<rocket-search json-url=${fixtureOneResultUrl}></rocket-search>`); const el = await fixture(html`<rocket-search json-url=${fixtureOneResultUrl}></rocket-search>`);
expect(el.miniSearch).to.be.null; expect(el.miniSearch).to.be.null;
el.focus(); el.focus();
await aTimeout(10); await aTimeout(50);
expect(el.miniSearch).to.not.be.null; expect(el.miniSearch).to.not.be.null;
}); });

View File

@@ -15,9 +15,6 @@
{ {
"path": "../plugins-manager/tsconfig.json" "path": "../plugins-manager/tsconfig.json"
}, },
{
"path": "../mdjs-core/tsconfig.json"
},
{ {
"path": "../engine/tsconfig.json" "path": "../engine/tsconfig.json"
}, },

View File

@@ -2529,6 +2529,11 @@
"text": "Simulator states", "text": "Simulator states",
"id": "simulator-states", "id": "simulator-states",
"level": 2 "level": 2
},
{
"text": "Extending mdjs-preview",
"id": "extending-mdjs-preview",
"level": 2
} }
], ],
"name": "Preview", "name": "Preview",

View File

@@ -7,9 +7,6 @@
{ {
"path": "./packages/plugins-manager/tsconfig.json" "path": "./packages/plugins-manager/tsconfig.json"
}, },
{
"path": "./packages/mdjs-core/tsconfig.json"
},
{ {
"path": "./packages/engine/tsconfig.json" "path": "./packages/engine/tsconfig.json"
}, },

View File

@@ -6,7 +6,7 @@ const packages = [
{ name: 'search', type: 'js', environment: 'node-esm' }, { name: 'search', type: 'js', environment: 'node-esm' },
// { name: 'check-html-links', type: 'js', environment: 'node-esm' }, // { name: 'check-html-links', type: 'js', environment: 'node-esm' },
// { name: 'drawer', type: 'js', environment: 'browser' }, // { name: 'drawer', type: 'js', environment: 'browser' },
{ name: 'mdjs-core', type: 'js', environment: 'node' }, // { name: 'mdjs-core', type: 'js', environment: 'node' },
// { name: 'mdjs-preview', type: 'js', environment: 'browser' }, // { name: 'mdjs-preview', type: 'js', environment: 'browser' },
// { name: 'mdjs-story', type: 'js', environment: 'browser' }, // { name: 'mdjs-story', type: 'js', environment: 'browser' },
]; ];

6018
yarn.lock

File diff suppressed because it is too large Load Diff