Compare commits

..

9 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
123 changed files with 27905 additions and 9189 deletions

View File

@@ -13,6 +13,10 @@ __output-dev
docs/_merged* docs/_merged*
*-mdjs-generated.js *-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 # sanity example has a separate backend that is unrelated to Rocket
# therefore it does not need to follow it code rules # therefore it does not need to follow it code rules

View File

@@ -12,45 +12,29 @@ jobs:
name: Release name: Release
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: google/wireit@setup-github-actions-caching/v1
- name: Checkout Repo - name: Checkout Repo
uses: actions/checkout@master uses: actions/checkout@master
with: with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0 fetch-depth: 0
- name: Setup Node.js 14.x - name: Setup Node.js 18.x
uses: actions/setup-node@master uses: actions/setup-node@master
with: with:
node-version: 14.x node-version: 18.x
registry-url: 'https://registry.npmjs.org' 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 - name: Install Dependencies
run: yarn --frozen-lockfile run: npm ci
- name: Build Packages
run: yarn build:packages
- name: Build Types
run: yarn types
- name: Create Release Pull Request or Publish to npm - name: Create Release Pull Request or Publish to npm
id: changesets id: changesets
uses: changesets/action@master uses: changesets/action@master
with: with:
# This expects you to have a script called release which does a build for your packages and calls changeset publish # 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: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

View File

@@ -8,8 +8,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
node-version: [16.x] node-version: [18.x]
steps: steps:
- uses: google/wireit@setup-github-actions-caching/v1
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Setup Node ${{ matrix.node-version }} - name: Setup Node ${{ matrix.node-version }}
@@ -17,20 +18,8 @@ jobs:
with: with:
node-version: ${{ matrix.node-version }} 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 - name: Install dependencies
run: yarn --frozen-lockfile run: npm ci
- name: Install Playwright dependencies - name: Install Playwright dependencies
run: npx playwright install-deps run: npx playwright install-deps
@@ -38,40 +27,8 @@ jobs:
- name: Install Playwright - name: Install Playwright
run: npx playwright install run: npx playwright install
- name: Build Packages
run: yarn build:packages
- name: Lint - name: Lint
run: yarn lint run: npm run lint
- name: Test - name: Test
run: yarn test run: npm run 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

8
.gitignore vendored
View File

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

View File

@@ -8,5 +8,5 @@
"**/*-mdjs-generated.js": true, "**/*-mdjs-generated.js": true,
"**/dist-types": 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 ## 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 ```shell
yarn install npm install
``` ```
This will download and install all packages needed. 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 ### 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 ### Integration Testing
@@ -58,7 +58,7 @@ To see how your changes integrate with everything together you can use the `test
## Adding New Packages ## 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 ## Creating a Changeset
@@ -70,7 +70,7 @@ This documents your intent to release, and allows you to specify a message that
Run Run
```shell ```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. 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 # logs
npm-debug.log* npm-debug.log*
yarn-debug.log*
yarn-error.log*
# environment variables # environment variables
.env .env

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,5 +1,15 @@
# @rocket/building-rollup # @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 ## 0.4.1
### Patch Changes ### 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", "name": "@rocket/building-rollup",
"version": "0.4.1", "version": "0.5.0",
"publishConfig": { "publishConfig": {
"access": "public" "access": "public"
}, },
@@ -13,10 +13,12 @@
}, },
"author": "Modern Web <hello@modern-web.dev> (https://modern-web.dev/)", "author": "Modern Web <hello@modern-web.dev> (https://modern-web.dev/)",
"homepage": "https://rocket.modern-web.dev/docs/tools/building-rollup/", "homepage": "https://rocket.modern-web.dev/docs/tools/building-rollup/",
"main": "./index.js",
"type": "module", "type": "module",
"exports": { "exports": {
".": "./index.js" ".": {
"types": "./dist-types/src/index.d.ts",
"default": "./src/index.js"
}
}, },
"scripts": { "scripts": {
"build:babelrc": "rimraf dist && rollup -c demo/babelrc/rollup.config.js", "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-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: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", "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:babelrc": "npm run build:babelrc && npm run start:build",
"start:build": "web-dev-server --root-dir dist --compatibility none --open", "start:build": "web-dev-server --root-dir dist --compatibility none --open",
"start:cjs": "npm run build:cjs && npm run start:build", "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:ts": "npm run build:ts && npm run start:build",
"start:watch": "npm run build:spa-nomodule -- --watch & npm run start:build", "start:watch": "npm run build:spa-nomodule -- --watch & npm run start:build",
"test": "npm run test:node", "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": [ "files": [
"*.js", "dist-types",
"src" "src"
], ],
"keywords": [ "keywords": [
"rollup" "rollup"
], ],
"peerDependencies": { "peerDependencies": {
"rollup": "^2.35.0" "rollup": "^3.0.0"
}, },
"dependencies": { "dependencies": {
"@babel/core": "^7.12.10", "@babel/core": "^7.20.12",
"@babel/preset-env": "^7.12.11", "@babel/preset-env": "^7.12.11",
"@rollup/plugin-babel": "^5.2.2", "@rollup/plugin-babel": "^6.0.0",
"@rollup/plugin-node-resolve": "^11.0.1", "@rollup/plugin-node-resolve": "^15.0.1",
"@rollup/plugin-replace": "^2.4.2", "@rollup/plugin-replace": "^5.0.1",
"@web/rollup-plugin-html": "^1.8.0", "@rollup/plugin-terser": "^0.4.0",
"@web/rollup-plugin-import-meta-assets": "^1.0.4", "@web/rollup-plugin-html": "^2.0.0",
"@web/rollup-plugin-polyfills-loader": "^1.1.0", "@web/rollup-plugin-import-meta-assets": "^2.0.0",
"@web/rollup-plugin-polyfills-loader": "^2.0.0",
"browserslist": "^4.16.1", "browserslist": "^4.16.1",
"rollup-plugin-terser": "^7.0.2", "plugins-manager": "^0.3.1",
"workbox-broadcast-update": "^6.1.5", "workbox-broadcast-update": "^6.1.5",
"workbox-cacheable-response": "^6.1.5", "workbox-cacheable-response": "^6.1.5",
"workbox-expiration": "^6.1.5", "workbox-expiration": "^6.1.5",
"workbox-routing": "^6.1.5", "workbox-routing": "^6.1.5",
"workbox-strategies": "^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 resolve from '@rollup/plugin-node-resolve';
import { terser } from 'rollup-plugin-terser'; import terser from '@rollup/plugin-terser';
import babelPkg from '@rollup/plugin-babel'; import { babel } from '@rollup/plugin-babel';
import { applyPlugins } from 'plugins-manager'; import { applyPlugins } from 'plugins-manager';
const { babel } = babelPkg; /** @typedef {import('../types/main.js').BuildingRollupOptions} BuildingRollupOptions */
/**
* @param {BuildingRollupOptions} [userConfig]
*/
export function createBasicConfig(userConfig) { export function createBasicConfig(userConfig) {
const { config, metaPlugins } = createBasicMetaConfig(userConfig); const { config, metaPlugins } = createBasicMetaConfig(userConfig);
return applyPlugins(config, metaPlugins); return applyPlugins(config, metaPlugins);
} }
/**
* @param {BuildingRollupOptions} [userConfig]
*/
export function createBasicMetaConfig(userConfig = { output: {} }) { export function createBasicMetaConfig(userConfig = { output: {} }) {
const developmentMode = const developmentMode =
typeof userConfig.developmentMode !== 'undefined' typeof userConfig.developmentMode !== 'undefined'
@@ -37,8 +43,12 @@ export function createBasicMetaConfig(userConfig = { output: {} }) {
}, },
}; };
/**
* @type {import('plugins-manager').MetaPlugin<any>[]}
*/
let metaPlugins = [ let metaPlugins = [
{ {
// @ts-ignore
plugin: resolve, plugin: resolve,
options: { options: {
moduleDirectories: ['node_modules', 'web_modules'], moduleDirectories: ['node_modules', 'web_modules'],
@@ -71,7 +81,9 @@ export function createBasicMetaConfig(userConfig = { output: {} }) {
}, },
}, },
{ {
// @ts-ignore
plugin: terser, plugin: terser,
options: {},
}, },
]; ];

View File

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

View File

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

View File

@@ -1,15 +1,26 @@
// @ts-ignore
import { rollupPluginHTML } from '@web/rollup-plugin-html'; import { rollupPluginHTML } from '@web/rollup-plugin-html';
// @ts-ignore
import { importMetaAssets } from '@web/rollup-plugin-import-meta-assets'; import { importMetaAssets } from '@web/rollup-plugin-import-meta-assets';
// @ts-ignore
import { polyfillsLoader } from '@web/rollup-plugin-polyfills-loader'; import { polyfillsLoader } from '@web/rollup-plugin-polyfills-loader';
import { applyPlugins } from 'plugins-manager'; import { applyPlugins } from 'plugins-manager';
import { createBasicMetaConfig } from './createBasicConfig.js'; import { createBasicMetaConfig } from './createBasicConfig.js';
/** @typedef {import('../types/main.js').BuildingRollupOptions} BuildingRollupOptions */
/**
* @param {BuildingRollupOptions} [userConfig]
*/
export function createSpaConfig(userConfig) { export function createSpaConfig(userConfig) {
const { config, metaPlugins } = createSpaMetaConfig(userConfig); const { config, metaPlugins } = createSpaMetaConfig(userConfig);
return applyPlugins(config, metaPlugins); return applyPlugins(config, metaPlugins);
} }
/**
* @param {BuildingRollupOptions} userConfig
*/
export function createSpaMetaConfig(userConfig = { output: {} }) { export function createSpaMetaConfig(userConfig = { output: {} }) {
const { config, metaPlugins, developmentMode } = createBasicMetaConfig(userConfig); const { config, metaPlugins, developmentMode } = createBasicMetaConfig(userConfig);
@@ -27,8 +38,13 @@ export function createSpaMetaConfig(userConfig = { output: {} }) {
} }
delete config.absoluteBaseUrl; delete config.absoluteBaseUrl;
/**
* @type {import('plugins-manager').MetaPlugin<any>[]}
*/
const spaMetaPlugins = [ const spaMetaPlugins = [
// @ts-ignore
...metaPlugins, ...metaPlugins,
// @ts-ignore
{ {
plugin: rollupPluginHTML, plugin: rollupPluginHTML,
options: { options: {
@@ -36,9 +52,11 @@ export function createSpaMetaConfig(userConfig = { output: {} }) {
absoluteBaseUrl, absoluteBaseUrl,
}, },
}, },
// @ts-ignore
{ {
plugin: importMetaAssets, plugin: importMetaAssets,
}, },
// @ts-ignore
{ {
plugin: polyfillsLoader, plugin: polyfillsLoader,
options: { 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 chai from 'chai';
import path from 'path'; import path from 'path';
import fs from 'fs'; import { readFile } from 'fs/promises';
import { fileURLToPath } from 'url'; import { fileURLToPath } from 'url';
import { rollup } from 'rollup'; import { rollup } from 'rollup';
@@ -8,7 +8,7 @@ const { expect } = chai;
const __dirname = path.dirname(fileURLToPath(import.meta.url)); const __dirname = path.dirname(fileURLToPath(import.meta.url));
/** /**
* @param {object} config * @param {import('@rocket/building-rollup').BuildingRollupOptions} config
*/ */
async function buildAndWrite(config) { async function buildAndWrite(config) {
const bundle = await rollup(config); const bundle = await rollup(config);
@@ -16,21 +16,27 @@ async function buildAndWrite(config) {
if (Array.isArray(config.output)) { if (Array.isArray(config.output)) {
await bundle.write(config.output[0]); await bundle.write(config.output[0]);
await bundle.write(config.output[1]); await bundle.write(config.output[1]);
} else { } else if (config.output) {
await bundle.write(config.output); await bundle.write(config.output);
} }
} }
/**
* @param {string} configString
* @returns
*/
async function execute(configString) { async function execute(configString) {
const configPath = path.join(__dirname, 'fixtures', configString.split('/').join(path.sep)); const configPath = path.join(__dirname, 'fixtures', configString.split('/').join(path.sep));
const config = (await import(configPath)).default; const config = (await import(configPath)).default;
await buildAndWrite(config); await buildAndWrite(config);
/**
* @param {string} fileName
*/
return async (fileName, { stripToBody = false, stripStartEndWhitespace = true } = {}) => { return async (fileName, { stripToBody = false, stripStartEndWhitespace = true } = {}) => {
let text = await fs.promises.readFile( let text = (
path.join(config.output.dir, fileName.split('/').join(path.sep)), await readFile(path.join(config.output.dir, fileName.split('/').join(path.sep)))
); ).toString();
text = text.toString();
if (stripToBody) { if (stripToBody) {
const bodyOpenTagEnd = text.indexOf('>', text.indexOf('<body') + 1) + 1; const bodyOpenTagEnd = text.indexOf('>', text.indexOf('<body') + 1) + 1;
const bodyCloseTagStart = text.indexOf('</body>'); const bodyCloseTagStart = text.indexOf('</body>');

View File

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

View File

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

View File

@@ -1,5 +1,17 @@
# @rocket/cli # @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 ## 0.20.4
### Patch Changes ### Patch Changes

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -74,7 +74,7 @@ describe('Config', () => {
testOptions: { captureLogs: true }, testOptions: { captureLogs: true },
}); });
await build(); 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'); 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", "extends": "../../tsconfig.node-base.json",
"compilerOptions": { "compilerOptions": {
@@ -9,27 +7,9 @@
"composite": true, "composite": true,
"allowJs": true, "allowJs": true,
"checkJs": true, "checkJs": true,
"emitDeclarationOnly": true "emitDeclarationOnly": true,
"moduleResolution": "NodeNext"
}, },
"references": [ "include": ["src", "types"],
{ "exclude": ["dist-types", "**/__output/**", "**/__output-dev/**"]
"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/"
]
}

View File

@@ -13,7 +13,6 @@
}, },
"author": "Modern Web <hello@modern-web.dev> (https://modern-web.dev/)", "author": "Modern Web <hello@modern-web.dev> (https://modern-web.dev/)",
"homepage": "https://rocket.modern-web.dev/", "homepage": "https://rocket.modern-web.dev/",
"main": "./exports/index.js",
"type": "module", "type": "module",
"exports": { "exports": {
".": { ".": {
@@ -26,9 +25,10 @@
} }
}, },
"scripts": { "scripts": {
"prepublishOnly": "npm run types",
"test": "mocha --require ../../scripts/testMochaGlobalHooks.js test-node/**/*.test.{js,cjs} test-node/*.test.{js,cjs}", "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", "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" "xtest:watch": "mocha test/**/*.test.js --parallel --watch"
}, },
"files": [ "files": [
@@ -47,10 +47,17 @@
}, },
"devDependencies": {}, "devDependencies": {},
"types": "./dist-types/exports/index.d.ts", "types": "./dist-types/exports/index.d.ts",
"typesVersions": { "wireit": {
"*": { "types": {
"*": [ "command": "copyfiles \"./types/**/*.d.ts\" dist-types/ && tsc --build --pretty",
"./dist-types/exports/index.d.ts" "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() { constructor() {
super(); super();
/** @type {{ url: string, sourceRelativeFilePath: string }} */ this.inputDir = '';
/** @type {{ url: string, sourceRelativeFilePath: string }[]} */
this.pages = []; this.pages = [];
} }
/**
* @param {{ url: string, sourceRelativeFilePath: string }} options
*/
renderPage({ url, sourceRelativeFilePath }) { renderPage({ url, sourceRelativeFilePath }) {
const iframeUrl = url.endsWith('/') const iframeUrl = url.endsWith('/')
? `${url}index.opengraph.html` ? `${url}index.opengraph.html`

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,6 +1,8 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { html } from 'lit'; 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 }) { export function pageDefaults({ pageTree, titleWrapperFn, description, siteName }) {
return { return {
...defaultHead({ pageTree, titleWrapperFn, description, siteName }), ...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 }) { export function defaultHead({ pageTree, titleWrapperFn, description, siteName }) {
return { return {
/**
* @param {any} data
*/
head__10: data => { head__10: data => {
const useDescription = data.description ? data.description : description; const useDescription = data.description ? data.description : description;
const title = titleWrapperFn( const title = titleWrapperFn(pageTree.getPage(data.sourceRelativeFilePath)?.model?.name);
// @ts-ignore
pageTree.getPage(data.sourceRelativeFilePath)?.model?.name,
);
return html` return html`
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <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 }, siteName: { type: String },
}; };
constructor() {
super();
this.url = '';
this.name = '';
this.siteName = '';
}
render() { render() {
return html` return html`
<a <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

@@ -13,7 +13,6 @@
}, },
"author": "Modern Web <hello@modern-web.dev> (https://modern-web.dev/)", "author": "Modern Web <hello@modern-web.dev> (https://modern-web.dev/)",
"homepage": "https://rocket.modern-web.dev/", "homepage": "https://rocket.modern-web.dev/",
"main": "./src/index.js",
"bin": { "bin": {
"create-rocket": "src/cli.js" "create-rocket": "src/cli.js"
}, },
@@ -28,8 +27,7 @@
"prepublishOnly": "node ./scripts/prepublish.js", "prepublishOnly": "node ./scripts/prepublish.js",
"start": "node ./src/cli.js", "start": "node ./src/cli.js",
"test": "mocha test-node/**/*.test.{js,cjs} test-node/*.test.{js,cjs}", "test": "mocha test-node/**/*.test.{js,cjs} test-node/*.test.{js,cjs}",
"test:watch": "onchange 'src/**/*.{js,cjs}' 'test-node/**/*.{js,cjs}' -- npm test", "test:watch": "onchange 'src/**/*.{js,cjs}' 'test-node/**/*.{js,cjs}' -- npm test"
"types:copy": "copyfiles \"./types/**/*.d.ts\" dist-types/"
}, },
"files": [ "files": [
"deployments", "deployments",
@@ -49,13 +47,5 @@
"commander": "^9.0.0", "commander": "^9.0.0",
"degit": "^2.0.0", "degit": "^2.0.0",
"prompts": "^2.2.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 { Command } from 'commander';
import prompts from 'prompts'; import prompts from 'prompts';
import { underline, bold, gray, green, blue, yellow, red } from 'colorette'; import { underline, bold, gray, green, blue, yellow, red } from 'colorette';

View File

@@ -13,7 +13,6 @@
}, },
"author": "Modern Web <hello@modern-web.dev> (https://modern-web.dev/)", "author": "Modern Web <hello@modern-web.dev> (https://modern-web.dev/)",
"homepage": "https://rocket.modern-web.dev/docs/tools/engine/", "homepage": "https://rocket.modern-web.dev/docs/tools/engine/",
"main": "./src/index.js",
"type": "module", "type": "module",
"exports": { "exports": {
".": { ".": {
@@ -33,12 +32,13 @@
} }
}, },
"scripts": { "scripts": {
"debug": "DEBUG=engine:rendering yarn test", "debug": "DEBUG=engine:rendering npm run test",
"debug:integration": "PWDEBUG=1 yarn test:integration", "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": "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:integration": "playwright test test-node/*.spec.js --retries=3",
"test:watch": "onchange 'src/**/*.js' 'test-node/**/*.js' -- npm test", "test:watch": "onchange 'src/**/*.js' 'test-node/**/*.js' -- npm test",
"types:copy": "copyfiles \"./types/**/*.d.ts\" dist-types/" "types": "wireit"
}, },
"files": [ "files": [
"assets", "assets",
@@ -57,17 +57,21 @@
"sax-wasm": "^2.1.3", "sax-wasm": "^2.1.3",
"unist-util-visit": "^4.1.0" "unist-util-visit": "^4.1.0"
}, },
"types": "./dist-types/src/index.d.ts", "wireit": {
"typesVersions": { "types": {
"*": { "command": "copyfiles \"./types/**/*.d.ts\" dist-types/ && tsc --build --pretty",
"*": [ "dependencies": [
"./dist-types/src/index.d.ts" "../plugins-manager:types",
"../mdjs-core:types"
], ],
"server": [ "clean": "if-file-deleted",
"./dist-types/src/index.server.d.ts" "files": [
"src/**/*.js",
"tsconfig.json"
], ],
"hydration": [ "output": [
"./dist-types/src/index.hydration.d.ts" "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').EngineOptions} EngineOptions */
/** @typedef {import('../types/main.js').DevServerPlugin} DevServerPlugin */ /** @typedef {import('../types/main.js').DevServerPlugin} DevServerPlugin */
/** @typedef {import('../types/main.js').DevServerMiddleware} DevServerMiddleware */ /** @typedef {import('../types/main.js').DevServerMiddleware} DevServerMiddleware */
@@ -393,11 +391,6 @@ export class Engine {
return await urlToSourceFilePath(url, this.docsDir); return await urlToSourceFilePath(url, this.docsDir);
} }
/**
* @param {object} [options]
* @param {string} [options.triggerSourceFilePath]
* @param {boolean} [options.deleteOtherFiles]
*/
async renderAllOpenedFiles({ deleteOtherFiles = true, triggerSourceFilePath = '' } = {}) { async renderAllOpenedFiles({ deleteOtherFiles = true, triggerSourceFilePath = '' } = {}) {
if (this.watcher) { if (this.watcher) {
for (const [sourceFilePath, page] of this.watcher.pages.entries()) { 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 { existsSync } from 'fs';
import path from 'path'; import path from 'path';
import { debuglog } from 'util'; import { debuglog } from 'util';

View File

@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { existsSync } from 'fs'; import { existsSync } from 'fs';
import { readFile, writeFile } from 'fs/promises'; import { readFile, writeFile } from 'fs/promises';
import path from 'path'; import path from 'path';
@@ -191,11 +190,14 @@ export class RocketHeader {
const [, exports] = parse(readDataFile.toString()); const [, exports] = parse(readDataFile.toString());
for (const dataExportName of exports) { 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); const foundIndex = possibleImports.findIndex(el => el.importName === dataExportName);
if (foundIndex >= 0) { if (foundIndex >= 0) {
possibleImports[foundIndex].importModuleName = exportModuleName; possibleImports[foundIndex].importModuleName = exportModuleName;
} else { } else {
possibleImports.push({ possibleImports.push({
// @ts-ignore
importName: dataExportName, importName: dataExportName,
importModuleName: exportModuleName, importModuleName: exportModuleName,
}); });

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { renderJoiningGroup } from '../helpers/renderJoiningGroup.js'; import { renderJoiningGroup } from '../helpers/renderJoiningGroup.js';
import { html } from 'lit'; import { html } from 'lit';
import { classMap } from 'lit/directives/class-map.js'; 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 */ /** @typedef {import('lit').TemplateResult} TemplateResult */
export class LayoutRaw { export class LayoutRaw {

View File

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

View File

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

View File

@@ -86,7 +86,7 @@ async function renderFile({
openGraphUrl: url.replace(/\.html$/, '.opengraph.html'), openGraphUrl: url.replace(/\.html$/, '.opengraph.html'),
}; };
} }
/** @type {import('../../types/layout').renderData} */ /** @type {import('../../types/layout.js').renderData} */
const layoutData = { const layoutData = {
sourceFilePath, sourceFilePath,
outputFilePath, 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", "extends": "../../tsconfig.node-base.json",
"compilerOptions": { "compilerOptions": {
@@ -9,24 +7,10 @@
"composite": true, "composite": true,
"allowJs": true, "allowJs": true,
"checkJs": true, "checkJs": true,
"emitDeclarationOnly": true "emitDeclarationOnly": true,
"moduleResolution": "NodeNext"
}, },
"references": [ "references": [],
{ "include": ["src", "types"],
"path": "../plugins-manager/tsconfig.json" "exclude": ["dist-types"]
}, }
{
"path": "../mdjs-core/tsconfig.json"
}
],
"include": [
"src",
"*.js",
"types",
"preset"
],
"exclude": [
"dist",
"dist-types"
]
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { renderJoiningGroup, TableOfContentsMenu } from '@rocket/engine'; import { renderJoiningGroup, TableOfContentsMenu } from '@rocket/engine';
import { html } from 'lit'; import { html } from 'lit';
import { LayoutMain } from './LayoutMain.js'; 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 { LitElement, html, nothing } from 'lit';
import { LaunchBlogPreview } from './LaunchBlogPreview.js'; import { LaunchBlogPreview } from './LaunchBlogPreview.js';

View File

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

View File

@@ -5,7 +5,6 @@ import { BroadcastUpdatePlugin } from 'workbox-broadcast-update';
import { ExpirationPlugin } from 'workbox-expiration'; import { ExpirationPlugin } from 'workbox-expiration';
addEventListener('install', () => { addEventListener('install', () => {
/* eslint-disable @typescript-eslint/ban-ts-comment */
// @ts-ignore // @ts-ignore
skipWaiting(); skipWaiting();
/* eslint-enable @typescript-eslint/ban-ts-comment */ /* 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'; import { addPlugin } from 'plugins-manager';
class EnginePluginLaunch { 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", "extends": "../../tsconfig.node-base.json",
"compilerOptions": { "compilerOptions": {
@@ -9,29 +7,9 @@
"composite": true, "composite": true,
"allowJs": true, "allowJs": true,
"checkJs": true, "checkJs": true,
"emitDeclarationOnly": true "emitDeclarationOnly": true,
"moduleResolution": "NodeNext"
}, },
"references": [ "include": ["exports", "src", "types"],
{ "exclude": ["dist-types", "**/__output/**", "**/__output-dev/**"]
"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"
]
}

View File

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

View File

@@ -13,7 +13,6 @@
}, },
"author": "Modern Web <hello@modern-web.dev> (https://modern-web.dev/)", "author": "Modern Web <hello@modern-web.dev> (https://modern-web.dev/)",
"homepage": "https://rocket.modern-web.dev/docs/markdown-javascript/overview/", "homepage": "https://rocket.modern-web.dev/docs/markdown-javascript/overview/",
"main": "./index.js",
"type": "module", "type": "module",
"exports": { "exports": {
".": { ".": {
@@ -22,25 +21,20 @@
} }
}, },
"scripts": { "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": "npm run start:stories",
"start:script": "web-dev-server -c demo/script/server.js --root-dir ../../", "start:script": "web-dev-server -c demo/script/server.js --root-dir ../../",
"start:stories": "web-dev-server -c demo/stories/server.js --root-dir ../../", "start:stories": "web-dev-server -c demo/stories/server.js --root-dir ../../",
"test": "npm run test:node", "test": "npm run test:node",
"test:node": "mocha test-node", "test:node": "mocha test-node",
"test:watch": "mocha test-node --watch", "test:watch": "mocha test-node --watch",
"types:copy": "copyfiles -f \"./types/**/*.d.ts\" dist-types/types" "types": "wireit"
}, },
"files": [ "files": [
"*.d.ts",
"*.js",
"*.mjs",
"dist-types", "dist-types",
"src", "src"
"types"
], ],
"keywords": [ "keywords": [
"open-wc",
"markdown", "markdown",
"unified", "unified",
"remark" "remark"
@@ -73,5 +67,22 @@
"remark-slug": "^7.0.1", "remark-slug": "^7.0.1",
"remark-stringify": "^10.0.2" "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.js').Story} Story */
/** @typedef {import('../types/code').Story} Story */ /** @typedef {import('../types/code.js').ParseResult} ParseResult */
/** @typedef {import('../types/code').ParseResult} ParseResult */ /** @typedef {import('../types/code.js').ProcessResult} ProcessResult */
/** @typedef {import('../types/code').ProcessResult} ProcessResult */ /** @typedef {import('../types/code.js').MdjsProcessPlugin} MdjsProcessPlugin */
/** @typedef {import('../types/code').MdjsProcessPlugin} MdjsProcessPlugin */
import { unified } from 'unified'; import { unified } from 'unified';
import markdown from 'remark-parse'; import markdown from 'remark-parse';
import gfm from 'remark-gfm'; import gfm from 'remark-gfm';
// @ts-ignore
import remark2rehype from 'remark-rehype'; import remark2rehype from 'remark-rehype';
// @ts-ignore
import raw from 'rehype-raw'; import raw from 'rehype-raw';
// @ts-ignore
import htmlSlug from 'rehype-slug'; import htmlSlug from 'rehype-slug';
// @ts-ignore
import htmlHeading from 'rehype-autolink-headings'; import htmlHeading from 'rehype-autolink-headings';
// @ts-ignore
import rehypePrism from 'rehype-prism-plus'; import rehypePrism from 'rehype-prism-plus';
// @ts-ignore
import htmlStringify from 'rehype-stringify'; import htmlStringify from 'rehype-stringify';
import { executeSetupFunctions } from 'plugins-manager'; import { executeSetupFunctions } from 'plugins-manager';
import { mdjsParse } from './mdjsParse.js'; 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').Story} Story */
/** @typedef {import('../types/code.js').StoryTypes} StoryTypes */ /** @typedef {import('../types/code.js').StoryTypes} StoryTypes */
/** @typedef {(name: string) => string} TagFunction */ /** @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", "extends": "../../tsconfig.node-base.json",
"compilerOptions": { "compilerOptions": {
@@ -9,20 +7,9 @@
"composite": true, "composite": true,
"allowJs": true, "allowJs": true,
"checkJs": true, "checkJs": true,
"emitDeclarationOnly": true "emitDeclarationOnly": true,
"moduleResolution": "Node16"
}, },
"references": [ "include": ["src", "types"],
{ "exclude": ["dist-types"]
"path": "../plugins-manager/tsconfig.json" }
}
],
"include": [
"src",
"*.js",
"types"
],
"exclude": [
"dist",
"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", "type": "module",
"exports": { "exports": {
".": { ".": {
"types": "./dist-types/index.d.ts", "types": "./dist-types/src/index.d.ts",
"require": "./dist/index.cjs", "require": "./dist/index.cjs",
"default": "./index.js" "default": "./src/index.js"
} }
}, },
"scripts": { "scripts": {
"build:package": "rimraf dist && esbuild --platform=node --format=cjs --bundle --outfile=dist/index.cjs ./index.js", "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 ../../",
"prepublishOnly": "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": "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", "test:watch": "onchange 'src/**/*.{js,cjs}' 'test-node/**/*.{js,cjs}' -- npm test",
"types:copy": "copyfiles \"./types/**/*.d.ts\" dist-types/" "types": "wireit"
}, },
"files": [ "files": [
"*.js",
"dist", "dist",
"dist-types", "dist-types",
"src" "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 * @template {import('../types/main.js').Plugin} T
* @param {T} plugin * @param {T} plugin
* @param {import('../types/main.js').GetPluginOptions<T>} [options] * @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 * @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 */ /** @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'; import { addPlugin, applyPlugins } from 'plugins-manager';
const { expect } = chai;
describe('addPlugin', () => { describe('addPlugin', () => {
const insertPlugin = ({ firstName = 'first', lastName = 'last' } = {}) => const insertPlugin = ({ firstName = 'first', lastName = 'last' } = {}) =>
@@ -11,15 +9,7 @@ describe('addPlugin', () => {
const secondPlugin = () => 'secondPlugin'; const secondPlugin = () => 'secondPlugin';
const thirdPlugin = () => 'thirdPlugin'; const thirdPlugin = () => 'thirdPlugin';
/**
* @template T
* @type {import('../types/main.js.js').MetaPlugin<T>[]}
*/
const oneExistingPlugin = [{ plugin: firstPlugin, options: {} }]; const oneExistingPlugin = [{ plugin: firstPlugin, options: {} }];
/**
* @template T
* @type {import('../types/main.js.js').MetaPlugin<T>[]}
*/
const threeExistingPlugins = [ const threeExistingPlugins = [
{ plugin: firstPlugin, options: {} }, { plugin: firstPlugin, options: {} },
{ plugin: secondPlugin, 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 () => { 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) { function myWrapper(plugin) {
return () => 'wrapped' + plugin(); return () => 'wrapped' + plugin();
} }
const config = applyPlugins({ const config = applyPlugins({
setupPlugins: [addPlugin(insertPlugin)].map(mod => { setupPlugins: [addPlugin(insertPlugin)].map(mod => {
// @ts-ignore
mod.wrapPlugin = myWrapper; mod.wrapPlugin = myWrapper;
return mod; return mod;
}), }),

View File

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

View File

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

View File

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

View File

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

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", "extends": "../../tsconfig.node-base.json",
"compilerOptions": { "compilerOptions": {
@@ -9,16 +7,17 @@
"composite": true, "composite": true,
"allowJs": true, "allowJs": true,
"checkJs": true, "checkJs": true,
"emitDeclarationOnly": true "emitDeclarationOnly": true,
"moduleResolution": "Node16"
}, },
"references": [], "references": [],
"include": [ "include": [
"src", "src",
"*.js", "types",
"types" "test-node"
], ],
"exclude": [ "exclude": [
"dist", "dist",
"dist-types" "dist-types"
] ]
} }

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