Compare commits

...

13 Commits

Author SHA1 Message Date
github-actions[bot]
754705423f Version Packages 2023-06-27 17:49:38 +02:00
Thomas Allmer
74b2b35812 feat(building-rollup): update to rollup v3 + v3 plugins 2023-06-27 17:46:06 +02:00
Nathan Brown
685e6fd9b4 fix(building-rollup): resolve json5 security vulnerability 2023-06-08 22:03:57 +02:00
Thomas Allmer
ecfa631367 chore: add patch file for @web/dev-server 2022-10-31 22:14:42 +01:00
Thomas Allmer
80ff4be34a feat: setup wireit and use it for the types generation 2022-10-31 22:14:42 +01:00
Thomas Allmer
3fd736c213 chore: update lock files 2022-10-28 21:43:56 +02:00
Thomas Allmer
f3cc3b8050 chore: update to typescript 4.8.4 2022-10-28 21:22:06 +02:00
Thomas Allmer
a049a82141 chore: use npm workspaces 2022-10-28 15:45:00 +02:00
Davie
a868ff13e4 Update 80--hydration.rocket.md
Grammar edit from none to non-chromium browser(s)
2022-10-12 23:06:34 +02:00
github-actions[bot]
5f4a86b1a8 Version Packages 2022-10-06 10:05:15 +02:00
Thomas Allmer
79e6f0df33 Create tame-tigers-marry.md 2022-10-06 09:32:19 +02:00
Matsu
04621c3f16 Update the error message on degit action 2022-10-06 09:32:19 +02:00
Nathan Brown
1cd9508384 docs: site cleanup
Remove extraneous words and correct misphrasings.
2022-09-10 10:34:13 +02:00
140 changed files with 27971 additions and 9245 deletions

View File

@@ -13,6 +13,10 @@ __output-dev
docs/_merged*
*-mdjs-generated.js
*-converted-md-source.js
*-converted-md.js
__example_site-for-check-website
# sanity example has a separate backend that is unrelated to Rocket
# therefore it does not need to follow it code rules

View File

@@ -12,45 +12,29 @@ jobs:
name: Release
runs-on: ubuntu-latest
steps:
- uses: google/wireit@setup-github-actions-caching/v1
- name: Checkout Repo
uses: actions/checkout@master
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0
- name: Setup Node.js 14.x
- name: Setup Node.js 18.x
uses: actions/setup-node@master
with:
node-version: 14.x
node-version: 18.x
registry-url: 'https://registry.npmjs.org'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependencies
run: yarn --frozen-lockfile
- name: Build Packages
run: yarn build:packages
- name: Build Types
run: yarn types
run: npm ci
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@master
with:
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: yarn release
publish: npm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

View File

@@ -8,8 +8,9 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
node-version: [18.x]
steps:
- uses: google/wireit@setup-github-actions-caching/v1
- uses: actions/checkout@v2
- name: Setup Node ${{ matrix.node-version }}
@@ -17,20 +18,8 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn --frozen-lockfile
run: npm ci
- name: Install Playwright dependencies
run: npx playwright install-deps
@@ -38,40 +27,8 @@ jobs:
- name: Install Playwright
run: npx playwright install
- name: Build Packages
run: yarn build:packages
- name: Lint
run: yarn lint
run: npm run lint
- name: Test
run: yarn test
# verify-windows:
# name: Verify windows
# runs-on: windows-latest
# steps:
# - uses: actions/checkout@v2
# - name: Setup Node 12.x
# uses: actions/setup-node@v1
# with:
# node-version: 12.x
# - name: Get yarn cache directory path
# id: yarn-cache-dir-path
# run: echo "::set-output name=dir::$(yarn cache dir)"
# - uses: actions/cache@v2
# id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
# with:
# path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
# key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
# restore-keys: |
# ${{ runner.os }}-yarn-
# - name: Install dependencies
# run: yarn --frozen-lockfile
# - name: Test
# run: yarn test
run: npm run test

8
.gitignore vendored
View File

@@ -12,21 +12,16 @@ coverage/
## npm
node_modules
npm-debug.log
yarn-error.log
## temp folders
/.tmp/
## we prefer yarn.lock
package-lock.json
## lock files in packages we do not need to save
packages/*/yarn.lock
## build output
dist
dist-types
stats.html
*.tsbuildinfo
.wireit
# Rocket Search
rocket-search-index.json
@@ -49,3 +44,4 @@ docs_backup
## Local playground
examples/testing
__example_site-for-check-website

View File

@@ -8,5 +8,5 @@
"**/*-mdjs-generated.js": true,
"**/dist-types": true,
},
"editor.experimental.stickyScroll.enabled": true
"editor.stickyScroll.enabled": true
}

View File

@@ -32,10 +32,10 @@ git checkout -b my-awesome-fix
## Preparing Your Local Environment for Development
Now that you have cloned the repository, ensure you have [yarn](https://classic.yarnpkg.com/lang/en/) installed, then run the following commands to set up the development environment.
Now that you have cloned the repository, ensure you have [node](https://nodejs.org/) installed, then run the following commands to set up the development environment.
```shell
yarn install
npm install
```
This will download and install all packages needed.
@@ -50,7 +50,7 @@ If you're making cross-package changes, you need to compile the TypeScript code.
### Running Tests
To run the tests of a package, it's recommended to `cd` into the package directory and then using `yarn test` to run them. This way you're only running tests of that specific package.
To run the tests of a package, it's recommended to `cd` into the package directory and then using `npm run test` to run them. This way you're only running tests of that specific package.
### Integration Testing
@@ -58,7 +58,7 @@ To see how your changes integrate with everything together you can use the `test
## Adding New Packages
For all projects the tsconfig/jsconfig configuration files are auto generated. You need to add an entry to the [./workspace-packages.ts](./workspace-packages.ts) to let it generate a config for you. After adding an entry, run `yarn update-package-configs` to generate the files for you.
For all projects the tsconfig/jsconfig configuration files are auto generated. You need to add an entry to the [./workspace-packages.ts](./workspace-packages.ts) to let it generate a config for you. After adding an entry, run `npm run update-package-configs` to generate the files for you.
## Creating a Changeset
@@ -70,7 +70,7 @@ This documents your intent to release, and allows you to specify a message that
Run
```shell
yarn changeset
npm run changeset
```
And use the menu to select for which packages you need a release, and then select what kind of release. For the release type, we follow [Semantic Versioning](https://semver.org/), so please take a look if you're unfamiliar.

View File

@@ -3,8 +3,6 @@ node_modules/
# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# environment variables
.env

View File

@@ -11,7 +11,7 @@
"start": "NODE_DEBUG=engine:rendering rocket start --open"
},
"devDependencies": {
"@rocket/cli": "^0.20.0",
"@rocket/cli": "^0.21.0",
"@rocket/engine": "^0.2.0",
"@webcomponents/template-shadowroot": "^0.1.0",
"lit": "^2.3.0"

View File

@@ -3,8 +3,6 @@ node_modules/
# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# environment variables
.env

View File

@@ -16,7 +16,7 @@
"start": "NODE_DEBUG=engine:rendering rocket start --open"
},
"devDependencies": {
"@rocket/cli": "^0.20.0",
"@rocket/cli": "^0.21.0",
"@rocket/engine": "^0.2.0",
"lit": "^2.3.0"
},

View File

@@ -3,8 +3,6 @@ node_modules/
# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# environment variables
.env

View File

@@ -11,7 +11,7 @@
"start": "NODE_DEBUG=engine:rendering rocket start --open"
},
"devDependencies": {
"@rocket/cli": "^0.20.0",
"@rocket/cli": "^0.21.0",
"@rocket/engine": "^0.2.0",
"lit": "^2.3.0"
},

View File

@@ -1,4 +1,2 @@
/dist
/node_modules
yarn.lock

View File

@@ -3,7 +3,6 @@
"private": true,
"version": "1.0.0",
"description": "",
"main": "package.json",
"author": "Jaydan Urwin <jaydan@jaydanurwin.com>",
"license": "UNLICENSED",
"scripts": {

View File

@@ -3,8 +3,6 @@ node_modules/
# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# environment variables
.env

View File

@@ -3,8 +3,6 @@ node_modules/
# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# environment variables
.env

View File

@@ -11,7 +11,7 @@
"start": "NODE_DEBUG=engine:rendering rocket start --open"
},
"devDependencies": {
"@rocket/cli": "^0.20.0",
"@rocket/cli": "^0.21.0",
"@rocket/components": "^0.2.0",
"@rocket/engine": "^0.2.0",
"@rocket/spark": "^0.2.0",

View File

@@ -3,8 +3,6 @@ node_modules/
# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# environment variables
.env

View File

@@ -11,9 +11,9 @@
"start": "NODE_DEBUG=engine:rendering rocket start --open"
},
"devDependencies": {
"@rocket/cli": "^0.20.0",
"@rocket/cli": "^0.21.0",
"@rocket/engine": "^0.2.0",
"@rocket/launch": "^0.21.0",
"@rocket/launch": "^0.21.4",
"@rocket/search": "^0.7.0",
"lit": "^2.3.0"
},

27216
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -10,8 +10,7 @@
"scripts": {
"analyze": "run-s analyze:* format:*",
"analyze:analyze": "node scripts/workspaces-scripts-bin.mjs analyze",
"build": "npm run build:packages && npm run rocket:build",
"build:packages": "node scripts/workspaces-scripts-bin.mjs build:package",
"build": "npm run rocket:build",
"build:site": "run-s analyze:* rocket:build",
"changeset": "changeset",
"debug": "web-test-runner --watch --config web-test-runner-chrome.config.mjs",
@@ -25,40 +24,34 @@
"lint:prettier": "node node_modules/prettier/bin-prettier.js \"**/*.{ts,js,mjs,cjs,md}\" --check --ignore-path .eslintignore",
"lint:types": "npm run types",
"lint:versions": "node scripts/lint-versions.js",
"postinstall": "npm run setup",
"release": "changeset publish && yarn format",
"postinstall": "npx patch-package",
"preview": "node packages/cli/src/cli.js preview --open",
"release": "changeset publish && npm run format",
"rocket:build": "NODE_DEBUG=engine:rendering node --trace-warnings packages/cli/src/cli.js build",
"rocket:upgrade": "node packages/cli/src/cli.js upgrade",
"search": "node packages/cli/src/cli.js search",
"setup": "npm run setup:ts-configs",
"setup:patches": "npx patch-package",
"setup:ts-configs": "node scripts/generate-ts-configs.mjs",
"start:experimental": "NODE_DEBUG=engine:rendering node --no-warnings --experimental-loader ./packages/engine/src/litCssLoader.js packages/cli/src/cli.js start --open",
"start": "NODE_DEBUG=engine:rendering node --trace-warnings packages/cli/src/cli.js start --open",
"preview": "node packages/cli/src/cli.js preview --open",
"test": "yarn test:node && yarn test:web",
"start:experimental": "NODE_DEBUG=engine:rendering node --no-warnings --experimental-loader ./packages/engine/src/litCssLoader.js packages/cli/src/cli.js start --open",
"test": "npm run test:node && npm run test:web",
"test:integration": "playwright test packages/*/test-node/*.spec.js --retries=3",
"test:node": "yarn test:unit && yarn test:integration",
"test:node": "npm run test:unit && npm run test:integration",
"test:unit": "node --trace-warnings ./node_modules/.bin/mocha --require ./scripts/testMochaGlobalHooks.js \"packages/*/test-node/**/*.test.{ts,js,mjs,cjs}\" -- --timeout 8000 --reporter dot --exit",
"test:web": "web-test-runner",
"types": "run-s types:clear types:copy types:build",
"types:build": "tsc --build",
"types:clear": "rimraf packages/*/dist-types/",
"types:copy": "node scripts/workspaces-scripts-bin.mjs types:copy",
"types": "npm run types --workspaces --if-present",
"update-dependency": "node scripts/update-dependency.js",
"update-esm-entrypoints": "node scripts/update-esm-entrypoints.mjs && yarn format",
"update-package-configs": "node scripts/update-package-configs.mjs && yarn format",
"xprestart": "yarn analyze"
"update-esm-entrypoints": "node scripts/update-esm-entrypoints.mjs && npm run format",
"update-package-configs": "node scripts/update-package-configs.mjs && npm run format",
"xprestart": "npm run analyze"
},
"dependencies": {},
"devDependencies": {
"@changesets/cli": "^2.20.0",
"@custom-elements-manifest/analyzer": "^0.4.12",
"@playwright/test": "^1.18.1",
"@open-wc/testing": "^3.1.2",
"@rollup/plugin-commonjs": "^17.0.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-typescript": "^8.1.0",
"@playwright/test": "^1.18.1",
"@rollup/plugin-commonjs": "^25.0.0",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-terser": "^0.4.0",
"@rollup/plugin-typescript": "^11.1.0",
"@types/chai": "^4.2.14",
"@types/fs-extra": "^9.0.6",
"@types/mocha": "^9.0.0",
@@ -90,11 +83,11 @@
"puppeteer": "^13.0.0",
"remark-emoji": "^2.1.0",
"rimraf": "^3.0.2",
"rollup": "^2.36.1",
"rollup-plugin-terser": "^7.0.2",
"rollup": "^3.0.0",
"sinon": "^9.2.3",
"ts-node": "^9.1.1",
"typescript": "^4.6.3"
"typescript": "^4.8.4",
"wireit": "^0.7.2"
},
"eslintConfig": {
"parser": "@typescript-eslint/parser",
@@ -118,7 +111,8 @@
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-empty-interface": "off",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/no-var-requires": "off"
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/ban-ts-comment": "off"
}
},
"husky": {

View File

@@ -1,5 +1,15 @@
# @rocket/building-rollup
## 0.5.0
### Minor Changes
- 74b2b35: Update to Rollup v3 + all plugins that require it
### Patch Changes
- 685e6fd: fix json5 security vulnerability
## 0.4.1
### Patch Changes

View File

@@ -1,12 +0,0 @@
// /**
// * @typedef {import('./src/types').BasicOptions} BasicOptions
// * @typedef {import('./src/types').SpaOptions} SpaOptions
// */
export { createBasicConfig, createBasicMetaConfig } from './src/createBasicConfig.js';
export { createSpaConfig, createSpaMetaConfig } from './src/createSpaConfig.js';
export { createMpaConfig, createMpaMetaConfig } from './src/createMpaConfig.js';
export {
createServiceWorkerConfig,
createServiceWorkerMetaConfig,
} from './src/createServiceWorkerConfig.js';

View File

@@ -1,6 +1,6 @@
{
"name": "@rocket/building-rollup",
"version": "0.4.1",
"version": "0.5.0",
"publishConfig": {
"access": "public"
},
@@ -13,10 +13,12 @@
},
"author": "Modern Web <hello@modern-web.dev> (https://modern-web.dev/)",
"homepage": "https://rocket.modern-web.dev/docs/tools/building-rollup/",
"main": "./index.js",
"type": "module",
"exports": {
".": "./index.js"
".": {
"types": "./dist-types/src/index.d.ts",
"default": "./src/index.js"
}
},
"scripts": {
"build:babelrc": "rimraf dist && rollup -c demo/babelrc/rollup.config.js",
@@ -27,6 +29,7 @@
"build:spa-js-input": "rimraf dist && rollup -c demo/js/rollup.spa-js-input.config.js",
"build:spa-nomodule": "rimraf dist && rollup -c demo/js/rollup.spa-nomodule.config.js",
"build:ts": "rimraf dist && rollup -c demo/ts/rollup.spa.config.js",
"prepublishOnly": "npm run types",
"start:babelrc": "npm run build:babelrc && npm run start:build",
"start:build": "web-dev-server --root-dir dist --compatibility none --open",
"start:cjs": "npm run build:cjs && npm run start:build",
@@ -38,33 +41,52 @@
"start:ts": "npm run build:ts && npm run start:build",
"start:watch": "npm run build:spa-nomodule -- --watch & npm run start:build",
"test": "npm run test:node",
"test:node": "mocha test-node/**/*.test.js --timeout 5000"
"test:node": "mocha test-node/**/*.test.js --timeout 5000",
"types": "wireit"
},
"files": [
"*.js",
"dist-types",
"src"
],
"keywords": [
"rollup"
],
"peerDependencies": {
"rollup": "^2.35.0"
"rollup": "^3.0.0"
},
"dependencies": {
"@babel/core": "^7.12.10",
"@babel/core": "^7.20.12",
"@babel/preset-env": "^7.12.11",
"@rollup/plugin-babel": "^5.2.2",
"@rollup/plugin-node-resolve": "^11.0.1",
"@rollup/plugin-replace": "^2.4.2",
"@web/rollup-plugin-html": "^1.8.0",
"@web/rollup-plugin-import-meta-assets": "^1.0.4",
"@web/rollup-plugin-polyfills-loader": "^1.1.0",
"@rollup/plugin-babel": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.1",
"@rollup/plugin-replace": "^5.0.1",
"@rollup/plugin-terser": "^0.4.0",
"@web/rollup-plugin-html": "^2.0.0",
"@web/rollup-plugin-import-meta-assets": "^2.0.0",
"@web/rollup-plugin-polyfills-loader": "^2.0.0",
"browserslist": "^4.16.1",
"rollup-plugin-terser": "^7.0.2",
"plugins-manager": "^0.3.1",
"workbox-broadcast-update": "^6.1.5",
"workbox-cacheable-response": "^6.1.5",
"workbox-expiration": "^6.1.5",
"workbox-routing": "^6.1.5",
"workbox-strategies": "^6.1.5"
},
"wireit": {
"types": {
"command": "copyfiles \"./types/**/*.d.ts\" dist-types/ && tsc --build --pretty",
"dependencies": [
"../plugins-manager:types"
],
"clean": "if-file-deleted",
"files": [
"src/**/*.js",
"tsconfig.json"
],
"output": [
"dist-types/**",
".tsbuildinfo"
]
}
}
}

View File

@@ -1,16 +1,22 @@
import resolve from '@rollup/plugin-node-resolve';
import { terser } from 'rollup-plugin-terser';
import babelPkg from '@rollup/plugin-babel';
import terser from '@rollup/plugin-terser';
import { babel } from '@rollup/plugin-babel';
import { applyPlugins } from 'plugins-manager';
const { babel } = babelPkg;
/** @typedef {import('../types/main.js').BuildingRollupOptions} BuildingRollupOptions */
/**
* @param {BuildingRollupOptions} [userConfig]
*/
export function createBasicConfig(userConfig) {
const { config, metaPlugins } = createBasicMetaConfig(userConfig);
return applyPlugins(config, metaPlugins);
}
/**
* @param {BuildingRollupOptions} [userConfig]
*/
export function createBasicMetaConfig(userConfig = { output: {} }) {
const developmentMode =
typeof userConfig.developmentMode !== 'undefined'
@@ -37,8 +43,12 @@ export function createBasicMetaConfig(userConfig = { output: {} }) {
},
};
/**
* @type {import('plugins-manager').MetaPlugin<any>[]}
*/
let metaPlugins = [
{
// @ts-ignore
plugin: resolve,
options: {
moduleDirectories: ['node_modules', 'web_modules'],
@@ -71,7 +81,9 @@ export function createBasicMetaConfig(userConfig = { output: {} }) {
},
},
{
// @ts-ignore
plugin: terser,
options: {},
},
];

View File

@@ -1,7 +1,13 @@
import { createSpaMetaConfig } from './createSpaConfig.js';
import { adjustPluginOptions, applyPlugins } from 'plugins-manager';
// @ts-ignore
import { rollupPluginHTML } from '@web/rollup-plugin-html';
/** @typedef {import('../types/main.js').BuildingRollupOptions} BuildingRollupOptions */
/**
* @param {BuildingRollupOptions} [userConfig]
*/
export function createMpaConfig(userConfig) {
const { config, metaPlugins } = createMpaMetaConfig(userConfig);
@@ -9,6 +15,9 @@ export function createMpaConfig(userConfig) {
return final;
}
/**
* @param {BuildingRollupOptions} userConfig
*/
export function createMpaMetaConfig(userConfig = { output: {}, setupPlugins: [] }) {
const { config, metaPlugins } = createSpaMetaConfig(userConfig);

View File

@@ -1,17 +1,23 @@
import resolve from '@rollup/plugin-node-resolve';
import { terser } from 'rollup-plugin-terser';
import babelPkg from '@rollup/plugin-babel';
import terser from '@rollup/plugin-terser';
import { babel } from '@rollup/plugin-babel';
import replace from '@rollup/plugin-replace';
import { applyPlugins } from 'plugins-manager';
const { babel } = babelPkg;
/** @typedef {import('../types/main.js').BuildingRollupOptions} BuildingRollupOptions */
/**
* @param {BuildingRollupOptions} userConfig
*/
export function createServiceWorkerConfig(userConfig) {
const { config, metaPlugins } = createServiceWorkerMetaConfig(userConfig);
return applyPlugins(config, metaPlugins);
}
/**
* @param {BuildingRollupOptions} userConfig
*/
export function createServiceWorkerMetaConfig(userConfig = { output: {} }) {
const developmentMode =
typeof userConfig.developmentMode !== 'undefined'
@@ -31,14 +37,19 @@ export function createServiceWorkerMetaConfig(userConfig = { output: {} }) {
},
};
/**
* @type {import('plugins-manager').MetaPlugin<any>[]}
*/
let metaPlugins = [
{
// @ts-ignore
plugin: resolve,
options: {
moduleDirectories: ['node_modules', 'web_modules'],
},
},
{
// @ts-ignore
plugin: replace,
options: {
'process.env.NODE_ENV': JSON.stringify(developmentMode ? 'development' : 'production'),
@@ -72,6 +83,7 @@ export function createServiceWorkerMetaConfig(userConfig = { output: {} }) {
},
},
{
// @ts-ignore
plugin: terser,
options: {
mangle: {

View File

@@ -1,15 +1,26 @@
// @ts-ignore
import { rollupPluginHTML } from '@web/rollup-plugin-html';
// @ts-ignore
import { importMetaAssets } from '@web/rollup-plugin-import-meta-assets';
// @ts-ignore
import { polyfillsLoader } from '@web/rollup-plugin-polyfills-loader';
import { applyPlugins } from 'plugins-manager';
import { createBasicMetaConfig } from './createBasicConfig.js';
/** @typedef {import('../types/main.js').BuildingRollupOptions} BuildingRollupOptions */
/**
* @param {BuildingRollupOptions} [userConfig]
*/
export function createSpaConfig(userConfig) {
const { config, metaPlugins } = createSpaMetaConfig(userConfig);
return applyPlugins(config, metaPlugins);
}
/**
* @param {BuildingRollupOptions} userConfig
*/
export function createSpaMetaConfig(userConfig = { output: {} }) {
const { config, metaPlugins, developmentMode } = createBasicMetaConfig(userConfig);
@@ -27,8 +38,13 @@ export function createSpaMetaConfig(userConfig = { output: {} }) {
}
delete config.absoluteBaseUrl;
/**
* @type {import('plugins-manager').MetaPlugin<any>[]}
*/
const spaMetaPlugins = [
// @ts-ignore
...metaPlugins,
// @ts-ignore
{
plugin: rollupPluginHTML,
options: {
@@ -36,9 +52,11 @@ export function createSpaMetaConfig(userConfig = { output: {} }) {
absoluteBaseUrl,
},
},
// @ts-ignore
{
plugin: importMetaAssets,
},
// @ts-ignore
{
plugin: polyfillsLoader,
options: {

View File

@@ -0,0 +1,11 @@
/**
* @typedef {import('../types/main.js').BuildingRollupOptions} BuildingRollupOptions
*/
export { createBasicConfig, createBasicMetaConfig } from './createBasicConfig.js';
export { createSpaConfig, createSpaMetaConfig } from './createSpaConfig.js';
export { createMpaConfig, createMpaMetaConfig } from './createMpaConfig.js';
export {
createServiceWorkerConfig,
createServiceWorkerMetaConfig,
} from './createServiceWorkerConfig.js';

View File

@@ -1,6 +1,6 @@
import chai from 'chai';
import path from 'path';
import fs from 'fs';
import { readFile } from 'fs/promises';
import { fileURLToPath } from 'url';
import { rollup } from 'rollup';
@@ -8,7 +8,7 @@ const { expect } = chai;
const __dirname = path.dirname(fileURLToPath(import.meta.url));
/**
* @param {object} config
* @param {import('@rocket/building-rollup').BuildingRollupOptions} config
*/
async function buildAndWrite(config) {
const bundle = await rollup(config);
@@ -16,21 +16,27 @@ async function buildAndWrite(config) {
if (Array.isArray(config.output)) {
await bundle.write(config.output[0]);
await bundle.write(config.output[1]);
} else {
} else if (config.output) {
await bundle.write(config.output);
}
}
/**
* @param {string} configString
* @returns
*/
async function execute(configString) {
const configPath = path.join(__dirname, 'fixtures', configString.split('/').join(path.sep));
const config = (await import(configPath)).default;
await buildAndWrite(config);
/**
* @param {string} fileName
*/
return async (fileName, { stripToBody = false, stripStartEndWhitespace = true } = {}) => {
let text = await fs.promises.readFile(
path.join(config.output.dir, fileName.split('/').join(path.sep)),
);
text = text.toString();
let text = (
await readFile(path.join(config.output.dir, fileName.split('/').join(path.sep)))
).toString();
if (stripToBody) {
const bodyOpenTagEnd = text.indexOf('>', text.indexOf('<body') + 1) + 1;
const bodyCloseTagStart = text.indexOf('</body>');

View File

@@ -1,10 +1,11 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import puppeteer from 'puppeteer';
import chai from 'chai';
import path from 'path';
import fs from 'fs';
// @ts-ignore
import rimraf from 'rimraf';
import { rollup } from 'rollup';
// @ts-ignore
import { startDevServer } from '@web/dev-server';
import { fileURLToPath } from 'url';
@@ -14,6 +15,7 @@ const rootDir = path.resolve(__dirname, '..', 'dist');
const { expect } = chai;
describe('spa integration tests', () => {
// @ts-ignore
let server;
/** @type {import('puppeteer').Browser} */
let browser;
@@ -27,6 +29,7 @@ describe('spa integration tests', () => {
readCliArgs: false,
readFileConfig: false,
logStartMessage: false,
// @ts-ignore
clearTerminalOnReload: false,
});
browser = await puppeteer.launch();
@@ -35,6 +38,7 @@ describe('spa integration tests', () => {
after(async () => {
await browser.close();
// @ts-ignore
await server.stop();
});
@@ -45,6 +49,7 @@ describe('spa integration tests', () => {
].forEach(testCase => {
describe(`testcase ${testCase}`, function describe() {
this.timeout(30000);
// @ts-ignore
let page;
before(async () => {

View File

@@ -0,0 +1,15 @@
{
"extends": "../../tsconfig.node-base.json",
"compilerOptions": {
"module": "ESNext",
"outDir": "./dist-types",
"rootDir": ".",
"composite": true,
"allowJs": true,
"checkJs": true,
"emitDeclarationOnly": true,
"moduleResolution": "NodeNext"
},
"include": ["src", "types", "test-node"],
"exclude": ["dist-types"]
}

View File

@@ -0,0 +1,8 @@
import { RollupOptions } from 'rollup';
interface BuildingRollupOptions extends RollupOptions {
developmentMode?: boolean;
rootDir?: string;
absoluteBaseUrl?: string;
setupPlugins?: function[];
}

View File

@@ -1,5 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
/** @typedef {import('../types/main').CheckHtmlLinksCliOptions} CheckHtmlLinksCliOptions */
import path from 'path';

View File

@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import fs from 'fs';
import saxWasm from 'sax-wasm';
import minimatch from 'minimatch';

View File

@@ -1,5 +1,17 @@
# @rocket/cli
## 0.21.0
### Minor Changes
- 74b2b35: Update to Rollup v3 + all plugins that require it
### Patch Changes
- Updated dependencies [74b2b35]
- Updated dependencies [685e6fd]
- @rocket/building-rollup@0.5.0
## 0.20.4
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@rocket/cli",
"version": "0.20.4",
"version": "0.21.0",
"publishConfig": {
"access": "public"
},
@@ -13,7 +13,6 @@
},
"author": "Modern Web <hello@modern-web.dev> (https://modern-web.dev/)",
"homepage": "https://rocket.modern-web.dev/",
"main": "./src/index.js",
"bin": {
"rocket": "src/cli.js"
},
@@ -30,12 +29,13 @@
},
"scripts": {
"build": "npm run rocket:build",
"prepublishOnly": "npm run types",
"rocket:build": "node src/cli.js build -c demo",
"rocket:start": "node src/cli.js start -c demo",
"start": "npm run rocket:start",
"test": "mocha --require ../../scripts/testMochaGlobalHooks.js test-node/**/*.test.{js,cjs} test-node/*.test.{js,cjs} --timeout 8000",
"test:watch": "onchange 'src/**/*.{js,cjs}' 'test-node/**/*.{js,cjs}' -- npm test",
"types:copy": "copyfiles \"./types/**/*.d.ts\" dist-types/",
"types": "wireit",
"xtest:watch": "mocha test/**/*.test.js --parallel --watch"
},
"files": [
@@ -52,7 +52,7 @@
"rollup"
],
"dependencies": {
"@rocket/building-rollup": "^0.4.0",
"@rocket/building-rollup": "^0.5.0",
"@rocket/engine": "^0.2.7",
"check-html-links": "^0.2.4",
"colorette": "^2.0.16",
@@ -67,14 +67,22 @@
"@types/ip": "^1.1.0",
"koa-proxy": "^1.0.0-alpha.3"
},
"types": "./dist-types/src/index.d.ts",
"typesVersions": {
"*": {
"*": [
"./dist-types/src/index.d.ts"
"wireit": {
"types": {
"command": "copyfiles \"./types/**/*.d.ts\" dist-types/ && tsc --build --pretty",
"dependencies": [
"../plugins-manager:types",
"../engine:types",
"../building-rollup:types"
],
"test-helpers": [
"./dist-types/test-helpers/index.d.ts"
"clean": "if-file-deleted",
"files": [
"src/**/*.js",
"tsconfig.json"
],
"output": [
"dist-types/**",
".tsbuildinfo"
]
}
}

View File

@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import path from 'path';
import { existsSync } from 'fs';

View File

@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { Command } from 'commander';
import { RocketStart } from './RocketStart.js';
import { RocketBuild } from './RocketBuild.js';

View File

@@ -1,5 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
// @ts-ignore
import { CheckHtmlLinksCli } from 'check-html-links';
import { bold, gray } from 'colorette';

View File

@@ -1,9 +1,7 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import path from 'path';
import { existsSync } from 'fs';
import { rollup } from 'rollup';
// @ts-ignore
import { createMpaConfig, createServiceWorkerConfig } from '@rocket/building-rollup';
// import { rollupPluginHTML } from '@web/rollup-plugin-html';

View File

@@ -1,7 +1,5 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
// @ts-nocheck
/* eslint-disable @typescript-eslint/ban-ts-comment */
const fs = require('fs');
const path = require('path');
const EleventyImage = require('@11ty/eleventy-img');

View File

@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
// @ts-nocheck
/**

View File

@@ -74,7 +74,7 @@ describe('Config', () => {
testOptions: { captureLogs: true },
});
await build();
const inlineModule = await readOutput('e97af63d.js', { format: false });
const inlineModule = await readOutput('ddcef8d1.js', { format: false });
expect(inlineModule).to.equal('var a={test:"data"};console.log(a);\n');
});

View File

@@ -1,5 +1,3 @@
// Don't edit this file directly. It is generated by /scripts/update-package-configs.ts
{
"extends": "../../tsconfig.node-base.json",
"compilerOptions": {
@@ -9,27 +7,9 @@
"composite": true,
"allowJs": true,
"checkJs": true,
"emitDeclarationOnly": true
"emitDeclarationOnly": true,
"moduleResolution": "NodeNext"
},
"references": [
{
"path": "../plugins-manager/tsconfig.json"
},
{
"path": "../mdjs-core/tsconfig.json"
},
{
"path": "../engine/tsconfig.json"
}
],
"include": [
"src",
"*.js",
"types"
],
"exclude": [
"dist",
"dist-types",
"src/init-files/"
]
}
"include": ["src", "types"],
"exclude": ["dist-types", "**/__output/**", "**/__output-dev/**"]
}

View File

@@ -13,7 +13,6 @@
},
"author": "Modern Web <hello@modern-web.dev> (https://modern-web.dev/)",
"homepage": "https://rocket.modern-web.dev/",
"main": "./exports/index.js",
"type": "module",
"exports": {
".": {
@@ -26,9 +25,10 @@
}
},
"scripts": {
"prepublishOnly": "npm run types",
"test": "mocha --require ../../scripts/testMochaGlobalHooks.js test-node/**/*.test.{js,cjs} test-node/*.test.{js,cjs}",
"test:watch": "onchange 'src/**/*.{js,cjs}' 'test-node/**/*.{js,cjs}' -- npm test",
"types:copy": "copyfiles \"./types/**/*.d.ts\" dist-types/",
"types": "wireit",
"xtest:watch": "mocha test/**/*.test.js --parallel --watch"
},
"files": [
@@ -47,10 +47,17 @@
},
"devDependencies": {},
"types": "./dist-types/exports/index.d.ts",
"typesVersions": {
"*": {
"*": [
"./dist-types/exports/index.d.ts"
"wireit": {
"types": {
"command": "copyfiles \"./types/**/*.d.ts\" dist-types/ && tsc --build --pretty",
"clean": "if-file-deleted",
"files": [
"src/**/*.js",
"tsconfig.json"
],
"output": [
"dist-types/**",
".tsbuildinfo"
]
}
}

View File

@@ -8,10 +8,14 @@ export class RocketOpenGraphOverview extends LitElement {
constructor() {
super();
/** @type {{ url: string, sourceRelativeFilePath: string }} */
this.inputDir = '';
/** @type {{ url: string, sourceRelativeFilePath: string }[]} */
this.pages = [];
}
/**
* @param {{ url: string, sourceRelativeFilePath: string }} options
*/
renderPage({ url, sourceRelativeFilePath }) {
const iframeUrl = url.endsWith('/')
? `${url}index.opengraph.html`

View File

@@ -12,6 +12,8 @@ export class RocketRotatingText extends LitElement {
this.initIndex = 0;
this.inIndex = 0;
this.outIndex = -1;
/** @type {string[]} */
this.items = [];
}
next() {

View File

@@ -5,6 +5,11 @@ export class RocketTestimonialSmall extends LitElement {
cite: { type: String },
};
constructor() {
super();
this.cite = '';
}
static styles = css`
:host {
display: block;

View File

@@ -1,8 +1,15 @@
// @ts-nocheck
import { LitElement, html, css } from 'lit';
// wait for all dialog animations to complete their promises
const animationsComplete = element =>
Promise.allSettled(element.getAnimations().map(animation => animation.finished));
/**
* Wait for all dialog animations to complete their promises
*
* @param {HTMLElement} element
*/
function animationsComplete(element) {
return Promise.allSettled(element.getAnimations().map(animation => animation.finished));
}
export class RocketDialog extends LitElement {
static properties = {
@@ -31,6 +38,10 @@ export class RocketDialog extends LitElement {
`;
}
/**
*
* @param {Event} ev
*/
async _submit(ev) {
ev.preventDefault();
if (ev.target?.value) {
@@ -40,8 +51,10 @@ export class RocketDialog extends LitElement {
}
firstUpdated() {
this._dialog = this.shadowRoot.querySelector('dialog');
this._invoker = this.shadowRoot.querySelector('slot[name="invoker"]')?.assignedElements()[0];
this._dialog = this.shadowRoot?.querySelector('dialog');
this._invoker = /** @type {HTMLSlotElement} */ (
this.shadowRoot?.querySelector('slot[name="invoker"]')
)?.assignedElements()[0];
}
async close() {

View File

@@ -1,8 +1,13 @@
import { LitElement, html, css } from 'lit';
// wait for all dialog animations to complete their promises
const animationsComplete = element =>
Promise.allSettled(element.getAnimations().map(animation => animation.finished));
/**
* Wait for all dialog animations to complete their promises
*
* @param {HTMLElement} element
*/
function animationsComplete(element) {
return Promise.allSettled(element.getAnimations().map(animation => animation.finished));
}
export class RocketDrawer extends LitElement {
static properties = {
@@ -54,6 +59,9 @@ export class RocketDrawer extends LitElement {
this.open = true;
}
/**
* @param {import('lit').PropertyValues} changedProperties
*/
updated(changedProperties) {
super.updated(changedProperties);
if (changedProperties.has('open')) {
@@ -65,16 +73,24 @@ export class RocketDrawer extends LitElement {
}
}
/**
* @param {Event} ev
*/
closeOnOutsideClick(ev) {
if (ev.target === this._dialog) {
this.close();
}
}
/**
* @param {import('lit').PropertyValues} changedProperties
*/
firstUpdated(changedProperties) {
super.firstUpdated(changedProperties);
this._dialog = this.shadowRoot.querySelector('dialog');
this._invoker = this.shadowRoot.querySelector('slot[name="invoker"]')?.assignedElements()[0];
this._dialog = this.shadowRoot?.querySelector('dialog');
this._invoker = /** @type {HTMLSlotElement} */ (
this.shadowRoot?.querySelector('slot[name="invoker"]')
)?.assignedElements()[0];
}
async _close() {
@@ -95,8 +111,10 @@ export class RocketDrawer extends LitElement {
this._dialog.dispatchEvent(new Event('opened'));
this._dialog.removeAttribute('inert');
const focusTarget = this.querySelector('[autofocus]');
focusTarget ? focusTarget.focus() : this.shadowRoot.querySelector('button.close').focus();
const focusTarget = /** @type {HTMLElement} */ (this.querySelector('[autofocus]'));
focusTarget
? focusTarget.focus()
: /** @type {HTMLElement} */ (this.shadowRoot?.querySelector('button.close'))?.focus();
}
}

View File

@@ -1,4 +1,5 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
// @ts-nocheck
import { LitElement, html } from 'lit-element';
import { OverlayMixin, withModalDialogConfig } from '@lion/overlays';

View File

@@ -1,6 +1,8 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { html } from 'lit';
/**
* @param {{ pageTree: import('@rocket/engine').PageTree, titleWrapperFn: (input: string) => string, description: string, siteName: string }} options
*/
export function pageDefaults({ pageTree, titleWrapperFn, description, siteName }) {
return {
...defaultHead({ pageTree, titleWrapperFn, description, siteName }),
@@ -8,14 +10,17 @@ export function pageDefaults({ pageTree, titleWrapperFn, description, siteName }
};
}
/**
* @param {{ pageTree: import('@rocket/engine').PageTree, titleWrapperFn: (input: string) => string, description: string, siteName: string }} options
*/
export function defaultHead({ pageTree, titleWrapperFn, description, siteName }) {
return {
/**
* @param {any} data
*/
head__10: data => {
const useDescription = data.description ? data.description : description;
const title = titleWrapperFn(
// @ts-ignore
pageTree.getPage(data.sourceRelativeFilePath)?.model?.name,
);
const title = titleWrapperFn(pageTree.getPage(data.sourceRelativeFilePath)?.model?.name);
return html`
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

View File

@@ -19,6 +19,13 @@ export class RocketSocialLink extends LitElement {
siteName: { type: String },
};
constructor() {
super();
this.url = '';
this.name = '';
this.siteName = '';
}
render() {
return html`
<a

View File

@@ -0,0 +1,15 @@
{
"extends": "../../tsconfig.node-base.json",
"compilerOptions": {
"module": "ESNext",
"outDir": "./dist-types",
"rootDir": ".",
"composite": true,
"allowJs": true,
"checkJs": true,
"emitDeclarationOnly": true,
"moduleResolution": "NodeNext"
},
"include": ["exports", "src", "types"],
"exclude": ["dist-types"]
}

View File

@@ -1,5 +1,11 @@
# @rocket/create
## 0.1.1
### Patch Changes
- 79e6f0d: Update error message to include an action to resolve a possible [digit error](https://github.com/Rich-Harris/degit/issues/313).
## 0.1.0
### Minor Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@rocket/create",
"version": "0.1.0",
"version": "0.1.1",
"publishConfig": {
"access": "public"
},
@@ -13,7 +13,6 @@
},
"author": "Modern Web <hello@modern-web.dev> (https://modern-web.dev/)",
"homepage": "https://rocket.modern-web.dev/",
"main": "./src/index.js",
"bin": {
"create-rocket": "src/cli.js"
},
@@ -28,8 +27,7 @@
"prepublishOnly": "node ./scripts/prepublish.js",
"start": "node ./src/cli.js",
"test": "mocha test-node/**/*.test.{js,cjs} test-node/*.test.{js,cjs}",
"test:watch": "onchange 'src/**/*.{js,cjs}' 'test-node/**/*.{js,cjs}' -- npm test",
"types:copy": "copyfiles \"./types/**/*.d.ts\" dist-types/"
"test:watch": "onchange 'src/**/*.{js,cjs}' 'test-node/**/*.{js,cjs}' -- npm test"
},
"files": [
"deployments",
@@ -49,13 +47,5 @@
"commander": "^9.0.0",
"degit": "^2.0.0",
"prompts": "^2.2.0"
},
"types": "./dist-types/src/index.d.ts",
"typesVersions": {
"*": {
"*": [
"./dist-types/src/index.d.ts"
]
}
}
}

View File

@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { Command } from 'commander';
import prompts from 'prompts';
import { underline, bold, gray, green, blue, yellow, red } from 'colorette';
@@ -152,7 +151,11 @@ export class CreateCli {
await gitHandler.clone('./' + newFolderPath);
cloneError = false;
} catch (e) {
console.log(`${red('✖')} Could not apply the template - maybe the url is wrong?`);
console.log(
`${red(
'✖',
)} Could not apply the template - maybe the url is wrong? If this problem persists, you could try clearing your .degit cache, usually located at ~/.degit`,
);
console.log(`${red('>')} ${e.message}`);
const response = await prompts({
type: 'text',

View File

@@ -13,7 +13,6 @@
},
"author": "Modern Web <hello@modern-web.dev> (https://modern-web.dev/)",
"homepage": "https://rocket.modern-web.dev/docs/tools/engine/",
"main": "./src/index.js",
"type": "module",
"exports": {
".": {
@@ -33,12 +32,13 @@
}
},
"scripts": {
"debug": "DEBUG=engine:rendering yarn test",
"debug:integration": "PWDEBUG=1 yarn test:integration",
"debug": "DEBUG=engine:rendering npm run test",
"debug:integration": "PWDEBUG=1 npm run test:integration",
"prepublishOnly": "npm run types",
"test": "mocha --require ../../scripts/testMochaGlobalHooks.js --timeout 8000 test-node/**/*.test.js test-node/*.test.js",
"test:integration": "playwright test test-node/*.spec.js --retries=3",
"test:watch": "onchange 'src/**/*.js' 'test-node/**/*.js' -- npm test",
"types:copy": "copyfiles \"./types/**/*.d.ts\" dist-types/"
"types": "wireit"
},
"files": [
"assets",
@@ -57,17 +57,21 @@
"sax-wasm": "^2.1.3",
"unist-util-visit": "^4.1.0"
},
"types": "./dist-types/src/index.d.ts",
"typesVersions": {
"*": {
"*": [
"./dist-types/src/index.d.ts"
"wireit": {
"types": {
"command": "copyfiles \"./types/**/*.d.ts\" dist-types/ && tsc --build --pretty",
"dependencies": [
"../plugins-manager:types",
"../mdjs-core:types"
],
"server": [
"./dist-types/src/index.server.d.ts"
"clean": "if-file-deleted",
"files": [
"src/**/*.js",
"tsconfig.json"
],
"hydration": [
"./dist-types/src/index.hydration.d.ts"
"output": [
"dist-types/**",
".tsbuildinfo"
]
}
}

View File

@@ -1,5 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
/** @typedef {import('../types/main.js').EngineOptions} EngineOptions */
/** @typedef {import('../types/main.js').DevServerPlugin} DevServerPlugin */
/** @typedef {import('../types/main.js').DevServerMiddleware} DevServerMiddleware */
@@ -393,11 +391,6 @@ export class Engine {
return await urlToSourceFilePath(url, this.docsDir);
}
/**
* @param {object} [options]
* @param {string} [options.triggerSourceFilePath]
* @param {boolean} [options.deleteOtherFiles]
*/
async renderAllOpenedFiles({ deleteOtherFiles = true, triggerSourceFilePath = '' } = {}) {
if (this.watcher) {
for (const [sourceFilePath, page] of this.watcher.pages.entries()) {

View File

@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { existsSync } from 'fs';
import path from 'path';
import { debuglog } from 'util';

View File

@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { existsSync } from 'fs';
import { readFile, writeFile } from 'fs/promises';
import path from 'path';
@@ -191,11 +190,14 @@ export class RocketHeader {
const [, exports] = parse(readDataFile.toString());
for (const dataExportName of exports) {
// TODO: update to latest es-module-lexer version
// @ts-ignore - ts somehow grabs the wrong version of es-module-lexer types... 0.x => strings[], 1.x => {...}[]
const foundIndex = possibleImports.findIndex(el => el.importName === dataExportName);
if (foundIndex >= 0) {
possibleImports[foundIndex].importModuleName = exportModuleName;
} else {
possibleImports.push({
// @ts-ignore
importName: dataExportName,
importModuleName: exportModuleName,
});

View File

@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
// @ts-ignore
import { mdjsProcess } from '@mdjs/core';
import { existsSync } from 'fs';

View File

@@ -1,21 +1,20 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
/* eslint-disable no-prototype-builtins */
import { evaluate } from './evaluate.js';
import { extractStrategies } from './extractStrategies.js';
export class HydrationLoader {
/** @type {import('../../types/main').Components} */
/** @type {import('../../types/main.js').Components} */
components = {};
isSetup = false;
/** @type {import('../../types/main').ElementWithStrategy[]} */
/** @type {import('../../types/main.js').ElementWithStrategy[]} */
elements = [];
/** @type {{ [key: string]: MediaQueryList }} */
mediaQueries = {};
/**
* @param {import('../../types/main').Components} components
* @param {import('../../types/main.js').Components} components
*/
constructor(components) {
this.components = components;
@@ -81,11 +80,11 @@ export class HydrationLoader {
}
/**
* @returns {import('../../types/main').ElementWithStrategy[]}
* @returns {import('../../types/main.js').ElementWithStrategy[]}
*/
gatherElements() {
const els = document.querySelectorAll('[loading]');
/** @type {import('../../types/main').ElementWithStrategy[]} */
/** @type {import('../../types/main.js').ElementWithStrategy[]} */
const elements = [];
for (const el of els) {
const strategyAttribute = el.getAttribute('loading');

View File

@@ -1,9 +1,7 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
/**
* @param {object} options
* @param {string} options.strategyTemplate
* @param {import("../../types/main").Strategy[]} options.strategies
* @param {import("../../types/main.js").Strategy[]} options.strategies
* @returns {boolean}
*/
export function evaluate({ strategyTemplate, strategies }) {

View File

@@ -49,12 +49,12 @@ function getStrategy(part, type) {
/**
* @param {string} input
* @returns {import("../../types/main").LoadingStrategy}
* @returns {import("../../types/main.js").LoadingStrategy}
*/
export function extractStrategies(input) {
const parts = getParts(input);
/** @type {import("../../types/main").LoadingStrategy} */
/** @type {import("../../types/main.js").LoadingStrategy} */
const result = {
strategyAttribute: input,
strategies: [],

View File

@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { renderJoiningGroup } from '../helpers/renderJoiningGroup.js';
import { html } from 'lit';
import { classMap } from 'lit/directives/class-map.js';

View File

@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
/** @typedef {import('lit').TemplateResult} TemplateResult */
export class LayoutRaw {

View File

@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
// @ts-nocheck
import path from 'path';
import { TreeModel } from '@d4kmor/tree-model';

View File

@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { Menu } from './Menu.js';
/** @typedef {import('lit').TemplateResult} TemplateResult */

View File

@@ -86,7 +86,7 @@ async function renderFile({
openGraphUrl: url.replace(/\.html$/, '.opengraph.html'),
};
}
/** @type {import('../../types/layout').renderData} */
/** @type {import('../../types/layout.js').renderData} */
const layoutData = {
sourceFilePath,
outputFilePath,

View File

@@ -1,5 +1,3 @@
// Don't edit this file directly. It is generated by /scripts/update-package-configs.ts
{
"extends": "../../tsconfig.node-base.json",
"compilerOptions": {
@@ -9,24 +7,10 @@
"composite": true,
"allowJs": true,
"checkJs": true,
"emitDeclarationOnly": true
"emitDeclarationOnly": true,
"moduleResolution": "NodeNext"
},
"references": [
{
"path": "../plugins-manager/tsconfig.json"
},
{
"path": "../mdjs-core/tsconfig.json"
}
],
"include": [
"src",
"*.js",
"types",
"preset"
],
"exclude": [
"dist",
"dist-types"
]
}
"references": [],
"include": ["src", "types"],
"exclude": ["dist-types"]
}

View File

@@ -1,3 +0,0 @@
{
"include": ["src", "*.js", "types", "preset"]
}

View File

@@ -1,5 +1,12 @@
# @rocket/launch
## 0.21.4
### Patch Changes
- Updated dependencies [74b2b35]
- @rocket/cli@0.21.0
## 0.21.3
### Patch Changes

View File

@@ -1 +0,0 @@
export { LaunchContent } from '../src/content/LaunchContent.js';

View File

@@ -1,6 +1,6 @@
{
"name": "@rocket/launch",
"version": "0.21.3",
"version": "0.21.4",
"publishConfig": {
"access": "public"
},
@@ -13,7 +13,6 @@
},
"author": "Modern Web <hello@modern-web.dev> (https://modern-web.dev/)",
"homepage": "https://rocket.modern-web.dev/docs/presets/launch/",
"main": "./src/index.js",
"type": "module",
"exports": {
".": {
@@ -23,13 +22,17 @@
"./assets/*": "./assets/*",
"./css/*": "./css/*",
"./js/*": "./src/public/*",
"./*": "./exports/*"
"./*": {
"types": "./dist-types/exports/*",
"default": "./exports/*"
}
},
"scripts": {
"analyze": "cem analyze --litelement",
"prepublishOnly": "npm run types",
"test": "mocha --timeout 5000 test-node/**/*.test.{js,cjs} test-node/*.test.{js,cjs}",
"test:watch": "onchange 'src/**/*.{js,cjs}' 'test-node/**/*.{js,cjs}' -- npm test",
"types:copy": "copyfiles \"./types/**/*.d.ts\" dist-types/"
"types": "wireit"
},
"files": [
"__public",
@@ -46,22 +49,32 @@
"preset"
],
"dependencies": {
"@rocket/cli": "^0.20.4",
"@rocket/cli": "^0.21.0",
"@rocket/components": "^0.2.0",
"@rocket/engine": "^0.2.7",
"@webcomponents/template-shadowroot": "^0.1.0",
"lit": "^2.3.0",
"plugins-manager": "^0.3.1",
"workbox-window": "^6.1.5"
},
"types": "./dist-types/src/index.d.ts",
"customElements": "custom-elements.json",
"typesVersions": {
"*": {
"*": [
"./dist-types/src/index.d.ts"
"wireit": {
"types": {
"command": "copyfiles \"./types/**/*.d.ts\" dist-types/ && tsc --build --pretty",
"dependencies": [
"../cli:types",
"../components:types",
"../engine:types",
"../plugins-manager:types"
],
"inline-notification": [
"./dist-types/src/inline-notification/index.d.ts"
"clean": "if-file-deleted",
"files": [
"src/**/*.js",
"tsconfig.json"
],
"output": [
"dist-types/**",
".tsbuildinfo"
]
}
}

View File

@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { renderJoiningGroup, TableOfContentsMenu } from '@rocket/engine';
import { html } from 'lit';
import { LayoutMain } from './LayoutMain.js';

View File

@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { renderJoiningGroup } from '@rocket/engine';
import { html, nothing } from 'lit';
import { LayoutMain } from './LayoutMain.js';

View File

@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import {
Layout,
renderJoiningGroup,

View File

@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { renderJoiningGroup, TableOfContentsMenu } from '@rocket/engine';
import { html } from 'lit';
import { LayoutMain } from './LayoutMain.js';

View File

@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { LitElement, html, nothing } from 'lit';
import { LaunchBlogPreview } from './LaunchBlogPreview.js';

View File

@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
(async () => {
if ('serviceWorker' in navigator) {
const { Workbox } = await import('workbox-window');

View File

@@ -5,7 +5,6 @@ import { BroadcastUpdatePlugin } from 'workbox-broadcast-update';
import { ExpirationPlugin } from 'workbox-expiration';
addEventListener('install', () => {
/* eslint-disable @typescript-eslint/ban-ts-comment */
// @ts-ignore
skipWaiting();
/* eslint-enable @typescript-eslint/ban-ts-comment */

View File

@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { addPlugin } from 'plugins-manager';
class EnginePluginLaunch {

View File

@@ -1,5 +1,3 @@
// Don't edit this file directly. It is generated by /scripts/update-package-configs.ts
{
"extends": "../../tsconfig.node-base.json",
"compilerOptions": {
@@ -9,29 +7,9 @@
"composite": true,
"allowJs": true,
"checkJs": true,
"emitDeclarationOnly": true
"emitDeclarationOnly": true,
"moduleResolution": "NodeNext"
},
"references": [
{
"path": "../plugins-manager/tsconfig.json"
},
{
"path": "../mdjs-core/tsconfig.json"
},
{
"path": "../engine/tsconfig.json"
},
{
"path": "../cli/tsconfig.json"
}
],
"include": [
"src",
"*.js",
"types"
],
"exclude": [
"dist",
"dist-types"
]
}
"include": ["exports", "src", "types"],
"exclude": ["dist-types", "**/__output/**", "**/__output-dev/**"]
}

View File

@@ -14,7 +14,7 @@ Foo is great
## How to Use
```bash
yarn add @foo/demo-wc-card
npm install @foo/demo-wc-card
```
```js

View File

@@ -13,7 +13,6 @@
},
"author": "Modern Web <hello@modern-web.dev> (https://modern-web.dev/)",
"homepage": "https://rocket.modern-web.dev/docs/markdown-javascript/overview/",
"main": "./index.js",
"type": "module",
"exports": {
".": {
@@ -22,25 +21,20 @@
}
},
"scripts": {
"prepublishOnly": "publish-docs --github-url https://github.com/modernweb-dev/rocket/ --git-root-dir ../../",
"prepublishOnly": "npm run types && publish-docs --github-url https://github.com/modernweb-dev/rocket/ --git-root-dir ../../",
"start": "npm run start:stories",
"start:script": "web-dev-server -c demo/script/server.js --root-dir ../../",
"start:stories": "web-dev-server -c demo/stories/server.js --root-dir ../../",
"test": "npm run test:node",
"test:node": "mocha test-node",
"test:watch": "mocha test-node --watch",
"types:copy": "copyfiles -f \"./types/**/*.d.ts\" dist-types/types"
"types": "wireit"
},
"files": [
"*.d.ts",
"*.js",
"*.mjs",
"dist-types",
"src",
"types"
"src"
],
"keywords": [
"open-wc",
"markdown",
"unified",
"remark"
@@ -73,5 +67,22 @@
"remark-slug": "^7.0.1",
"remark-stringify": "^10.0.2"
},
"types": "dist-types/index.d.ts"
"types": "dist-types/index.d.ts",
"wireit": {
"types": {
"command": "copyfiles \"./types/**/*.d.ts\" dist-types/ && tsc --build --pretty",
"dependencies": [
"../plugins-manager:types"
],
"clean": "if-file-deleted",
"files": [
"src/**/*.js",
"tsconfig.json"
],
"output": [
"dist-types/**",
".tsbuildinfo"
]
}
}
}

View File

@@ -1,17 +1,22 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
/** @typedef {import('../types/code').Story} Story */
/** @typedef {import('../types/code').ParseResult} ParseResult */
/** @typedef {import('../types/code').ProcessResult} ProcessResult */
/** @typedef {import('../types/code').MdjsProcessPlugin} MdjsProcessPlugin */
/** @typedef {import('../types/code.js').Story} Story */
/** @typedef {import('../types/code.js').ParseResult} ParseResult */
/** @typedef {import('../types/code.js').ProcessResult} ProcessResult */
/** @typedef {import('../types/code.js').MdjsProcessPlugin} MdjsProcessPlugin */
import { unified } from 'unified';
import markdown from 'remark-parse';
import gfm from 'remark-gfm';
// @ts-ignore
import remark2rehype from 'remark-rehype';
// @ts-ignore
import raw from 'rehype-raw';
// @ts-ignore
import htmlSlug from 'rehype-slug';
// @ts-ignore
import htmlHeading from 'rehype-autolink-headings';
// @ts-ignore
import rehypePrism from 'rehype-prism-plus';
// @ts-ignore
import htmlStringify from 'rehype-stringify';
import { executeSetupFunctions } from 'plugins-manager';
import { mdjsParse } from './mdjsParse.js';

View File

@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
/** @typedef {import('../types/code.js').Story} Story */
/** @typedef {import('../types/code.js').StoryTypes} StoryTypes */
/** @typedef {(name: string) => string} TagFunction */

View File

@@ -1,5 +1,3 @@
// Don't edit this file directly. It is generated by /scripts/update-package-configs.ts
{
"extends": "../../tsconfig.node-base.json",
"compilerOptions": {
@@ -9,20 +7,9 @@
"composite": true,
"allowJs": true,
"checkJs": true,
"emitDeclarationOnly": true
"emitDeclarationOnly": true,
"moduleResolution": "Node16"
},
"references": [
{
"path": "../plugins-manager/tsconfig.json"
}
],
"include": [
"src",
"*.js",
"types"
],
"exclude": [
"dist",
"dist-types"
]
}
"include": ["src", "types"],
"exclude": ["dist-types"]
}

View File

@@ -1,11 +0,0 @@
/**
* @template T
* @typedef {import('./types/main.js').MetaPlugin<T>} MetaPlugin
**/
/** @typedef {import('./types/main.js').Plugin} Plugin */
export { addPlugin } from './src/addPlugin.js';
export { removePlugin } from './src/removePlugin.js';
export { adjustPluginOptions } from './src/adjustPluginOptions.js';
export { applyPlugins } from './src/applyPlugins.js';
export { executeSetupFunctions } from './src/executeSetupFunctions.js';

View File

@@ -16,23 +16,35 @@
"type": "module",
"exports": {
".": {
"types": "./dist-types/index.d.ts",
"types": "./dist-types/src/index.d.ts",
"require": "./dist/index.cjs",
"default": "./index.js"
"default": "./src/index.js"
}
},
"scripts": {
"build:package": "rimraf dist && esbuild --platform=node --format=cjs --bundle --outfile=dist/index.cjs ./index.js",
"prepublishOnly": "publish-docs --github-url https://github.com/modernweb-dev/rocket/ --git-root-dir ../../",
"prepublishOnly": "npm run types && rimraf dist && esbuild --platform=node --format=cjs --bundle --outfile=dist/index.cjs ./index.js && publish-docs --github-url https://github.com/modernweb-dev/rocket/ --git-root-dir ../../",
"test": "mocha --timeout 5000 test-node/**/*.test.{js,cjs} test-node/*.test.{js,cjs}",
"test:watch": "onchange 'src/**/*.{js,cjs}' 'test-node/**/*.{js,cjs}' -- npm test",
"types:copy": "copyfiles \"./types/**/*.d.ts\" dist-types/"
"types": "wireit"
},
"files": [
"*.js",
"dist",
"dist-types",
"src"
],
"types": "./dist-types/index.d.ts"
"types": "./dist-types/src/index.d.ts",
"wireit": {
"types": {
"command": "copyfiles \"./types/**/*.d.ts\" dist-types/ && tsc --build --pretty",
"clean": "if-file-deleted",
"files": [
"src/**/*.js",
"tsconfig.json"
],
"output": [
"dist-types/**",
".tsbuildinfo"
]
}
}
}

View File

@@ -1,12 +1,10 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
/**
* @template {import('../types/main.js').Plugin} T
* @param {T} plugin
* @param {import('../types/main.js').GetPluginOptions<T>} [options]
* @param {import('../types/main.js').ManagerOptions} [managerOptions]
* @param {import('../types/main.js').ManagerOptions} managerOptions
*/
// @ts-ignore
export function addPlugin(plugin, options = {}, { how = 'after', location = 'bottom' } = {}) {
export function addPlugin(plugin, options, { how = 'after', location = 'bottom' } = {}) {
/**
* @param {import('../types/main.js').MetaPlugin<T>[]} plugins
*/

View File

@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
/** @typedef {import('../types/main.js').Plugin} Plugin */
/**

View File

@@ -0,0 +1,12 @@
/**
* @template T
* @typedef {import('../types/main.js').MetaPlugin<T>} MetaPlugin
**/
/** @typedef {import('../types/main.js').Plugin} Plugin */
/** @typedef {import('../types/main.js').AnyFn} AnyFn */
export { addPlugin } from './addPlugin.js';
export { removePlugin } from './removePlugin.js';
export { adjustPluginOptions } from './adjustPluginOptions.js';
export { applyPlugins } from './applyPlugins.js';
export { executeSetupFunctions } from './executeSetupFunctions.js';

View File

@@ -1,8 +1,6 @@
import chai from 'chai';
import { expect } from 'chai';
import { addPlugin, applyPlugins } from '../index.js';
const { expect } = chai;
import { addPlugin, applyPlugins } from 'plugins-manager';
describe('addPlugin', () => {
const insertPlugin = ({ firstName = 'first', lastName = 'last' } = {}) =>
@@ -11,15 +9,7 @@ describe('addPlugin', () => {
const secondPlugin = () => 'secondPlugin';
const thirdPlugin = () => 'thirdPlugin';
/**
* @template T
* @type {import('../types/main.js.js').MetaPlugin<T>[]}
*/
const oneExistingPlugin = [{ plugin: firstPlugin, options: {} }];
/**
* @template T
* @type {import('../types/main.js.js').MetaPlugin<T>[]}
*/
const threeExistingPlugins = [
{ plugin: firstPlugin, options: {} },
{ plugin: secondPlugin, options: {} },
@@ -111,12 +101,16 @@ describe('addPlugin', () => {
});
it('[advanced] can add a `wrapPlugin` property to the function itself which will call it on the plugin on init', async () => {
/**
* @param {import('plugins-manager').AnyFn} plugin
*/
function myWrapper(plugin) {
return () => 'wrapped' + plugin();
}
const config = applyPlugins({
setupPlugins: [addPlugin(insertPlugin)].map(mod => {
// @ts-ignore
mod.wrapPlugin = myWrapper;
return mod;
}),

View File

@@ -1,8 +1,6 @@
// @ts-check
import chai from 'chai';
import { adjustPluginOptions, applyPlugins } from '../index.js';
import { adjustPluginOptions, applyPlugins } from 'plugins-manager';
const { expect } = chai;

View File

@@ -1,20 +1,10 @@
import chai from 'chai';
import { expect } from 'chai';
import { applyPlugins, addPlugin } from '../index.js';
const { expect } = chai;
import { applyPlugins, addPlugin } from 'plugins-manager';
describe('applyPlugins', () => {
const insertPlugin = () => `-- insertPlugin --`;
/**
* @template T
* @type {import('../types/main.js.js').MetaPlugin<T>[]}
*/
const oneExistingPlugin = [{ plugin: () => 'firstPlugin', options: {} }];
/**
* @template T
* @type {import('../types/main.js.js').MetaPlugin<T>[]}
*/
const threeExistingPlugin = [
{ plugin: () => 'firstPlugin', options: {} },
{ plugin: () => 'secondPlugin', options: {} },

View File

@@ -1,18 +1,12 @@
import chai from 'chai';
import { expect } from 'chai';
import { executeSetupFunctions, addPlugin } from '../index.js';
const { expect } = chai;
import { executeSetupFunctions, addPlugin } from 'plugins-manager';
describe('executeSetupFunctions', () => {
const firstPlugin = () => 'firstPlugin';
const secondPlugin = () => 'secondPlugin';
const thirdPlugin = () => 'thirdPlugin';
/**
* @template T
* @type {import('../types/main.js.js').MetaPlugin<T>[]}
*/
const threeExistingPlugin = [
{ plugin: firstPlugin, options: {} },
{ plugin: secondPlugin, options: {} },

View File

@@ -1,8 +1,6 @@
import chai from 'chai';
import { expect } from 'chai';
import { removePlugin, applyPlugins } from '../index.js';
const { expect } = chai;
import { removePlugin, applyPlugins } from 'plugins-manager';
describe('removePlugin', () => {
const firstPlugin = () => 'firstPlugin';

Some files were not shown because too many files have changed in this diff Show More