mirror of
https://github.com/modernweb-dev/rocket.git
synced 2026-03-21 15:54:57 +00:00
Compare commits
13 Commits
check-html
...
update
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fdf4cd6723 | ||
|
|
74b2b35812 | ||
|
|
685e6fd9b4 | ||
|
|
ecfa631367 | ||
|
|
80ff4be34a | ||
|
|
3fd736c213 | ||
|
|
f3cc3b8050 | ||
|
|
a049a82141 | ||
|
|
a868ff13e4 | ||
|
|
5f4a86b1a8 | ||
|
|
79e6f0df33 | ||
|
|
04621c3f16 | ||
|
|
1cd9508384 |
6
.changeset/big-meals-matter.md
Normal file
6
.changeset/big-meals-matter.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
'@rocket/building-rollup': minor
|
||||
'@rocket/cli': minor
|
||||
---
|
||||
|
||||
Update to Rollup v3 + all plugins that require it
|
||||
5
.changeset/real-moose-check.md
Normal file
5
.changeset/real-moose-check.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@rocket/building-rollup': patch
|
||||
---
|
||||
|
||||
fix json5 security vulnerability
|
||||
@@ -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
|
||||
|
||||
28
.github/workflows/release.yml
vendored
28
.github/workflows/release.yml
vendored
@@ -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 }}
|
||||
|
||||
53
.github/workflows/verify.yml
vendored
53
.github/workflows/verify.yml
vendored
@@ -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
8
.gitignore
vendored
@@ -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
|
||||
|
||||
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@@ -8,5 +8,5 @@
|
||||
"**/*-mdjs-generated.js": true,
|
||||
"**/dist-types": true,
|
||||
},
|
||||
"editor.experimental.stickyScroll.enabled": true
|
||||
"editor.stickyScroll.enabled": true
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
2
examples/01-hydration-starter/.gitignore
vendored
2
examples/01-hydration-starter/.gitignore
vendored
@@ -3,8 +3,6 @@ node_modules/
|
||||
|
||||
# logs
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# environment variables
|
||||
.env
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"@rocket/cli": "^0.20.0",
|
||||
"@rocket/engine": "^0.2.0",
|
||||
"@webcomponents/template-shadowroot": "^0.1.0",
|
||||
"lit": "^2.3.0"
|
||||
"lit": "^3.0.0"
|
||||
},
|
||||
"@rocket/template-name": "Hydration Starter",
|
||||
"imports": {
|
||||
|
||||
2
examples/02-blog-starter/.gitignore
vendored
2
examples/02-blog-starter/.gitignore
vendored
@@ -3,8 +3,6 @@ node_modules/
|
||||
|
||||
# logs
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# environment variables
|
||||
.env
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
"devDependencies": {
|
||||
"@rocket/cli": "^0.20.0",
|
||||
"@rocket/engine": "^0.2.0",
|
||||
"lit": "^2.3.0"
|
||||
"lit": "^3.0.0"
|
||||
},
|
||||
"@rocket/template-name": "Blog Starter"
|
||||
}
|
||||
|
||||
2
examples/03-minimal-starter/.gitignore
vendored
2
examples/03-minimal-starter/.gitignore
vendored
@@ -3,8 +3,6 @@ node_modules/
|
||||
|
||||
# logs
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# environment variables
|
||||
.env
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"devDependencies": {
|
||||
"@rocket/cli": "^0.20.0",
|
||||
"@rocket/engine": "^0.2.0",
|
||||
"lit": "^2.3.0"
|
||||
"lit": "^3.0.0"
|
||||
},
|
||||
"@rocket/template-name": "Minimal Starter"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,2 @@
|
||||
/dist
|
||||
/node_modules
|
||||
|
||||
yarn.lock
|
||||
@@ -3,7 +3,6 @@
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "package.json",
|
||||
"author": "Jaydan Urwin <jaydan@jaydanurwin.com>",
|
||||
"license": "UNLICENSED",
|
||||
"scripts": {
|
||||
|
||||
@@ -3,8 +3,6 @@ node_modules/
|
||||
|
||||
# logs
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# environment variables
|
||||
.env
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
"@sanity/client": "^3.1.0",
|
||||
"@sanity/image-url": "^1.0.1",
|
||||
"dotenv": "^16.0.0",
|
||||
"lit": "^2.3.0"
|
||||
"lit": "^3.0.0"
|
||||
},
|
||||
"@rocket/template-name": "Sanity Minimal Starter"
|
||||
}
|
||||
|
||||
2
examples/50-landing-theme-spark/.gitignore
vendored
2
examples/50-landing-theme-spark/.gitignore
vendored
@@ -3,8 +3,6 @@ node_modules/
|
||||
|
||||
# logs
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# environment variables
|
||||
.env
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
"@rocket/components": "^0.2.0",
|
||||
"@rocket/engine": "^0.2.0",
|
||||
"@rocket/spark": "^0.2.0",
|
||||
"lit": "^2.3.0"
|
||||
"lit": "^3.0.0"
|
||||
},
|
||||
"@rocket/template-name": "Landing Page (@rocket/spark Theme)",
|
||||
"imports": {
|
||||
|
||||
2
examples/51-docs-theme-launch/.gitignore
vendored
2
examples/51-docs-theme-launch/.gitignore
vendored
@@ -3,8 +3,6 @@ node_modules/
|
||||
|
||||
# logs
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# environment variables
|
||||
.env
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
"@rocket/engine": "^0.2.0",
|
||||
"@rocket/launch": "^0.21.0",
|
||||
"@rocket/search": "^0.7.0",
|
||||
"lit": "^2.3.0"
|
||||
"lit": "^3.0.0"
|
||||
},
|
||||
"@rocket/template-name": "Documentation Website (@rocket/launch Theme)",
|
||||
"imports": {
|
||||
|
||||
18371
package-lock.json
generated
Normal file
18371
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
50
package.json
50
package.json
@@ -10,9 +10,9 @@
|
||||
"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",
|
||||
"build:start": "npm run rocket:build && cd _site && npx http-server -o -p 9000",
|
||||
"changeset": "changeset",
|
||||
"debug": "web-test-runner --watch --config web-test-runner-chrome.config.mjs",
|
||||
"debug:firefox": "web-test-runner --watch --config web-test-runner-firefox.config.mjs",
|
||||
@@ -25,40 +25,35 @@
|
||||
"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",
|
||||
"start:build": "cd _site && npx http-server -o -p 9000",
|
||||
"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 +85,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 +113,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": {
|
||||
|
||||
@@ -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';
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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: {},
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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: {
|
||||
|
||||
@@ -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: {
|
||||
|
||||
11
packages/building-rollup/src/index.js
Normal file
11
packages/building-rollup/src/index.js
Normal 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';
|
||||
@@ -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>');
|
||||
|
||||
@@ -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 () => {
|
||||
|
||||
15
packages/building-rollup/tsconfig.json
Normal file
15
packages/building-rollup/tsconfig.json
Normal 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"]
|
||||
}
|
||||
8
packages/building-rollup/types/main.d.ts
vendored
Normal file
8
packages/building-rollup/types/main.d.ts
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import { RollupOptions } from 'rollup';
|
||||
|
||||
interface BuildingRollupOptions extends RollupOptions {
|
||||
developmentMode?: boolean;
|
||||
rootDir?: string;
|
||||
absoluteBaseUrl?: string;
|
||||
setupPlugins?: function[];
|
||||
}
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
||||
|
||||
/** @typedef {import('../types/main').CheckHtmlLinksCliOptions} CheckHtmlLinksCliOptions */
|
||||
|
||||
import path from 'path';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
||||
import fs from 'fs';
|
||||
import saxWasm from 'sax-wasm';
|
||||
import minimatch from 'minimatch';
|
||||
|
||||
@@ -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.4.1",
|
||||
"@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"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
||||
import path from 'path';
|
||||
|
||||
import { existsSync } from 'fs';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
||||
|
||||
// @ts-ignore
|
||||
import { CheckHtmlLinksCli } from 'check-html-links';
|
||||
import { bold, gray } from 'colorette';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
||||
// @ts-nocheck
|
||||
|
||||
/**
|
||||
|
||||
@@ -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');
|
||||
});
|
||||
|
||||
|
||||
@@ -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/**"]
|
||||
}
|
||||
|
||||
@@ -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": [
|
||||
@@ -43,14 +43,21 @@
|
||||
"dependencies": {
|
||||
"@webcomponents/template-shadowroot": "^0.1.0",
|
||||
"fontawesome-free": "^1.0.4",
|
||||
"lit": "^2.3.0"
|
||||
"lit": "^3.0.0"
|
||||
},
|
||||
"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"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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`
|
||||
|
||||
@@ -12,6 +12,8 @@ export class RocketRotatingText extends LitElement {
|
||||
this.initIndex = 0;
|
||||
this.inIndex = 0;
|
||||
this.outIndex = -1;
|
||||
/** @type {string[]} */
|
||||
this.items = [];
|
||||
}
|
||||
|
||||
next() {
|
||||
|
||||
@@ -5,6 +5,11 @@ export class RocketTestimonialSmall extends LitElement {
|
||||
cite: { type: String },
|
||||
};
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.cite = '';
|
||||
}
|
||||
|
||||
static styles = css`
|
||||
:host {
|
||||
display: block;
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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" />
|
||||
|
||||
@@ -19,6 +19,13 @@ export class RocketSocialLink extends LitElement {
|
||||
siteName: { type: String },
|
||||
};
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.url = '';
|
||||
this.name = '';
|
||||
this.siteName = '';
|
||||
}
|
||||
|
||||
render() {
|
||||
return html`
|
||||
<a
|
||||
|
||||
15
packages/components/tsconfig.json
Normal file
15
packages/components/tsconfig.json
Normal 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"]
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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",
|
||||
@@ -47,27 +47,31 @@
|
||||
],
|
||||
"dependencies": {
|
||||
"@d4kmor/tree-model": "^0.1.3",
|
||||
"@lit-labs/ssr": "^2.2.3",
|
||||
"@lit-labs/ssr": "^3.0.0",
|
||||
"@mdjs/core": "^0.20.0",
|
||||
"@parcel/watcher": "^2.0.5",
|
||||
"@web/dev-server": "^0.1.4",
|
||||
"es-module-lexer": "^0.10.5",
|
||||
"lit": "^2.3.0",
|
||||
"lit": "^3.0.0",
|
||||
"plugins-manager": "^0.3.0",
|
||||
"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"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
||||
import { existsSync } from 'fs';
|
||||
import path from 'path';
|
||||
import { debuglog } from 'util';
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
||||
// @ts-ignore
|
||||
import { mdjsProcess } from '@mdjs/core';
|
||||
import { existsSync } from 'fs';
|
||||
|
||||
@@ -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');
|
||||
@@ -268,7 +267,9 @@ export class HydrationLoader {
|
||||
if (this.isSetup === false) {
|
||||
// Start fetching the Lit hydration support module (note the absence
|
||||
// of "await" -- we don't want to block yet).
|
||||
const litHydrateSupportInstalled = import('lit/experimental-hydrate-support.js');
|
||||
const litHydrateSupportInstalled = import(
|
||||
'@lit-labs/ssr-client/lit-element-hydrate-support.js'
|
||||
);
|
||||
|
||||
// Check if we require the declarative shadow DOM polyfill. As of
|
||||
// February 2022, Chrome and Edge have native support, but Firefox
|
||||
|
||||
@@ -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 }) {
|
||||
|
||||
@@ -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: [],
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
||||
/** @typedef {import('lit').TemplateResult} TemplateResult */
|
||||
|
||||
export class LayoutRaw {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
||||
// @ts-nocheck
|
||||
import path from 'path';
|
||||
import { TreeModel } from '@d4kmor/tree-model';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
||||
import { Menu } from './Menu.js';
|
||||
|
||||
/** @typedef {import('lit').TemplateResult} TemplateResult */
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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"]
|
||||
}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"include": ["src", "*.js", "types", "preset"]
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
export { LaunchContent } from '../src/content/LaunchContent.js';
|
||||
@@ -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",
|
||||
@@ -50,18 +53,28 @@
|
||||
"@rocket/components": "^0.2.0",
|
||||
"@rocket/engine": "^0.2.7",
|
||||
"@webcomponents/template-shadowroot": "^0.1.0",
|
||||
"lit": "^2.3.0",
|
||||
"lit": "^3.0.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"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
||||
import {
|
||||
Layout,
|
||||
renderJoiningGroup,
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
||||
import { LitElement, html, nothing } from 'lit';
|
||||
import { LaunchBlogPreview } from './LaunchBlogPreview.js';
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
||||
(async () => {
|
||||
if ('serviceWorker' in navigator) {
|
||||
const { Workbox } = await import('workbox-window');
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
||||
import { addPlugin } from 'plugins-manager';
|
||||
|
||||
class EnginePluginLaunch {
|
||||
|
||||
@@ -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/**"]
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ Foo is great
|
||||
## How to Use
|
||||
|
||||
```bash
|
||||
yarn add @foo/demo-wc-card
|
||||
npm install @foo/demo-wc-card
|
||||
```
|
||||
|
||||
```js
|
||||
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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"]
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ export {
|
||||
getCompatibleStyle,
|
||||
supportsAdoptingStyleSheets,
|
||||
unsafeCSS,
|
||||
UpdatingElement,
|
||||
notEqual,
|
||||
ReactiveElement,
|
||||
svg,
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
"dependencies": {
|
||||
"@lion/accordion": "^0.9.0",
|
||||
"@open-wc/scoped-elements": "^2.0.0",
|
||||
"lit": "^2.3.0"
|
||||
"lit": "^3.0.0"
|
||||
},
|
||||
"types": "dist-types/index.d.ts"
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ export class LayoutSimulator {
|
||||
import { render } from '@mdjs/mdjs-story';
|
||||
|
||||
function sanitize(input, type) {
|
||||
console.log('sanitize', input, type);
|
||||
return \`\${document.location.origin}/\${
|
||||
input.match(/[a-zA-Z0-9-_\\/]*/)[0]
|
||||
}.\${type}\`;
|
||||
|
||||
@@ -671,7 +671,6 @@ export class MdJsPreview extends ScopedElementsMixin(LitElement) {
|
||||
? html`
|
||||
<iframe
|
||||
part="iframe"
|
||||
csp=${`script-src ${document.location.origin} 'unsafe-inline'; connect-src ws://${document.location.host}/`}
|
||||
.src=${this.iframeUrl}
|
||||
style=${`width: ${this.sizeData.width}px; height: ${this.deviceHeight}px;`}
|
||||
></iframe>
|
||||
@@ -963,6 +962,10 @@ export class MdJsPreview extends ScopedElementsMixin(LitElement) {
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
iframe {
|
||||
min-height: 50px;
|
||||
}
|
||||
|
||||
/** Showing/Hiding additional code blocks **/
|
||||
::slotted(pre) {
|
||||
display: none;
|
||||
|
||||
@@ -6,14 +6,18 @@ export function addResizeHandler() {
|
||||
return;
|
||||
}
|
||||
window.addEventListener('message', ev => {
|
||||
const data = JSON.parse(ev.data);
|
||||
if (data.action === 'mdjs-viewer-resize') {
|
||||
const viewer = /** @type {import('./MdJsPreview.js').MdJsPreview} */ (
|
||||
document.body.querySelector(`[mdjs-story-name="${data.storyKey}"]`)
|
||||
);
|
||||
if (viewer) {
|
||||
viewer.contentHeight = data.height;
|
||||
try {
|
||||
const data = JSON.parse(ev.data);
|
||||
if (data.action === 'mdjs-viewer-resize') {
|
||||
const viewer = /** @type {import('./MdJsPreview.js').MdJsPreview} */ (
|
||||
document.body.querySelector(`[mdjs-story-name="${data.storyKey}"]`)
|
||||
);
|
||||
if (viewer) {
|
||||
viewer.contentHeight = data.height;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
// do nothing
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ export {
|
||||
getCompatibleStyle,
|
||||
supportsAdoptingStyleSheets,
|
||||
unsafeCSS,
|
||||
UpdatingElement,
|
||||
notEqual,
|
||||
ReactiveElement,
|
||||
svg,
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
"src"
|
||||
],
|
||||
"dependencies": {
|
||||
"lit": "^2.3.0"
|
||||
"lit": "^3.0.0"
|
||||
},
|
||||
"types": "dist-types/index.d.ts"
|
||||
}
|
||||
|
||||
@@ -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';
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user