mirror of
https://github.com/modernweb-dev/rocket.git
synced 2026-03-21 15:54:57 +00:00
Compare commits
7 Commits
@mdjs/mdjs
...
@rocket/en
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2555a8698d | ||
|
|
367529c211 | ||
|
|
ce3298d218 | ||
|
|
a22da493dd | ||
|
|
7a8f165625 | ||
|
|
c8081071f7 | ||
|
|
ab2436162c |
@@ -2,15 +2,15 @@
|
||||
|
||||
<p align="center">
|
||||
<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">
|
||||
<img alt="Rocket Logo" src="https://raw.githubusercontent.com/modernweb-dev/rocket/next/site/src/assets/rocket-logo-light-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/main/site/src/assets/rocket-logo-light-with-text.svg">
|
||||
</picture>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/modernweb-dev/rocket/actions"
|
||||
><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"
|
||||
/></a>
|
||||
<a href="https://twitter.com/modern_web_dev"
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @rocket/building-rollup
|
||||
|
||||
## 0.4.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- a22da49: Make sure user provided `developmentMode` actually gets applied.
|
||||
|
||||
## 0.4.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@rocket/building-rollup",
|
||||
"version": "0.4.0",
|
||||
"version": "0.4.1",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
|
||||
@@ -13,7 +13,7 @@ export function createBasicConfig(userConfig) {
|
||||
|
||||
export function createBasicMetaConfig(userConfig = { output: {} }) {
|
||||
const developmentMode =
|
||||
typeof userConfig.developmentMode !== undefined
|
||||
typeof userConfig.developmentMode !== 'undefined'
|
||||
? userConfig.developmentMode
|
||||
: !!process.env.ROLLUP_WATCH;
|
||||
delete userConfig.developmentMode;
|
||||
|
||||
@@ -14,7 +14,7 @@ export function createServiceWorkerConfig(userConfig) {
|
||||
|
||||
export function createServiceWorkerMetaConfig(userConfig = { output: {} }) {
|
||||
const developmentMode =
|
||||
typeof userConfig.developmentMode !== undefined
|
||||
typeof userConfig.developmentMode !== 'undefined'
|
||||
? userConfig.developmentMode
|
||||
: !!process.env.ROLLUP_WATCH;
|
||||
delete userConfig.developmentMode;
|
||||
|
||||
@@ -15,9 +15,6 @@
|
||||
{
|
||||
"path": "../plugins-manager/tsconfig.json"
|
||||
},
|
||||
{
|
||||
"path": "../mdjs-core/tsconfig.json"
|
||||
},
|
||||
{
|
||||
"path": "../engine/tsconfig.json"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @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
|
||||
|
||||
### Minor Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@rocket/engine",
|
||||
"version": "0.2.0",
|
||||
"version": "0.2.1",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
|
||||
@@ -152,12 +152,7 @@ export class Engine {
|
||||
* @param {string} targetDir
|
||||
*/
|
||||
async copyPublicFilesTo(targetDir) {
|
||||
// copy public files
|
||||
const publicDir = path.join(this.docsDir, '..', 'public');
|
||||
if (existsSync(publicDir)) {
|
||||
await fse.copy(publicDir, targetDir);
|
||||
}
|
||||
// copy public files of plugins
|
||||
// 1. copy public files of plugins
|
||||
if (this.options.plugins) {
|
||||
for (const plugin of this.options.plugins) {
|
||||
// @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 = {}) {
|
||||
|
||||
@@ -46,7 +46,8 @@ export function devServerAdjustAssetUrls({
|
||||
const outputFilePath = getOutputFilePath(sourceFilePath);
|
||||
const sourceRelativeFilePath = path.relative(inputDir, sourceFilePath);
|
||||
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,
|
||||
sourceRelativeFilePath,
|
||||
outputFilePath,
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'rehype-prism';
|
||||
import '@lit-labs/ssr/lib/install-global-dom-shim.js';
|
||||
|
||||
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
||||
// @ts-ignore
|
||||
import { mdjsProcess } from '@mdjs/core';
|
||||
import { existsSync } from 'fs';
|
||||
import { readFile, writeFile } from 'fs/promises';
|
||||
|
||||
@@ -4,23 +4,42 @@ import { setupTestEngine } from './test-helpers.js';
|
||||
|
||||
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', () => {
|
||||
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(
|
||||
'fixtures/10-plugins/01-add-public-files/docs',
|
||||
{
|
||||
setupPlugins: [addPlugin(MyPlugin)],
|
||||
setupPlugins: [addPlugin(TestPlugin01)],
|
||||
},
|
||||
);
|
||||
await build();
|
||||
|
||||
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',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -179,15 +179,16 @@ test.describe('hydration', async () => {
|
||||
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(
|
||||
'fixtures/14-components/55-hydration-onMedia-or-onClick/docs',
|
||||
);
|
||||
await engine.start();
|
||||
const { port } = engine.devServer.config;
|
||||
|
||||
// 1. start on small screen
|
||||
await page.setViewportSize({
|
||||
width: 640,
|
||||
width: 320,
|
||||
height: 480,
|
||||
});
|
||||
await page.goto(`localhost:${port}`);
|
||||
@@ -195,25 +196,40 @@ test.describe('hydration', async () => {
|
||||
const hydrated1 = await myEl.getAttribute('hydrated');
|
||||
expect(hydrated1).toBe(null); // not hydrated
|
||||
|
||||
// 2. go bigger
|
||||
await page.setViewportSize({
|
||||
width: 640,
|
||||
height: 480,
|
||||
});
|
||||
await page.waitForLoadState('networkidle0');
|
||||
|
||||
const hydrated2 = await myEl.getAttribute('hydrated');
|
||||
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({
|
||||
width: 320,
|
||||
height: 480,
|
||||
});
|
||||
await page.reload();
|
||||
const myEl2 = await page.locator('my-el');
|
||||
const hydrated3 = await myEl2.getAttribute('hydrated');
|
||||
await page.goto(`localhost:${port}`);
|
||||
const myEl = await page.locator('my-el');
|
||||
|
||||
const hydrated3 = await myEl.getAttribute('hydrated');
|
||||
expect(hydrated3).toBe(null); // not hydrated
|
||||
|
||||
await myEl.click();
|
||||
await page.waitForLoadState('networkidle0');
|
||||
|
||||
const hydrated4 = await myEl2.getAttribute('hydrated');
|
||||
const hydrated4 = await myEl.getAttribute('hydrated');
|
||||
expect(hydrated4).toBe(''); // boolean attribute is there
|
||||
|
||||
await cleanup();
|
||||
@@ -243,7 +259,7 @@ test.describe('hydration', async () => {
|
||||
const focusInEv = await myEl.getAttribute('focusin-ev');
|
||||
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();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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>`;
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "index.rocket.js",
|
||||
"menuLinkText": "index.rocket.js",
|
||||
"url": "/",
|
||||
"outputRelativeFilePath": "index.html",
|
||||
"sourceRelativeFilePath": "index.rocket.js",
|
||||
"level": 0
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
from plugin
|
||||
@@ -0,0 +1 @@
|
||||
from input public folder
|
||||
@@ -14,9 +14,6 @@
|
||||
"references": [
|
||||
{
|
||||
"path": "../plugins-manager/tsconfig.json"
|
||||
},
|
||||
{
|
||||
"path": "../mdjs-core/tsconfig.json"
|
||||
}
|
||||
],
|
||||
"include": [
|
||||
|
||||
@@ -15,9 +15,6 @@
|
||||
{
|
||||
"path": "../plugins-manager/tsconfig.json"
|
||||
},
|
||||
{
|
||||
"path": "../mdjs-core/tsconfig.json"
|
||||
},
|
||||
{
|
||||
"path": "../engine/tsconfig.json"
|
||||
},
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @mdjs/mdjs-preview
|
||||
|
||||
## 0.5.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- ab24361: Add server folder to the published npm package
|
||||
|
||||
## 0.5.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@mdjs/mdjs-preview",
|
||||
"version": "0.5.8",
|
||||
"version": "0.5.9",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
@@ -30,6 +30,7 @@
|
||||
"*.js",
|
||||
"assets",
|
||||
"dist-types",
|
||||
"server",
|
||||
"src"
|
||||
],
|
||||
"dependencies": {
|
||||
|
||||
@@ -57,12 +57,13 @@ describe('rocket-search', () => {
|
||||
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>`);
|
||||
expect(el.miniSearch).to.be.null;
|
||||
|
||||
el.focus();
|
||||
await aTimeout(10);
|
||||
await aTimeout(50);
|
||||
expect(el.miniSearch).to.not.be.null;
|
||||
});
|
||||
|
||||
|
||||
@@ -15,9 +15,6 @@
|
||||
{
|
||||
"path": "../plugins-manager/tsconfig.json"
|
||||
},
|
||||
{
|
||||
"path": "../mdjs-core/tsconfig.json"
|
||||
},
|
||||
{
|
||||
"path": "../engine/tsconfig.json"
|
||||
},
|
||||
|
||||
@@ -2529,6 +2529,11 @@
|
||||
"text": "Simulator states",
|
||||
"id": "simulator-states",
|
||||
"level": 2
|
||||
},
|
||||
{
|
||||
"text": "Extending mdjs-preview",
|
||||
"id": "extending-mdjs-preview",
|
||||
"level": 2
|
||||
}
|
||||
],
|
||||
"name": "Preview",
|
||||
|
||||
@@ -7,9 +7,6 @@
|
||||
{
|
||||
"path": "./packages/plugins-manager/tsconfig.json"
|
||||
},
|
||||
{
|
||||
"path": "./packages/mdjs-core/tsconfig.json"
|
||||
},
|
||||
{
|
||||
"path": "./packages/engine/tsconfig.json"
|
||||
},
|
||||
|
||||
@@ -6,7 +6,7 @@ const packages = [
|
||||
{ name: 'search', type: 'js', environment: 'node-esm' },
|
||||
// { name: 'check-html-links', type: 'js', environment: 'node-esm' },
|
||||
// { 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-story', type: 'js', environment: 'browser' },
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user