├── .changeset ├── README.md └── config.json ├── .github └── workflows │ └── ci.yml ├── .gitignore ├── .prettierrc ├── .vscode └── settings.json ├── README.md ├── TODOS.md ├── bundless ├── CHANGELOG.md ├── bin.js ├── package.json ├── src │ ├── build │ │ └── index.ts │ ├── cli.ts │ ├── client │ │ ├── template.ts │ │ └── types.ts │ ├── config.ts │ ├── constants.ts │ ├── hmr-graph.ts │ ├── index.ts │ ├── logger.ts │ ├── middleware │ │ ├── history-fallback.ts │ │ ├── index.ts │ │ ├── open-in-editor.ts │ │ ├── plugins.ts │ │ ├── sourcemap.ts │ │ └── static-serve.ts │ ├── plugins-executor.ts │ ├── plugins │ │ ├── assets.ts │ │ ├── buffer.ts │ │ ├── css.ts │ │ ├── env.ts │ │ ├── esbuild.ts │ │ ├── hmr-client.ts │ │ ├── html-ingest.ts │ │ ├── html-resolver.ts │ │ ├── html-transform.ts │ │ ├── index.ts │ │ ├── json.ts │ │ ├── resolve-sourcemaps.ts │ │ ├── rewrite │ │ │ ├── __snapshots__ │ │ │ │ └── commonjs.test.ts.snap │ │ │ ├── commonjs.test.ts │ │ │ ├── commonjs.ts │ │ │ ├── index.ts │ │ │ └── rewrite.ts │ │ ├── source-map-support.ts │ │ └── url-resolver.ts │ ├── prebundle │ │ ├── __snapshots__ │ │ │ └── prebundle.test.ts.snap │ │ ├── esbuild.ts │ │ ├── index.ts │ │ ├── prebundle.test.ts │ │ ├── prebundle.ts │ │ ├── stats.ts │ │ ├── support.ts │ │ └── traverse.ts │ ├── serve.ts │ └── utils │ │ ├── index.ts │ │ ├── path.test.ts │ │ ├── path.ts │ │ ├── profiling.test.ts │ │ ├── profiling.ts │ │ ├── sourcemaps.ts │ │ └── utils.ts └── tsconfig.json ├── examples ├── react-javascript │ ├── .gitignore │ ├── bundless.config.js │ ├── package.json │ ├── public │ │ └── index.html │ └── src │ │ ├── app.jsx │ │ ├── index.jsx │ │ └── styles.css ├── react-typescript │ ├── .gitignore │ ├── bundless.config.js │ ├── package.json │ ├── public │ │ └── index.html │ ├── src │ │ ├── app.tsx │ │ ├── index.tsx │ │ └── styles.css │ └── tsconfig.json ├── svelte │ ├── .gitignore │ ├── bundless.config.js │ ├── package.json │ ├── public │ │ ├── favicon.png │ │ └── index.html │ ├── scripts │ │ └── setupTypeScript.js │ └── src │ │ ├── App.svelte │ │ ├── global.css │ │ └── main.js └── vanilla-javascript │ ├── .gitignore │ ├── bundless.config.js │ ├── package.json │ ├── public │ └── index.html │ └── src │ ├── index.js │ └── styles.css ├── fixtures ├── html-page │ ├── __mirror__ │ │ └── index.html │ ├── __snapshots__ │ └── index.html ├── outsider.js ├── resolve-sourcemap │ ├── __mirror__ │ │ ├── folder │ │ │ └── main.js │ │ └── index.html │ ├── __snapshots__ │ ├── folder │ │ ├── main.js │ │ └── main.js.map │ └── index.html ├── serve-outside-root │ ├── __mirror__ │ │ ├── __..__ │ │ │ └── outsider.js │ │ ├── index.html │ │ └── main.js │ ├── __snapshots__ │ ├── index.html │ └── main.js ├── simple-js │ ├── __mirror__ │ │ ├── index.html │ │ └── main.js │ ├── __snapshots__ │ ├── index.html │ └── main.js ├── with-alias-plugin │ ├── __mirror__ │ │ ├── index.html │ │ ├── main.tsx │ │ └── text.ts │ ├── __snapshots__ │ ├── bundless.config.js │ ├── index.html │ ├── main.tsx │ ├── package.json │ └── text.ts ├── with-assets-imports │ ├── __mirror__ │ │ ├── dynamic-import.js │ │ ├── file.css.cssjs │ │ ├── image.png │ │ ├── index.html │ │ └── main.js │ ├── __snapshots__ │ ├── bundless.config.js │ ├── dynamic-import.js │ ├── file.css │ ├── image.png │ ├── index.html │ └── main.js ├── with-babel-plugin │ ├── __mirror__ │ │ ├── index.html │ │ └── main.tsx │ ├── __snapshots__ │ ├── bundless.config.js │ ├── index.html │ ├── main.tsx │ └── package.json ├── with-commonjs-transform │ ├── .bundless │ │ ├── bundleMap.json │ │ └── commonjs.json │ ├── __mirror__ │ │ ├── index.html │ │ └── main.jsx │ ├── __snapshots__ │ ├── index.html │ ├── main.jsx │ └── package.json ├── with-css-modules │ ├── __mirror__ │ │ ├── file.js │ │ ├── file.module.css.cssjs │ │ ├── index.html │ │ └── main.js │ ├── __snapshots__ │ ├── file.js │ ├── file.module.css │ ├── index.html │ └── main.js ├── with-css │ ├── __mirror__ │ │ ├── file.css.cssjs │ │ ├── file.js │ │ ├── index.html │ │ └── main.js │ ├── __snapshots__ │ ├── file.css │ ├── file.js │ ├── index.html │ └── main.js ├── with-custom-assets │ ├── __mirror__ │ │ ├── file.dat │ │ ├── file.fakecss.cssjs │ │ ├── file.fakejs │ │ ├── file.js │ │ ├── file.svg │ │ ├── index.html │ │ ├── main.js │ │ └── x.DAC │ ├── __snapshots__ │ ├── bundless.config.js │ ├── file.dat │ ├── file.fakecss │ ├── file.fakejs │ ├── file.js │ ├── file.svg │ ├── index.html │ ├── main.js │ └── x.DAC ├── with-dependencies-assets │ ├── .bundless │ │ ├── bundleMap.json │ │ └── commonjs.json │ ├── __mirror__ │ │ ├── index.html │ │ └── main.js │ ├── __snapshots__ │ ├── index.html │ ├── main.js │ └── package.json ├── with-dependencies │ ├── .bundless │ │ ├── bundleMap.json │ │ └── commonjs.json │ ├── __mirror__ │ │ ├── index.html │ │ └── main.js │ ├── __snapshots__ │ ├── index.html │ └── main.js ├── with-dynamic-import │ ├── __mirror__ │ │ ├── index.html │ │ ├── main.js │ │ └── text.js │ ├── __snapshots__ │ ├── index.html │ ├── main.js │ └── text.js ├── with-env-plugin │ ├── __mirror__ │ │ ├── index.html │ │ └── main.tsx │ ├── __snapshots__ │ ├── bundless.config.js │ ├── envfile │ ├── index.html │ └── main.tsx ├── with-esbuild-plugins │ ├── __mirror__ │ │ ├── fake.js │ │ ├── file.gql │ │ ├── index.html │ │ └── main.js │ ├── __snapshots__ │ ├── bundless.config.js │ ├── fake.js │ ├── file.gql │ ├── index.html │ └── main.js ├── with-imports │ ├── __mirror__ │ │ ├── index.html │ │ ├── main.js │ │ └── text.js │ ├── __snapshots__ │ ├── index.html │ ├── main.js │ └── text.js ├── with-json │ ├── __mirror__ │ │ ├── index.html │ │ ├── main.js │ │ └── text.json │ ├── __snapshots__ │ ├── index.html │ ├── main.js │ └── text.json ├── with-linked-workspace │ ├── .bundless │ │ ├── bundleMap.json │ │ └── commonjs.json │ ├── __mirror__ │ │ ├── __..__ │ │ │ └── with-many-dependencies │ │ │ │ └── main.js │ │ ├── index.html │ │ └── main.js │ ├── __snapshots__ │ ├── index.html │ ├── main.js │ └── package.json ├── with-links │ ├── __mirror__ │ │ └── index.html │ ├── __snapshots__ │ ├── index.html │ ├── public │ │ ├── manifest.json │ │ └── styles1.css │ └── styles2.css ├── with-many-dependencies │ ├── .bundless │ │ ├── bundleMap.json │ │ └── commonjs.json │ ├── __mirror__ │ │ ├── index.html │ │ └── main.js │ ├── __snapshots__ │ ├── bundless.config.js │ ├── index.html │ ├── main.js │ └── package.json ├── with-many-entries │ ├── __mirror__ │ │ ├── a │ │ │ ├── index.html │ │ │ ├── main.css.cssjs │ │ │ └── main.js │ │ ├── b │ │ │ ├── index.html │ │ │ ├── main.js │ │ │ └── text.js │ │ └── common.css.cssjs │ ├── __snapshots__ │ ├── a │ │ ├── index.html │ │ ├── main.css │ │ └── main.js │ ├── b │ │ ├── index.html │ │ ├── main.js │ │ └── text.js │ ├── bundless.config.js │ └── common.css ├── with-node-polyfills │ ├── __mirror__ │ │ ├── index.html │ │ ├── main.js │ │ └── path │ ├── __snapshots__ │ ├── index.html │ └── main.js ├── with-sourcemaps │ ├── .bundless │ │ ├── bundleMap.json │ │ └── commonjs.json │ ├── __mirror__ │ │ ├── index.html │ │ ├── js.js │ │ ├── main.ts │ │ └── text.js │ ├── __snapshots__ │ ├── index.html │ ├── js.js │ ├── main.ts │ ├── package.json │ └── text.js ├── with-svelte │ ├── .bundless │ │ ├── bundleMap.json │ │ └── commonjs.json │ ├── App.svelte │ ├── __mirror__ │ │ ├── App.svelte │ │ ├── App.svelte.css │ │ ├── index.html │ │ └── main.js │ ├── __snapshots__ │ ├── bundless.config.js │ ├── index.html │ ├── main.js │ └── package.json ├── with-tsconfig-paths │ ├── __mirror__ │ │ ├── index.html │ │ ├── main.tsx │ │ └── text.ts │ ├── __snapshots__ │ ├── bundless.config.js │ ├── index.html │ ├── main.tsx │ ├── package.json │ └── text.ts ├── with-tsx │ ├── __mirror__ │ │ ├── index.html │ │ ├── main.tsx │ │ ├── text.ts │ │ └── utils.ts │ ├── __snapshots__ │ ├── index.html │ ├── main.tsx │ ├── text.ts │ └── utils.ts ├── with-typescript │ ├── __mirror__ │ │ ├── index.html │ │ ├── main.ts │ │ ├── text.ts │ │ └── utils.ts │ ├── __snapshots__ │ ├── index.html │ ├── main.ts │ ├── text.ts │ └── utils.ts └── with-yarn-berry-paths │ ├── $$virtual │ └── react-dom-virtual-73426b59bc │ │ └── 0 │ │ └── cache │ │ └── react-dom-npm-16.13.1-b0abd8a83a-fb5c3ad413.zip │ │ └── react-dom │ │ └── index.js │ ├── __mirror__ │ ├── $$virtual │ │ └── react-dom-virtual-73426b59bc │ │ │ └── 0 │ │ │ └── cache │ │ │ └── react-dom-npm-16.13.1-b0abd8a83a-fb5c3ad413.zip │ │ │ └── react-dom │ │ │ └── index.js │ ├── index.html │ └── main.js │ ├── __snapshots__ │ ├── index.html │ └── main.js ├── hmr-test-app ├── __snapshots__ │ ├── bundless │ ├── snowpack │ └── vite ├── bundless.config.js ├── index.test.ts ├── package.json ├── public │ ├── bundless │ │ └── index.html │ ├── index.html │ ├── snowpack │ │ └── index.html │ └── vite │ │ └── index.html ├── snowpack.config.js ├── src │ ├── bridge.jsx │ ├── file.css │ ├── file.json │ ├── file.jsx │ ├── file.module.css │ ├── file2.js │ ├── imported-many-times.js │ └── main.jsx ├── tsconfig.json └── vite.config.js ├── jest.config.js ├── package.json ├── paged ├── CHANGELOG.md ├── README.md ├── package.json ├── src │ ├── client │ │ ├── context.ts │ │ └── index.ts │ ├── constants.ts │ ├── export.tsx │ ├── index.tsx │ ├── plugin.tsx │ ├── routes.ts │ └── server.tsx └── tsconfig.json ├── plugins ├── alias │ ├── CHANGELOG.md │ ├── README.md │ ├── package.json │ ├── src │ │ └── index.ts │ └── tsconfig.json ├── babel │ ├── CHANGELOG.md │ ├── README.md │ ├── package.json │ ├── src │ │ └── index.ts │ └── tsconfig.json ├── react-refresh │ ├── CHANGELOG.md │ ├── package.json │ ├── src │ │ └── index.ts │ └── tsconfig.json ├── svelte │ ├── CHANGELOG.md │ ├── package.json │ ├── src │ │ ├── index.ts │ │ └── typescript.ts │ ├── tsconfig.json │ └── yarn-error.log └── tsconfig-paths │ ├── package.json │ ├── src │ └── index.ts │ └── tsconfig.json ├── scripts ├── analyze.ts ├── index.html ├── partition.ts ├── scc.ts ├── topological.ts ├── tsconfig.json └── ws.ts ├── tests ├── CHANGELOG.md ├── fixtures.test.ts ├── package.json └── utils.ts ├── tsconfig.base.json ├── website ├── .gitignore ├── components │ └── GradientBg.tsx ├── constants.ts ├── next-env.d.ts ├── next.config.js ├── package.json ├── pages │ ├── _app.tsx │ ├── docs │ │ ├── benchmarks.mdx │ │ ├── cli.mdx │ │ ├── config.mdx │ │ ├── faq.mdx │ │ ├── how-it-works.mdx │ │ ├── index.mdx │ │ ├── integrations │ │ │ ├── alias.mdx │ │ │ ├── babel.mdx │ │ │ └── react-refresh.mdx │ │ └── migration.mdx │ └── index.tsx ├── public │ ├── benchmark_charts_image.png │ ├── benchmarks_cli.png │ ├── benchmarks_image.jpg │ ├── browser_image.jpg │ ├── build_speed_feature_image.png │ ├── build_speed_image.jpg │ ├── dev_server_feature_image.png │ ├── dev_server_image.jpg │ ├── gradient-bg.svg │ └── vscode_image.jpg └── tsconfig.json ├── with-pages ├── .bundless │ ├── bundleMap.json │ └── commonjs.json ├── CHANGELOG.md ├── components.tsx ├── export.js ├── index.test.ts ├── package.json ├── pages │ ├── about.tsx │ ├── dynamic-import.tsx │ ├── folder │ │ ├── about.tsx │ │ └── index.tsx │ ├── index.tsx │ └── slugs │ │ ├── [slug].tsx │ │ └── all │ │ └── [...slugs].tsx ├── rpc │ └── example.ts └── server.js └── yarn.lock /.changeset/README.md: -------------------------------------------------------------------------------- 1 | # Changesets 2 | 3 | Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works 4 | with multi-package repos, or single-package repos to help you version and publish your code. You can 5 | find the full documentation for it [in our repository](https://github.com/changesets/changesets) 6 | 7 | We have a quick list of common questions to get you started engaging with this project in 8 | [our documentation](https://github.com/changesets/changesets/blob/master/docs/common-questions.md) 9 | -------------------------------------------------------------------------------- /.changeset/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://unpkg.com/@changesets/config@1.4.0/schema.json", 3 | "changelog": "@changesets/cli/changelog", 4 | "commit": false, 5 | "linked": [], 6 | "access": "public", 7 | "baseBranch": "master", 8 | "___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": { 9 | "onlyUpdatePeerDependentsWhenOutOfRange": true 10 | }, 11 | "updateInternalDependencies": "patch" 12 | } 13 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: Npm Package 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | 8 | jobs: 9 | build: 10 | runs-on: ${{ matrix.os }} 11 | strategy: 12 | matrix: 13 | os: 14 | - macos-latest 15 | - windows-latest 16 | steps: 17 | - uses: actions/checkout@v2 18 | with: 19 | fetch-depth: 0 20 | - uses: actions/setup-node@v1 21 | with: 22 | node-version: 12 23 | registry-url: https://registry.npmjs.org/ 24 | # caching 25 | - name: Get yarn cache directory path 26 | id: yarn-cache-dir-path 27 | run: echo "::set-output name=dir::$(yarn cache dir)" 28 | - uses: actions/cache@v2 29 | id: yarn-cache 30 | with: 31 | path: ${{ steps.yarn-cache-dir-path.outputs.dir }} 32 | key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} 33 | restore-keys: | 34 | ${{ runner.os }}-yarn- 35 | - uses: actions/cache@v2 36 | with: 37 | path: ~/.npm 38 | key: ${{ runner.os }}-npm- 39 | restore-keys: | 40 | ${{ runner.os }}-npm- 41 | # scripts 42 | - run: yarn 43 | - run: yarn ultra --rebuild -r --filter '@bundless/*' build 44 | - run: yarn test tests && yarn test ./bundless/src 45 | - run: git diff 46 | # - name: Create Release 47 | # id: changesets 48 | # uses: changesets/action@master 49 | # with: 50 | # publish: yarn release 51 | # env: 52 | # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 53 | # NPM_TOKEN: ${{ secrets.NPM_TOKEN }} 54 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | esm 4 | .DS_Store 5 | *.tsbuildinfo 6 | .ultra.cache.json 7 | **/web_modules/deps_hash 8 | **/web_modules/**/**.js 9 | **/web_modules/**/**.js.map 10 | out 11 | temp 12 | fixtures/with-pages/node_dist 13 | *_out 14 | with-pages/web_modules 15 | with-pages/out 16 | *_dist 17 | _hmr_client.js 18 | .bundless 19 | scripts/metafile.json -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "arrowParens": "always", 3 | "jsxSingleQuote": true, 4 | "tabWidth": 4, 5 | "semi": false, 6 | "singleQuote": true, 7 | "trailingComma": "all" 8 | } 9 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "todo-tree.filtering.excludeGlobs": [ 3 | "**/web_modules/**", 4 | "**/web_modules/**", 5 | "**/fixtures/**" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |

bundless

5 |

Next gen dev server and bundler

6 |

this project was a Vite alternative with many improvements like plugins, monorepo support, etc, most of them were added back to Vite 2, use Vite instead

7 |
8 |
9 | 10 | # Features 11 | 12 | - 10x faster than traditional bundlers 13 | - Error panel with sourcemap support 14 | - jsx, typescript out of the box 15 | - import assets, import css 16 | 17 | ### What's the difference with traditional tools like Webpack? 18 | 19 | - Faster dev server times and faster build speeds (thanks to [esbuild](https://esbuild.github.io)) 20 | - Bundless serves native ES modules to the browser, removing the overhead of parsing each module before serving 21 | - Bundless uses a superset of [esbuild plugin system](https://esbuild.github.io/plugins/) to let users enrich its capabilities 22 | 23 | ### What's the difference with tools like vite? 24 | 25 | Bundless is very similar to vite, both serve native es modules to the browser and build a bundled version for production. 26 | 27 | Also both are based on a plugin system that can be shared between the dev server and the bundler. 28 | 29 | Some differences are: 30 | 31 | - Bundless uses the esbuild plugin system instead of rollup 32 | - Bundless uses esbuild instead of rollup for the production bundle 33 | - Bundless still lacks some features like css modules (depends on [esbuild](https://github.com/evanw/esbuild/issues/20)) and more framework support (coming soon) 34 | -------------------------------------------------------------------------------- /bundless/bin.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | require('./dist/cli') 3 | -------------------------------------------------------------------------------- /bundless/src/client/types.ts: -------------------------------------------------------------------------------- 1 | export type HMRPayload = 2 | | ConnectedPayload 3 | | UpdatePayload 4 | | FullReloadPayload 5 | | OverlayErrorPayload 6 | | OverlayInfoOpenPayload 7 | | OverlayInfoClosePayload 8 | | HotAcceptPayload 9 | | ConnectPayload 10 | 11 | interface ConnectedPayload { 12 | type: 'connected' 13 | } 14 | 15 | export interface UpdatePayload { 16 | type: 'update' 17 | path: string 18 | updateID: string 19 | namespace: string 20 | // changeSrcPath: string 21 | // timestamp: number 22 | } 23 | 24 | interface FullReloadPayload { 25 | type: 'reload' 26 | } 27 | 28 | interface HotAcceptPayload { 29 | type: 'hotAccept' 30 | path: string 31 | } 32 | 33 | interface ConnectPayload { 34 | type: 'connected' 35 | } 36 | 37 | export interface OverlayErrorPayload { 38 | type: 'overlay-error' 39 | err: { 40 | // [name: string]: any 41 | message: string 42 | stack: string 43 | id?: string 44 | frame?: string 45 | plugin?: string 46 | pluginCode?: string 47 | } 48 | } 49 | 50 | export interface OverlayInfoOpenPayload { 51 | type: 'overlay-info-open' 52 | info: { 53 | [name: string]: any 54 | message: string 55 | showSpinner?: boolean 56 | } 57 | } 58 | 59 | export interface OverlayInfoClosePayload { 60 | type: 'overlay-info-close' 61 | } 62 | -------------------------------------------------------------------------------- /bundless/src/constants.ts: -------------------------------------------------------------------------------- 1 | import { logger } from './logger' 2 | import * as esbuild from 'esbuild' 3 | 4 | export let isRunningWithYarnPnp: boolean = false 5 | export let pnpapi: any 6 | try { 7 | pnpapi = require('pnpapi') 8 | isRunningWithYarnPnp = Boolean(pnpapi) 9 | 10 | logger.debug('Using Yarn PnP') 11 | } catch {} 12 | 13 | export const hmrClientNamespace = 'hmr-client' 14 | export const DEFAULT_PORT = 3000 15 | export const CLIENT_PUBLIC_PATH = `/_hmr_client.js?namespace=${hmrClientNamespace}` 16 | export const COMMONJS_ANALYSIS_PATH = '.bundless/commonjs.json' 17 | export const WEB_MODULES_PATH = '.bundless/node_modules' 18 | 19 | export const BUNDLE_MAP_PATH = '.bundless/bundleMap.json' 20 | export const HMR_SERVER_NAME = 'esm-hmr' 21 | export const CONFIG_NAME = 'bundless.config.js' 22 | 23 | export const EXAMPLES_FOLDERS = [ 24 | 'react-typescript', 25 | 'react-javascript', 26 | 'vanilla-javascript', 27 | 'svelte', 28 | ] 29 | 30 | export const MAIN_FIELDS = ['browser:module', 'browser', 'module', 'main'] 31 | 32 | export const showGraph = process.env.SHOW_HMR_GRAPH 33 | 34 | export const JS_EXTENSIONS = ['.ts', '.tsx', '.mjs', '.js', '.jsx', '.cjs'] 35 | 36 | export const defaultLoader: Record = { 37 | '.jpg': 'file', 38 | '.jpeg': 'file', 39 | '.png': 'file', 40 | '.svg': 'dataurl', 41 | '.gif': 'file', 42 | '.ico': 'file', 43 | '.webp': 'file', 44 | '.jp2': 'file', 45 | '.avif': 'file', 46 | '.woff': 'file', 47 | '.woff2': 'file', 48 | '.ttf': 'file', 49 | } 50 | export const defaultImportableAssets = Object.keys(defaultLoader) 51 | 52 | export const hmrPreamble = `import * as __HMR__ from '${CLIENT_PUBLIC_PATH}'; import.meta.hot = __HMR__.createHotContext(import.meta.url); ` 53 | -------------------------------------------------------------------------------- /bundless/src/index.ts: -------------------------------------------------------------------------------- 1 | export { serve } from './serve' 2 | export { build } from './build' 3 | export { Config, loadConfig } from './config' 4 | export { Plugin, PluginsExecutor } from './plugins-executor' 5 | export { logger, Logger } from './logger' 6 | export { HmrGraph, HmrNode } from './hmr-graph' 7 | export { MAIN_FIELDS } from './constants' 8 | -------------------------------------------------------------------------------- /bundless/src/logger.ts: -------------------------------------------------------------------------------- 1 | import chalk from 'chalk' 2 | import ora, { Ora } from 'ora' 3 | 4 | const defaultPrefix = '[bundless] ' 5 | 6 | const DEBUG = process.env.DEBUG_BUNDLESS 7 | export class Logger { 8 | prefix: string = '' 9 | silent: boolean 10 | constructor({ prefix = defaultPrefix, silent = false } = {}) { 11 | this.prefix = prefix 12 | this.silent = silent 13 | } 14 | 15 | private print(x) { 16 | if (this.silent) { 17 | return 18 | } 19 | if (this.spinner) { 20 | this.spinner.info(x) 21 | } else { 22 | process.stderr.write(chalk.dim(this.prefix) + x + '\n') 23 | } 24 | } 25 | log(...x) { 26 | this.print(x.join(' ')) 27 | } 28 | warn(...x) { 29 | this.print(chalk.yellow(x.join(' '))) 30 | } 31 | error(...x) { 32 | this.print(chalk.red(x.join(' '))) 33 | } 34 | 35 | private spinner?: Ora 36 | 37 | spinStart(text: string) { 38 | if (this.silent) { 39 | return 40 | } 41 | this.spinner = ora(text + '\n\n').start() 42 | } 43 | spinSucceed(text: string) { 44 | if (this.spinner) { 45 | this.spinner.succeed(text) 46 | } 47 | this.spinner = undefined 48 | } 49 | spinFail(text: string) { 50 | if (this.spinner) { 51 | this.spinner.fail(chalk.redBright(text)) 52 | } 53 | this.spinner = undefined 54 | } 55 | 56 | debug = DEBUG 57 | ? (...x) => { 58 | if (this.spinner) { 59 | this.spinner.info(x.join(' ') + '\n') 60 | } else { 61 | process.stderr.write( 62 | chalk.dim(this.prefix + x.join(' ') + '\n'), 63 | ) 64 | } 65 | } 66 | : () => {} 67 | } 68 | 69 | export const logger = new Logger() 70 | -------------------------------------------------------------------------------- /bundless/src/middleware/index.ts: -------------------------------------------------------------------------------- 1 | export { sourcemapMiddleware } from './sourcemap' 2 | export { historyFallbackMiddleware } from './history-fallback' 3 | export { staticServeMiddleware } from './static-serve' 4 | export { openInEditorMiddleware } from './open-in-editor' 5 | export { pluginsMiddleware } from './plugins' 6 | -------------------------------------------------------------------------------- /bundless/src/middleware/open-in-editor.ts: -------------------------------------------------------------------------------- 1 | import { logger } from '..' 2 | import fs from 'fs' 3 | import launchEditor from 'launch-editor' 4 | import { importPathToFile } from '../utils' 5 | import { Middleware } from 'koa' 6 | 7 | const fileLocationRegex = /(:\d+:\d+)$/ 8 | 9 | export function openInEditorMiddleware({ root }): Middleware { 10 | return function(ctx, next) { 11 | if (ctx.path !== '/__open-in-editor') { 12 | return next() 13 | } 14 | const { file = '' } = ctx.query || {} 15 | if (!file) { 16 | ctx.res.statusCode = 500 17 | ctx.body = `launch-editor-middleware: required query param "file" is missing.` 18 | return 19 | } 20 | 21 | let realPath = fs.existsSync(file.replace(fileLocationRegex, '')) ? file : importPathToFile(root, file) 22 | 23 | logger.log(`Opening editor at ${realPath}`) 24 | launchEditor(realPath) 25 | ctx.res.statusCode = 200 26 | ctx.body = `Opened ${realPath}` 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /bundless/src/middleware/static-serve.ts: -------------------------------------------------------------------------------- 1 | import { Middleware } from 'koa' 2 | import send, { SendOptions } from 'koa-send' 3 | import { WEB_MODULES_PATH } from '../constants' 4 | import { logger } from '../logger' 5 | 6 | // like koa static but executes other middlewares after serving, needed to transform html afterwards 7 | export function staticServeMiddleware(opts: SendOptions): Middleware { 8 | opts.index = opts.index || 'index.html' 9 | opts.hidden = opts.hidden || true 10 | const cacheOptions: send.SendOptions = { 11 | maxAge: 1000 * 60 * 60, 12 | immutable: true, 13 | } 14 | return async function serve(ctx, next) { 15 | if (ctx.method !== 'HEAD' && ctx.method !== 'GET') { 16 | return next() 17 | } 18 | if (ctx.body) { 19 | return next() 20 | } 21 | 22 | const isDep = ctx.path.includes(WEB_MODULES_PATH) 23 | try { 24 | logger.debug('Statically serving ' + ctx.path) 25 | await send(ctx, ctx.path, { ...opts, ...(isDep && cacheOptions) }) 26 | } catch (err) { 27 | if (err.status !== 404 && err.code !== 'ENOENT') { 28 | throw new Error(`Cannot static serve ${ctx.path}: ${err}`) 29 | } 30 | } 31 | 32 | await next() 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /bundless/src/plugins/buffer.ts: -------------------------------------------------------------------------------- 1 | import * as esbuild from 'esbuild' 2 | import { Plugin } from '../plugins-executor' 3 | import { importPathToFile, readFile } from '../utils' 4 | 5 | const BUFFER_PATH = '_bundless-node-buffer-polyfill_.js' 6 | 7 | export function NodeBufferGlobal(): Plugin { 8 | return { 9 | name: 'buffer-global', 10 | setup({ onResolve, onLoad, onTransform }) { 11 | onTransform({ filter: /\.html$/ }, (args) => { 12 | const contents = args.contents.replace( 13 | //, 14 | `$&\n` + 15 | `\n`, 16 | ) 17 | return { 18 | contents, 19 | } 20 | }) 21 | onResolve({ filter: new RegExp(BUFFER_PATH) }, (arg) => { 22 | return { 23 | path: BUFFER_PATH, 24 | } 25 | }) 26 | onLoad({ filter: new RegExp(BUFFER_PATH) }, async (arg) => { 27 | const polyfill = await readFile( 28 | require.resolve( 29 | `@esbuild-plugins/node-globals-polyfill/Buffer.js`, 30 | ), 31 | ) 32 | return { 33 | contents: polyfill + `\nwindow.Buffer = Buffer;`, 34 | loader: 'js', 35 | } 36 | }) 37 | }, 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /bundless/src/plugins/env.ts: -------------------------------------------------------------------------------- 1 | import dotenv from 'dotenv' 2 | import dotenvExpand from 'dotenv-expand' 3 | import findUp from 'find-up' 4 | import fs from 'fs-extra' 5 | import path from 'path' 6 | import { logger } from '../logger' 7 | import { PluginHooks } from '../plugins-executor' 8 | 9 | export function EnvPlugin({ 10 | envFiles = [] as string[], 11 | env = {} as Record, 12 | findUp: isFindUp = false, 13 | } = {}) { 14 | return { 15 | name: 'env', 16 | setup: ({ initialOptions, ctx: { root } }: PluginHooks) => { 17 | let define = {} 18 | for (let _envFile of envFiles) { 19 | let envFile 20 | if (fs.existsSync(path.resolve(root, _envFile))) { 21 | envFile = path.resolve(root, _envFile) 22 | } else if (isFindUp) { 23 | envFile = findUp.sync(_envFile, { cwd: root }) || '' 24 | } 25 | if (!envFile) { 26 | logger.warn(`Cannot find env file '${_envFile}'`) 27 | continue 28 | } 29 | const data = fs.readFileSync(envFile).toString() 30 | const parsed = dotenv.parse(data, { 31 | debug: !!process.env.DEBUG || undefined, 32 | }) 33 | 34 | // let environment variables use each other 35 | dotenvExpand({ 36 | parsed, 37 | // prevent process.env mutation 38 | ignoreProcessEnv: true, 39 | } as any) 40 | 41 | for (const k in parsed) { 42 | define[`process.env.${k}`] = JSON.stringify(parsed[k]) 43 | } 44 | } 45 | for (const k in env) { 46 | define[`process.env.${k}`] = JSON.stringify(env[k]) 47 | } 48 | 49 | Object.assign(initialOptions.define, define) 50 | }, 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /bundless/src/plugins/html-resolver.ts: -------------------------------------------------------------------------------- 1 | import fs from 'fs-extra' 2 | import path from 'path' 3 | import { PluginHooks } from '../plugins-executor' 4 | 5 | export function HtmlResolverPlugin({} = {}) { 6 | return { 7 | name: 'html-resolver', 8 | setup: ({ ctx: { root }, onLoad, onResolve }: PluginHooks) => { 9 | onResolve({ filter: /\.html/ }, async (args) => { 10 | args.path = path.resolve(root, args.path) 11 | 12 | var resolved = path.resolve(args.resolveDir || root, args.path) 13 | if (resolved && fs.existsSync(resolved)) { 14 | return { 15 | path: resolved, 16 | } 17 | } 18 | const relativePath = path.relative(root, args.path) 19 | var resolved = path.resolve( 20 | path.resolve(root, path.join('public', relativePath)), 21 | ) 22 | if (resolved && fs.existsSync(resolved)) { 23 | return { 24 | path: resolved, 25 | } 26 | } 27 | return null 28 | }) 29 | 30 | onLoad({ filter: /\.html$/ }, async (args) => { 31 | try { 32 | const realFilePath = args.path // .replace('.html.js', '.html') 33 | const html = await ( 34 | await fs.readFile(realFilePath, { 35 | encoding: 'utf-8', 36 | }) 37 | ).toString() 38 | return { 39 | contents: html, 40 | loader: 'html' as any, 41 | } 42 | } catch (e) { 43 | return null 44 | throw new Error(`Cannot load ${args.path}, ${e}`) 45 | } 46 | }) 47 | }, 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /bundless/src/plugins/html-transform.ts: -------------------------------------------------------------------------------- 1 | import posthtml, { Plugin } from 'posthtml' 2 | import { PluginHooks } from '../plugins-executor' 3 | import { cleanUrl } from '../utils' 4 | 5 | export function HtmlTransformUrlsPlugin({ 6 | transforms, 7 | }: { 8 | transforms: Plugin[] 9 | }) { 10 | return { 11 | name: 'html-transform-urls', 12 | setup: ({ onTransform }: PluginHooks) => { 13 | onTransform({ filter: /\.html$/ }, async (args) => { 14 | const transformer = posthtml([...transforms]) 15 | const result = await transformer.process(args.contents) 16 | const contents = result.html 17 | return { contents } 18 | }) 19 | }, 20 | } 21 | } 22 | 23 | // TODO transformer to rewrite inline script imports 24 | 25 | -------------------------------------------------------------------------------- /bundless/src/plugins/index.ts: -------------------------------------------------------------------------------- 1 | export { EsbuildTransformPlugin } from './esbuild' 2 | export { RewritePlugin } from './rewrite' 3 | export { CssPlugin } from './css' 4 | export { ResolveSourcemapPlugin } from './resolve-sourcemaps' 5 | export { HmrClientPlugin } from './hmr-client' 6 | export { JSONPlugin } from './json' 7 | export { AssetsPlugin } from './assets' 8 | export { UrlResolverPlugin } from './url-resolver' 9 | export { HtmlTransformUrlsPlugin } from './html-transform' 10 | export { HtmlResolverPlugin } from './html-resolver' 11 | export { HtmlIngestPlugin } from './html-ingest' 12 | export { SourceMapSupportPlugin } from './source-map-support' 13 | export { EnvPlugin } from './env' 14 | export { NodeBufferGlobal } from './buffer' 15 | export { 16 | NodeModulesPolyfillPlugin, 17 | NodeResolvePlugin, 18 | NodeGlobalsPolyfillPlugin 19 | } from '@esbuild-plugins/all' 20 | -------------------------------------------------------------------------------- /bundless/src/plugins/json.ts: -------------------------------------------------------------------------------- 1 | import { NodeResolvePlugin } from '@esbuild-plugins/all' 2 | import { transform } from 'esbuild' 3 | import { PluginHooks } from '../plugins-executor' 4 | import { readFile } from '../utils' 5 | 6 | export function JSONPlugin({} = {}) { 7 | return { 8 | name: 'json', 9 | setup: (hooks: PluginHooks) => { 10 | const { onLoad, onResolve } = hooks 11 | NodeResolvePlugin({ 12 | name: 'json-node-resolve', 13 | isExtensionRequiredInImportPath: true, 14 | extensions: ['.json'], 15 | }).setup({ 16 | ...hooks, 17 | onLoad() {}, 18 | }) 19 | onLoad({ filter: /\.json$/ }, async (args) => { 20 | const json = await readFile(args.path) 21 | const transformed = await transform(json, { 22 | format: 'esm', 23 | loader: 'json', 24 | sourcefile: args.path, 25 | }) 26 | const contents = transformed.code 27 | return { contents } 28 | }) 29 | }, 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /bundless/src/plugins/rewrite/commonjs.test.ts: -------------------------------------------------------------------------------- 1 | import { parse } from '../../utils' 2 | import { transformCjsImport } from './commonjs' 3 | 4 | describe('rewrite commonjs imports', () => { 5 | const cases = [ 6 | `import React from 'react'`, 7 | `import * as React from 'react'`, 8 | `import React, { useState } from 'react'`, 9 | `import { useState } from 'react'`, 10 | `import { useState, useEffect } from 'react'`, 11 | `import { useState as something } from 'react'`, 12 | `import { useState as something, useEffect } from 'react'`, 13 | `import { useState as something, useEffect as alias } from 'react'`, 14 | `import { default as Default } from 'react'`, 15 | `import { default as Default, useEffect } from 'react'`, 16 | ] 17 | for (let [i, testCase] of cases.entries()) { 18 | test(`${i} "${testCase}"`, () => { 19 | const res = transformCjsImport(testCase, 'react', 'react', 0) 20 | expect(res).not.toContain('\n') 21 | parse(res) // check that it's valid code 22 | expect(res).toMatchSnapshot() 23 | }) 24 | } 25 | }) 26 | -------------------------------------------------------------------------------- /bundless/src/plugins/rewrite/index.ts: -------------------------------------------------------------------------------- 1 | export * from './rewrite' 2 | -------------------------------------------------------------------------------- /bundless/src/plugins/source-map-support.ts: -------------------------------------------------------------------------------- 1 | import fs from 'fs-extra' 2 | import { CLIENT_PUBLIC_PATH } from '../constants' 3 | import { PluginHooks } from '../plugins-executor' 4 | 5 | export const sourceMapSupportPath = 6 | '__source-map-support.js?namespace=source-map-support' 7 | 8 | export function SourceMapSupportPlugin({} = {}) { 9 | return { 10 | name: 'hmr-client', 11 | setup: ({ 12 | onLoad, 13 | onTransform, 14 | ctx: { config, root }, 15 | }: PluginHooks) => { 16 | // TODO reenable source map support 17 | return 18 | onTransform({ filter: /\.html$/ }, (args) => { 19 | const contents = args.contents.replace( 20 | //, 21 | `$&\n` + 22 | `\n` + 23 | `\n`, 24 | ) 25 | return { 26 | contents, 27 | } 28 | }) 29 | 30 | onLoad( 31 | { filter: /.*/, namespace: 'source-map-support' }, 32 | async () => { 33 | return { 34 | contents: await fs.readFile( 35 | require.resolve( 36 | 'source-map-support/browser-source-map-support.js', 37 | ), 38 | ), 39 | } 40 | }, 41 | ) 42 | }, 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /bundless/src/plugins/url-resolver.ts: -------------------------------------------------------------------------------- 1 | import { NodeResolvePlugin } from '@esbuild-plugins/all' 2 | import { PluginHooks } from '../plugins-executor' 3 | import { importPathToFile, readFile } from '../utils' 4 | import url from 'url' 5 | import { logger } from '../logger' 6 | import qs from 'qs' 7 | 8 | export function UrlResolverPlugin({} = {}) { 9 | return { 10 | name: 'url-resolver', 11 | setup: ({ ctx: { root }, onResolve }: PluginHooks) => { 12 | onResolve({ filter: /\?/ }, async (arg) => { 13 | if (!arg.path.includes('?')) { 14 | return 15 | } 16 | const parsed = url.parse(arg.path) 17 | if (!parsed.pathname) { 18 | throw new Error('no pathname in ' + arg.path) 19 | } 20 | const query = qs.parse(parsed.query || '') 21 | if ( 22 | query.namespace && 23 | typeof query.namespace === 'string' && 24 | query.namespace !== 'file' 25 | ) { 26 | // logger.log(`Removed query from path ${arg.path}`) 27 | return { 28 | path: parsed.pathname.slice(1), // TODO write a spec for virtual files in url behaviour 29 | namespace: query.namespace, 30 | } 31 | } 32 | 33 | return { 34 | path: importPathToFile(root, parsed.pathname), 35 | } 36 | }) 37 | }, 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /bundless/src/prebundle/__snapshots__/prebundle.test.ts.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`traverseWithEsbuild 1`] = ` 4 | Array [ 5 | "index.html", 6 | "main.js", 7 | "../../node_modules/slash/index.js", 8 | "../../node_modules/react/index.js", 9 | "node_modules/preact/hooks/dist/hooks.module.js", 10 | "../../node_modules/react-dom/index.js", 11 | ] 12 | `; 13 | -------------------------------------------------------------------------------- /bundless/src/prebundle/index.ts: -------------------------------------------------------------------------------- 1 | export { prebundle } from './prebundle' 2 | -------------------------------------------------------------------------------- /bundless/src/prebundle/prebundle.test.ts: -------------------------------------------------------------------------------- 1 | import memoize from 'micro-memoize' 2 | import path from 'path' 3 | import { makeEntryObject } from './prebundle' 4 | import { traverseWithEsbuild } from './traverse' 5 | 6 | test('traverseWithEsbuild', async () => { 7 | const entry = path.resolve('fixtures/with-many-dependencies/index.html') 8 | const deps = await traverseWithEsbuild({ 9 | entryPoints: [entry], 10 | // esbuildCwd: process.cwd(), 11 | config: {}, 12 | root: path.dirname(entry), 13 | }) 14 | expect(deps).toMatchSnapshot() 15 | }) 16 | 17 | test('memoize', () => { 18 | let i = 0 19 | const fn = memoize((x) => { 20 | return i++ 21 | }) 22 | fn(1) 23 | fn(1) 24 | fn.cache.keys = [] 25 | fn.cache.values = [] 26 | fn(1) 27 | fn(1) 28 | fn(1) 29 | expect(i).toBe(2) 30 | }) 31 | 32 | test('makeEntryObject', () => { 33 | const deps = ['xxx', 'xxx', 'xxx', 'yyy', 'aaa'] 34 | const obj = makeEntryObject(deps) 35 | console.log(obj) 36 | expect(Object.keys(obj).length).toBe(deps.length) 37 | }) 38 | -------------------------------------------------------------------------------- /bundless/src/utils/index.ts: -------------------------------------------------------------------------------- 1 | export * from './sourcemaps' 2 | export * from './path' 3 | export * from './utils' 4 | -------------------------------------------------------------------------------- /bundless/src/utils/path.ts: -------------------------------------------------------------------------------- 1 | import path from 'path' 2 | import defaultPathImpl from 'path' 3 | import slash from 'slash' 4 | 5 | export const dotdotEncoding = '__..__' 6 | 7 | // maybe keep track of namespace query here? 8 | export function importPathToFile( 9 | root: string, 10 | request: string, 11 | pathImpl = defaultPathImpl, 12 | ) { 13 | if (!request) { 14 | return '' 15 | } 16 | request = decodeURIComponent(request) 17 | request = cleanUrl(request) 18 | request = removeLeadingSlash(request) 19 | request = request.replace(/__\.\.__/g, '..') 20 | request = pathImpl.resolve(root, request) 21 | return request 22 | } 23 | 24 | export function fileToImportPath( 25 | root: string, 26 | filePath: string, 27 | pathImpl = defaultPathImpl, 28 | ) { 29 | filePath = filePath.replace(/\//g, pathImpl.sep) 30 | filePath = pathImpl.resolve(root, filePath) 31 | const relative = pathImpl.relative(root, filePath) 32 | filePath = slash(relative) 33 | filePath = filePath.replace(/\.\.(\/|\\)/g, dotdotEncoding + '$1') 34 | filePath = '/' + filePath 35 | return filePath 36 | } 37 | 38 | export function osAgnosticPath(absPath: string | undefined, root: string) { 39 | if (!root) { 40 | throw new Error( 41 | `root argument is required, cannot make os agnostic path for ${absPath}`, 42 | ) 43 | } 44 | if (!absPath) { 45 | return '' 46 | } 47 | if (!path.isAbsolute(absPath)) { 48 | absPath = path.resolve(root, absPath) 49 | } 50 | return slash(path.relative(root, absPath)) 51 | } 52 | 53 | export function removeLeadingSlash(p: string) { 54 | return p.startsWith('/') ? p.slice(1) : p 55 | } 56 | 57 | export const queryRE = /\?.*$/ 58 | export const hashRE = /#.*$/ 59 | 60 | export const cleanUrl = (url: string) => 61 | url.replace(hashRE, '').replace(queryRE, '') 62 | -------------------------------------------------------------------------------- /bundless/src/utils/profiling.test.ts: -------------------------------------------------------------------------------- 1 | import { ansiChart, humanizeStats, stats } from './profiling' 2 | 3 | test('ansiChart', () => { 4 | const res = ansiChart(data, { limit: 4 }) 5 | console.log(res) 6 | }) 7 | test('humanizeStats', () => { 8 | const res = humanizeStats({ context: stats(data) }) 9 | console.log(res) 10 | }) 11 | 12 | const data = [ 13 | { path: 'a', timeConsume: 100 }, 14 | { path: 'b', timeConsume: 1000 }, 15 | { path: 'c', timeConsume: 1000 }, 16 | ] 17 | -------------------------------------------------------------------------------- /bundless/src/utils/sourcemaps.ts: -------------------------------------------------------------------------------- 1 | import merge from 'merge-source-map' 2 | import { RawSourceMap, } from 'source-map' 3 | 4 | export function mergeSourceMap( 5 | oldMap: RawSourceMap | null | undefined, 6 | newMap: RawSourceMap, 7 | ): RawSourceMap { 8 | if (!oldMap) { 9 | return newMap 10 | } 11 | // merge-source-map will overwrite original sources if newMap also has 12 | // sourcesContent 13 | 14 | newMap.sourcesContent = [] 15 | return merge(oldMap, newMap) as RawSourceMap 16 | } 17 | 18 | export function genSourceMapString(map: RawSourceMap | string | undefined) { 19 | if (typeof map !== 'string') { 20 | map = JSON.stringify(map) 21 | } 22 | return `\n//# sourceMappingURL=data:application/json;base64,${Buffer.from( 23 | map, 24 | ).toString('base64')}` 25 | } 26 | -------------------------------------------------------------------------------- /bundless/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.base.json", 3 | "compilerOptions": { 4 | "rootDir": "src", 5 | "outDir": "dist" 6 | }, 7 | "include": ["src"] 8 | } 9 | -------------------------------------------------------------------------------- /examples/react-javascript/.gitignore: -------------------------------------------------------------------------------- 1 | .bundless 2 | node_modules 3 | .DS_Store 4 | -------------------------------------------------------------------------------- /examples/react-javascript/bundless.config.js: -------------------------------------------------------------------------------- 1 | const { ReactRefreshPlugin } = require('@bundless/plugin-react-refresh') 2 | 3 | /** 4 | * @type { import('@bundless/cli').Config } 5 | */ 6 | module.exports = { 7 | plugins: [ReactRefreshPlugin()], 8 | } 9 | -------------------------------------------------------------------------------- /examples/react-javascript/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example-react-javascript", 3 | "private": true, 4 | "version": "1.0.0", 5 | "scripts": { 6 | "dev": "bundless dev", 7 | "build": "bundless build" 8 | }, 9 | "dependencies": { 10 | "react": "experimental", 11 | "react-dom": "experimental" 12 | }, 13 | "devDependencies": { 14 | "@bundless/cli": "0.6.0", 15 | "@bundless/plugin-react-refresh": "2.1.0" 16 | }, 17 | "license": "MIT" 18 | } 19 | -------------------------------------------------------------------------------- /examples/react-javascript/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | -------------------------------------------------------------------------------- /examples/react-javascript/src/app.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | export default function App() { 4 | return ( 5 |
6 |

Hello Bundless

7 |

Start editing to see some magic happen!

8 |
9 | ) 10 | } 11 | -------------------------------------------------------------------------------- /examples/react-javascript/src/index.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import ReactDOM from 'react-dom' 3 | 4 | import App from './app' 5 | 6 | const rootElement = document.getElementById('root') 7 | ReactDOM.render( 8 | 9 | 10 | , 11 | rootElement, 12 | ) 13 | -------------------------------------------------------------------------------- /examples/react-javascript/src/styles.css: -------------------------------------------------------------------------------- 1 | .App { 2 | font-family: sans-serif; 3 | text-align: center; 4 | } 5 | -------------------------------------------------------------------------------- /examples/react-typescript/.gitignore: -------------------------------------------------------------------------------- 1 | .bundless 2 | node_modules 3 | .DS_Store 4 | -------------------------------------------------------------------------------- /examples/react-typescript/bundless.config.js: -------------------------------------------------------------------------------- 1 | const { ReactRefreshPlugin } = require('@bundless/plugin-react-refresh') 2 | 3 | /** 4 | * @type { import('@bundless/cli').Config } 5 | */ 6 | module.exports = { 7 | plugins: [ReactRefreshPlugin()], 8 | } 9 | -------------------------------------------------------------------------------- /examples/react-typescript/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example-react-typescript", 3 | "private": true, 4 | "version": "1.0.0", 5 | "scripts": { 6 | "dev": "bundless dev", 7 | "build": "bundless build" 8 | }, 9 | "dependencies": { 10 | "react": "experimental", 11 | "react-dom": "experimental" 12 | }, 13 | "devDependencies": { 14 | "@bundless/cli": "0.6.0", 15 | "@bundless/plugin-react-refresh": "2.1.0" 16 | }, 17 | "license": "MIT" 18 | } 19 | -------------------------------------------------------------------------------- /examples/react-typescript/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | -------------------------------------------------------------------------------- /examples/react-typescript/src/app.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | export default function App() { 4 | return ( 5 |
6 |

Hello Bundless

7 |

Start editing to see some magic happen!

8 |
9 | ) 10 | } 11 | -------------------------------------------------------------------------------- /examples/react-typescript/src/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import ReactDOM from 'react-dom' 3 | 4 | import App from './app' 5 | 6 | const rootElement = document.getElementById('root') 7 | ReactDOM.render( 8 | 9 | 10 | , 11 | rootElement, 12 | ) 13 | -------------------------------------------------------------------------------- /examples/react-typescript/src/styles.css: -------------------------------------------------------------------------------- 1 | .App { 2 | font-family: sans-serif; 3 | text-align: center; 4 | } 5 | -------------------------------------------------------------------------------- /examples/react-typescript/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "rootDir": "src", 4 | "esModuleInterop": true, 5 | "skipLibCheck": true, 6 | "noEmit": true, 7 | "jsx": "react", 8 | "moduleResolution": "Node" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /examples/svelte/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | out 3 | .bundless 4 | .DS_Store 5 | -------------------------------------------------------------------------------- /examples/svelte/bundless.config.js: -------------------------------------------------------------------------------- 1 | const { SveltePlugin } = require('@bundless/plugin-svelte') 2 | 3 | /** 4 | * @type { import('@bundless/cli').Config } 5 | */ 6 | module.exports = { 7 | plugins: [SveltePlugin()], 8 | } 9 | -------------------------------------------------------------------------------- /examples/svelte/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "svelte-example", 3 | "version": "1.0.0", 4 | "private": true, 5 | "scripts": { 6 | "build": "bundless build", 7 | "dev": "bundless dev" 8 | }, 9 | "devDependencies": { 10 | "@bundless/cli": "0.6.0", 11 | "@bundless/plugin-svelte": "^0.0.1", 12 | "svelte": "^3.32.1" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /examples/svelte/public/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/remorses/bundless/c7c167a78b03f8b643bcd1ed091f6b155fa84043/examples/svelte/public/favicon.png -------------------------------------------------------------------------------- /examples/svelte/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Svelte app 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /examples/svelte/src/App.svelte: -------------------------------------------------------------------------------- 1 | 4 | 5 |
6 |

Hello {name}!

7 |

8 | This is an example svelte application built with bundless 11 |

12 |
13 | 14 | 35 | -------------------------------------------------------------------------------- /examples/svelte/src/global.css: -------------------------------------------------------------------------------- 1 | html, body { 2 | position: relative; 3 | width: 100%; 4 | height: 100%; 5 | } 6 | 7 | body { 8 | color: #333; 9 | margin: 0; 10 | padding: 8px; 11 | box-sizing: border-box; 12 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; 13 | } 14 | 15 | a { 16 | color: rgb(0,100,200); 17 | text-decoration: none; 18 | } 19 | 20 | a:hover { 21 | text-decoration: underline; 22 | } 23 | 24 | a:visited { 25 | color: rgb(0,80,160); 26 | } 27 | 28 | label { 29 | display: block; 30 | } 31 | 32 | input, button, select, textarea { 33 | font-family: inherit; 34 | font-size: inherit; 35 | -webkit-padding: 0.4em 0; 36 | padding: 0.4em; 37 | margin: 0 0 0.5em 0; 38 | box-sizing: border-box; 39 | border: 1px solid #ccc; 40 | border-radius: 2px; 41 | } 42 | 43 | input:disabled { 44 | color: #ccc; 45 | } 46 | 47 | button { 48 | color: #333; 49 | background-color: #f4f4f4; 50 | outline: none; 51 | } 52 | 53 | button:disabled { 54 | color: #999; 55 | } 56 | 57 | button:not(:disabled):active { 58 | background-color: #ddd; 59 | } 60 | 61 | button:focus { 62 | border-color: #666; 63 | } 64 | -------------------------------------------------------------------------------- /examples/svelte/src/main.js: -------------------------------------------------------------------------------- 1 | import './global.css' 2 | import App from './App.svelte' 3 | 4 | const app = new App({ 5 | target: document.body, 6 | props: { 7 | name: 'world', 8 | }, 9 | }) 10 | 11 | export default app 12 | -------------------------------------------------------------------------------- /examples/vanilla-javascript/.gitignore: -------------------------------------------------------------------------------- 1 | .bundless 2 | node_modules 3 | .DS_Store 4 | -------------------------------------------------------------------------------- /examples/vanilla-javascript/bundless.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @type { import('@bundless/cli').Config } 3 | */ 4 | module.exports = {} 5 | -------------------------------------------------------------------------------- /examples/vanilla-javascript/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example-vanilla-javascript", 3 | "private": true, 4 | "version": "1.0.0", 5 | "scripts": { 6 | "dev": "bundless dev", 7 | "build": "bundless build" 8 | }, 9 | "dependencies": {}, 10 | "devDependencies": { 11 | "@bundless/cli": "0.6.0", 12 | "@bundless/plugin-react-refresh": "2.1.0" 13 | }, 14 | "license": "MIT" 15 | } 16 | -------------------------------------------------------------------------------- /examples/vanilla-javascript/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /examples/vanilla-javascript/src/index.js: -------------------------------------------------------------------------------- 1 | var node = document.createElement('p') 2 | var textnode = document.createTextNode('Hey!') 3 | node.appendChild(textnode) 4 | document.body.appendChild(node) 5 | -------------------------------------------------------------------------------- /examples/vanilla-javascript/src/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: sans-serif; 3 | text-align: center; 4 | } 5 | -------------------------------------------------------------------------------- /fixtures/html-page/__mirror__/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |

My First Heading

7 | 8 |

My first paragraph.

9 | 10 | 11 | -------------------------------------------------------------------------------- /fixtures/html-page/__snapshots__: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`snapshots fixtures/html-page: build 1`] = ` 4 | Array [ 5 | "index.html", 6 | "index.js", 7 | ] 8 | `; 9 | 10 | exports[`snapshots fixtures/html-page: content-type headers 1`] = ` 11 | Object { 12 | "http://127.0.0.1:9000/_hmr_client.js?namespace=hmr-client": "application/javascript; charset=utf-8", 13 | "http://127.0.0.1:9000/index.html": "text/html; charset=utf-8", 14 | } 15 | `; 16 | 17 | exports[`snapshots fixtures/html-page: mirror 1`] = ` 18 | Array [ 19 | "_hmr_client.js", 20 | "index.html", 21 | ] 22 | `; 23 | 24 | exports[`snapshots fixtures/html-page: traverse result 1`] = ` 25 | Array [ 26 | Object { 27 | "importPath": "/_hmr_client.js?namespace=hmr-client", 28 | "importer": "http://127.0.0.1:9000/index.html", 29 | "resolvedImportPath": "http://127.0.0.1:9000/_hmr_client.js?namespace=hmr-client", 30 | }, 31 | ] 32 | `; 33 | -------------------------------------------------------------------------------- /fixtures/html-page/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

My First Heading

5 | 6 |

My first paragraph.

7 | 8 | 9 | -------------------------------------------------------------------------------- /fixtures/outsider.js: -------------------------------------------------------------------------------- 1 | export default 'Hi, i am outside of root' 2 | -------------------------------------------------------------------------------- /fixtures/resolve-sourcemap/__mirror__/folder/main.js: -------------------------------------------------------------------------------- 1 | console.log('Hello world!') 2 | 3 | var node = document.createElement('LI') 4 | var textnode = document.createTextNode('works!') 5 | node.appendChild(textnode) 6 | document.body.appendChild(node) 7 | 8 | //# sourceMappingURL=/folder/main.js.map -------------------------------------------------------------------------------- /fixtures/resolve-sourcemap/__mirror__/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

My First Heading

8 | 9 |

My first paragraph.

10 | 11 | 12 | -------------------------------------------------------------------------------- /fixtures/resolve-sourcemap/__snapshots__: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`snapshots fixtures/resolve-sourcemap: build 1`] = ` 4 | Array [ 5 | "index.html", 6 | "index.js", 7 | ] 8 | `; 9 | 10 | exports[`snapshots fixtures/resolve-sourcemap: content-type headers 1`] = ` 11 | Object { 12 | "http://127.0.0.1:9000/_hmr_client.js?namespace=hmr-client": "application/javascript; charset=utf-8", 13 | "http://127.0.0.1:9000/folder/main.js?namespace=file": "application/javascript; charset=utf-8", 14 | "http://127.0.0.1:9000/index.html": "text/html; charset=utf-8", 15 | } 16 | `; 17 | 18 | exports[`snapshots fixtures/resolve-sourcemap: mirror 1`] = ` 19 | Array [ 20 | "_hmr_client.js", 21 | "folder/main.js", 22 | "index.html", 23 | ] 24 | `; 25 | 26 | exports[`snapshots fixtures/resolve-sourcemap: traverse result 1`] = ` 27 | Array [ 28 | Object { 29 | "importPath": "/_hmr_client.js?namespace=hmr-client", 30 | "importer": "http://127.0.0.1:9000/index.html", 31 | "resolvedImportPath": "http://127.0.0.1:9000/_hmr_client.js?namespace=hmr-client", 32 | }, 33 | Object { 34 | "importPath": "/folder/main.js?namespace=file", 35 | "importer": "http://127.0.0.1:9000/index.html", 36 | "resolvedImportPath": "http://127.0.0.1:9000/folder/main.js?namespace=file", 37 | }, 38 | ] 39 | `; 40 | -------------------------------------------------------------------------------- /fixtures/resolve-sourcemap/folder/main.js: -------------------------------------------------------------------------------- 1 | console.log('Hello world!') 2 | 3 | var node = document.createElement('LI') 4 | var textnode = document.createTextNode('works!') 5 | node.appendChild(textnode) 6 | document.body.appendChild(node) 7 | 8 | //# sourceMappingURL=main.js.map -------------------------------------------------------------------------------- /fixtures/resolve-sourcemap/folder/main.js.map: -------------------------------------------------------------------------------- 1 | { 2 | "version": 3, 3 | "file": "main.js", 4 | "sourceRoot": "", 5 | "sources": [ 6 | "./main.js" 7 | ], 8 | "names": [], 9 | "mappings": "" 10 | } 11 | -------------------------------------------------------------------------------- /fixtures/resolve-sourcemap/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

My First Heading

6 | 7 |

My first paragraph.

8 | 9 | 10 | -------------------------------------------------------------------------------- /fixtures/serve-outside-root/__mirror__/__..__/outsider.js: -------------------------------------------------------------------------------- 1 | export default 'Hi, i am outside of root' 2 | -------------------------------------------------------------------------------- /fixtures/serve-outside-root/__mirror__/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /fixtures/serve-outside-root/__mirror__/main.js: -------------------------------------------------------------------------------- 1 | import text from '/__..__/outsider.js?namespace=file&t=0' 2 | 3 | console.log(text) 4 | 5 | var node = document.createElement('pre') 6 | var textnode = document.createTextNode(text) 7 | node.appendChild(textnode) 8 | document.body.appendChild(node) 9 | -------------------------------------------------------------------------------- /fixtures/serve-outside-root/__snapshots__: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`snapshots fixtures/serve-outside-root: build 1`] = ` 4 | Array [ 5 | "index.html", 6 | "index.js", 7 | ] 8 | `; 9 | 10 | exports[`snapshots fixtures/serve-outside-root: content-type headers 1`] = ` 11 | Object { 12 | "http://127.0.0.1:9000/__..__/outsider.js?namespace=file&t=0": "application/javascript; charset=utf-8", 13 | "http://127.0.0.1:9000/_hmr_client.js?namespace=hmr-client": "application/javascript; charset=utf-8", 14 | "http://127.0.0.1:9000/index.html": "text/html; charset=utf-8", 15 | "http://127.0.0.1:9000/main.js?namespace=file": "application/javascript; charset=utf-8", 16 | } 17 | `; 18 | 19 | exports[`snapshots fixtures/serve-outside-root: mirror 1`] = ` 20 | Array [ 21 | "__..__/outsider.js", 22 | "_hmr_client.js", 23 | "index.html", 24 | "main.js", 25 | ] 26 | `; 27 | 28 | exports[`snapshots fixtures/serve-outside-root: traverse result 1`] = ` 29 | Array [ 30 | Object { 31 | "importPath": "/__..__/outsider.js?namespace=file&t=0", 32 | "importer": "http://127.0.0.1:9000/main.js?namespace=file", 33 | "resolvedImportPath": "http://127.0.0.1:9000/__..__/outsider.js?namespace=file&t=0", 34 | }, 35 | Object { 36 | "importPath": "/_hmr_client.js?namespace=hmr-client", 37 | "importer": "http://127.0.0.1:9000/index.html", 38 | "resolvedImportPath": "http://127.0.0.1:9000/_hmr_client.js?namespace=hmr-client", 39 | }, 40 | Object { 41 | "importPath": "/main.js?namespace=file", 42 | "importer": "http://127.0.0.1:9000/index.html", 43 | "resolvedImportPath": "http://127.0.0.1:9000/main.js?namespace=file", 44 | }, 45 | ] 46 | `; 47 | -------------------------------------------------------------------------------- /fixtures/serve-outside-root/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /fixtures/serve-outside-root/main.js: -------------------------------------------------------------------------------- 1 | import text from '../outsider' 2 | 3 | console.log(text) 4 | 5 | var node = document.createElement('pre') 6 | var textnode = document.createTextNode(text) 7 | node.appendChild(textnode) 8 | document.body.appendChild(node) 9 | -------------------------------------------------------------------------------- /fixtures/simple-js/__mirror__/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

My First Heading

8 | 9 |

My first paragraph.

10 | 11 | 12 | -------------------------------------------------------------------------------- /fixtures/simple-js/__mirror__/main.js: -------------------------------------------------------------------------------- 1 | console.log('Hello world!') 2 | 3 | var node = document.createElement('LI') 4 | var textnode = document.createTextNode('works!') 5 | node.appendChild(textnode) 6 | document.body.appendChild(node) 7 | -------------------------------------------------------------------------------- /fixtures/simple-js/__snapshots__: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`snapshots fixtures/simple-js: build 1`] = ` 4 | Array [ 5 | "index.html", 6 | "index.js", 7 | ] 8 | `; 9 | 10 | exports[`snapshots fixtures/simple-js: content-type headers 1`] = ` 11 | Object { 12 | "http://127.0.0.1:9000/_hmr_client.js?namespace=hmr-client": "application/javascript; charset=utf-8", 13 | "http://127.0.0.1:9000/index.html": "text/html; charset=utf-8", 14 | "http://127.0.0.1:9000/main.js?namespace=file": "application/javascript; charset=utf-8", 15 | } 16 | `; 17 | 18 | exports[`snapshots fixtures/simple-js: mirror 1`] = ` 19 | Array [ 20 | "_hmr_client.js", 21 | "index.html", 22 | "main.js", 23 | ] 24 | `; 25 | 26 | exports[`snapshots fixtures/simple-js: traverse result 1`] = ` 27 | Array [ 28 | Object { 29 | "importPath": "/_hmr_client.js?namespace=hmr-client", 30 | "importer": "http://127.0.0.1:9000/index.html", 31 | "resolvedImportPath": "http://127.0.0.1:9000/_hmr_client.js?namespace=hmr-client", 32 | }, 33 | Object { 34 | "importPath": "/main.js?namespace=file", 35 | "importer": "http://127.0.0.1:9000/index.html", 36 | "resolvedImportPath": "http://127.0.0.1:9000/main.js?namespace=file", 37 | }, 38 | ] 39 | `; 40 | -------------------------------------------------------------------------------- /fixtures/simple-js/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

My First Heading

6 | 7 |

My first paragraph.

8 | 9 | 10 | -------------------------------------------------------------------------------- /fixtures/simple-js/main.js: -------------------------------------------------------------------------------- 1 | console.log('Hello world!') 2 | 3 | var node = document.createElement('LI') 4 | var textnode = document.createTextNode('works!') 5 | node.appendChild(textnode) 6 | document.body.appendChild(node) 7 | -------------------------------------------------------------------------------- /fixtures/with-alias-plugin/__mirror__/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /fixtures/with-alias-plugin/__mirror__/main.tsx: -------------------------------------------------------------------------------- 1 | import {text} from "/text.ts?namespace=file&t=0"; 2 | import React from "/.bundless/node_modules/preact/compat/dist/compat.module.js.js?namespace=file&t=0"; 3 | const node = document.createElement("pre"); 4 | node.appendChild(document.createTextNode(text)); 5 | document.body.appendChild(node); 6 | console.log(React.cloneElement); 7 | 8 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9Vc2Vycy9tb3JzZS9Eb2N1bWVudHMvR2l0SHViL2VzcGFjay9maXh0dXJlcy93aXRoLWFsaWFzLXBsdWdpbi9tYWluLnRzeCJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyBAanN4IGpzeFxuaW1wb3J0IHsgdGV4dCB9IGZyb20gJ0B2aXJ0dWFsJ1xuaW1wb3J0IFJlYWN0IGZyb20gJ3JlYWN0J1xuXG5jb25zdCBub2RlID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgncHJlJylcbm5vZGUuYXBwZW5kQ2hpbGQoZG9jdW1lbnQuY3JlYXRlVGV4dE5vZGUodGV4dCkpXG5kb2N1bWVudC5ib2R5LmFwcGVuZENoaWxkKG5vZGUpXG5cbmNvbnNvbGUubG9nKFJlYWN0LmNsb25lRWxlbWVudClcbiJdLCJtYXBwaW5ncyI6IkFBQ0E7QUFDQTtBQUVBLE1BQU0sT0FBTyxTQUFTLGNBQWM7QUFDcEMsS0FBSyxZQUFZLFNBQVMsZUFBZTtBQUN6QyxTQUFTLEtBQUssWUFBWTtBQUUxQixRQUFRLElBQUksTUFBTTsiLCJuYW1lcyI6W119 -------------------------------------------------------------------------------- /fixtures/with-alias-plugin/__mirror__/text.ts: -------------------------------------------------------------------------------- 1 | export const text = "virtual"; 2 | 3 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9Vc2Vycy9tb3JzZS9Eb2N1bWVudHMvR2l0SHViL2VzcGFjay9maXh0dXJlcy93aXRoLWFsaWFzLXBsdWdpbi90ZXh0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBjb25zdCB0ZXh0ID0gJ3ZpcnR1YWwnXG4iXSwibWFwcGluZ3MiOiJBQUFPLGFBQU0sT0FBTzsiLCJuYW1lcyI6W119 -------------------------------------------------------------------------------- /fixtures/with-alias-plugin/bundless.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | const { AliasPlugin } = require('@bundless/plugin-alias') 3 | 4 | module.exports = { 5 | build: { 6 | minify: false, 7 | }, 8 | plugins: [ 9 | AliasPlugin({ 10 | entries: [ 11 | { find: 'react', replacement: 'preact/compat' }, 12 | { find: '@virtual', replacement: './text.ts' }, 13 | ], 14 | // paths: { 15 | // 'react/*': [require.resolve('preact/compat')], 16 | // react: [require.resolve('preact/compat')], 17 | // '@virtual': ['text.ts'], 18 | // }, 19 | }), 20 | ], 21 | } 22 | -------------------------------------------------------------------------------- /fixtures/with-alias-plugin/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /fixtures/with-alias-plugin/main.tsx: -------------------------------------------------------------------------------- 1 | // @jsx jsx 2 | import { text } from '@virtual' 3 | import React from 'react' 4 | 5 | const node = document.createElement('pre') 6 | node.appendChild(document.createTextNode(text)) 7 | document.body.appendChild(node) 8 | 9 | console.log(React.cloneElement) 10 | -------------------------------------------------------------------------------- /fixtures/with-alias-plugin/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fixtures-with-alias", 3 | "version": "0.0.0", 4 | "private": true, 5 | "dependencies": { 6 | "preact": "*", 7 | "react-dom": "experimental" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /fixtures/with-alias-plugin/text.ts: -------------------------------------------------------------------------------- 1 | export const text = 'virtual' 2 | -------------------------------------------------------------------------------- /fixtures/with-assets-imports/__mirror__/dynamic-import.js: -------------------------------------------------------------------------------- 1 | export default 'dynamic import' 2 | -------------------------------------------------------------------------------- /fixtures/with-assets-imports/__mirror__/file.css.cssjs: -------------------------------------------------------------------------------- 1 | import * as __HMR__ from '/_hmr_client.js?namespace=hmr-client'; import.meta.hot = __HMR__.createHotContext(import.meta.url); 2 | 3 | const css = "body {\n background-color: aqua;\n}"; 4 | 5 | if (typeof document !== 'undefined') { 6 | import.meta.hot.accept(); 7 | import.meta.hot.dispose(() => { 8 | document.head.removeChild(styleEl); 9 | }); 10 | const styleEl = document.createElement("style"); 11 | const codeEl = document.createTextNode(css); 12 | styleEl.type = 'text/css'; 13 | styleEl.appendChild(codeEl); 14 | document.head.appendChild(styleEl); 15 | } 16 | export default css -------------------------------------------------------------------------------- /fixtures/with-assets-imports/__mirror__/image.png: -------------------------------------------------------------------------------- 1 | export default "/image.png" -------------------------------------------------------------------------------- /fixtures/with-assets-imports/__mirror__/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /fixtures/with-assets-imports/__mirror__/main.js: -------------------------------------------------------------------------------- 1 | import image from '/image.png?namespace=file&t=0' 2 | import '/file.css.cssjs?namespace=file&t=0' 3 | 4 | console.log(image) 5 | 6 | const node = document.createElement('div') 7 | var img = document.createElement('img') 8 | img.src = image 9 | document.body.appendChild(node.appendChild(img)) 10 | 11 | import('/dynamic-import.js?namespace=file&t=0').then(console.log) 12 | -------------------------------------------------------------------------------- /fixtures/with-assets-imports/bundless.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | build: { 3 | // basePath: '/base' 4 | } 5 | } -------------------------------------------------------------------------------- /fixtures/with-assets-imports/dynamic-import.js: -------------------------------------------------------------------------------- 1 | export default 'dynamic import' 2 | -------------------------------------------------------------------------------- /fixtures/with-assets-imports/file.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: aqua; 3 | } -------------------------------------------------------------------------------- /fixtures/with-assets-imports/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/remorses/bundless/c7c167a78b03f8b643bcd1ed091f6b155fa84043/fixtures/with-assets-imports/image.png -------------------------------------------------------------------------------- /fixtures/with-assets-imports/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /fixtures/with-assets-imports/main.js: -------------------------------------------------------------------------------- 1 | import image from './image.png' 2 | import './file.css' 3 | 4 | console.log(image) 5 | 6 | const node = document.createElement('div') 7 | var img = document.createElement('img') 8 | img.src = image 9 | document.body.appendChild(node.appendChild(img)) 10 | 11 | import('./dynamic-import.js').then(console.log) 12 | -------------------------------------------------------------------------------- /fixtures/with-babel-plugin/__mirror__/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 |
9 | 10 | -------------------------------------------------------------------------------- /fixtures/with-babel-plugin/__mirror__/main.tsx: -------------------------------------------------------------------------------- 1 | import _styled from "/.bundless/node_modules/styled-components/dist/styled-components.esm.js.js?namespace=file&t=0"; 2 | import react_cjsImport1 from "/.bundless/node_modules/react/index.js.js?namespace=file&t=0"; const React = react_cjsImport1 && react_cjsImport1.__esModule ? react_cjsImport1.default : react_cjsImport1;; 3 | import reactDom_cjsImport2 from "/.bundless/node_modules/react-dom/index.js.js?namespace=file&t=0"; const dom = reactDom_cjsImport2 && reactDom_cjsImport2.__esModule ? reactDom_cjsImport2.default : reactDom_cjsImport2;; 4 | const ONE_DAY = 864e5; 5 | const TWO_DAYS = 1728e5; 6 | console.log(TWO_DAYS); 7 | const Heading = _styled.h1.withConfig({ 8 | displayName: "main__Heading", 9 | componentId: "p638xe-0" 10 | })(["font-size:2rem;color:red;"]); 11 | dom.render(/* @__PURE__ */ React.createElement(Heading, null, "ciao"), document.getElementById("main")); 12 | 13 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9Vc2Vycy9tb3JzZS9Eb2N1bWVudHMvR2l0SHViL2VzcGFjay9maXh0dXJlcy93aXRoLWJhYmVsLXBsdWdpbi9tYWluLnRzeCJdLCJuYW1lcyI6WyJPTkVfREFZIiwiVFdPX0RBWVMiLCJjb25zb2xlIiwibG9nIiwiSGVhZGluZyIsInN0eWxlZCIsImgxIiwiZG9tIiwicmVuZGVyIiwiZG9jdW1lbnQiLCJnZXRFbGVtZW50QnlJZCJdLCJtYXBwaW5ncyI6IjtBQUNBO0FBQ0E7QUFFQSxNQUFNQSxVQUFPO0FBQ2IsTUFBTUMsV0FBUTtBQUVkQyxRQUFRQyxJQUFJRjtBQUtaLE1BQU1HLFVBQVVDLFFBQU9DLEdBQVYsV0FBQTtBQUFBLEVBQUEsYUFBQTtBQUFBLEVBQUEsYUFBQTtBQUFBLEdBQUEsQ0FBQTtBQUtiQyxJQUFJQyxPQUFPLG9DQUFDLFNBQUQsTUFBUyxTQUFnQkMsU0FBU0MsZUFBZSIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBtcyBmcm9tICdtcy5tYWNybydcbmltcG9ydCBSZWFjdCBmcm9tICdyZWFjdCdcbmltcG9ydCBkb20gZnJvbSAncmVhY3QtZG9tJ1xuXG5jb25zdCBPTkVfREFZID0gbXMoJzEgZGF5JylcbmNvbnN0IFRXT19EQVlTID0gbXMoJzIgZGF5cycpXG5cbmNvbnNvbGUubG9nKFRXT19EQVlTKVxuXG4vLyBzcmMvSGVhZGluZy9IZWFkaW5nLnRzXG5pbXBvcnQgc3R5bGVkIGZyb20gJ3N0eWxlZC1jb21wb25lbnRzL21hY3JvJ1xuXG5jb25zdCBIZWFkaW5nID0gc3R5bGVkLmgxYFxuICAgIGZvbnQtc2l6ZTogMnJlbTtcbiAgICBjb2xvcjogcmVkO1xuYFxuXG5kb20ucmVuZGVyKDxIZWFkaW5nPmNpYW88L0hlYWRpbmc+LCBkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgnbWFpbicpKVxuIl19 -------------------------------------------------------------------------------- /fixtures/with-babel-plugin/bundless.config.js: -------------------------------------------------------------------------------- 1 | const { BabelPlugin } = require('@bundless/plugin-babel') 2 | 3 | module.exports = { 4 | plugins: [ 5 | BabelPlugin({ 6 | babelOptions: { 7 | plugins: [require('babel-plugin-macros')], 8 | }, 9 | }), 10 | ], 11 | } 12 | -------------------------------------------------------------------------------- /fixtures/with-babel-plugin/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | -------------------------------------------------------------------------------- /fixtures/with-babel-plugin/main.tsx: -------------------------------------------------------------------------------- 1 | import ms from 'ms.macro' 2 | import React from 'react' 3 | import dom from 'react-dom' 4 | 5 | const ONE_DAY = ms('1 day') 6 | const TWO_DAYS = ms('2 days') 7 | 8 | console.log(TWO_DAYS) 9 | 10 | // src/Heading/Heading.ts 11 | import styled from 'styled-components/macro' 12 | 13 | const Heading = styled.h1` 14 | font-size: 2rem; 15 | color: red; 16 | ` 17 | 18 | dom.render(ciao, document.getElementById('main')) 19 | -------------------------------------------------------------------------------- /fixtures/with-babel-plugin/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fixtures-with-babel", 3 | "version": "0.0.0", 4 | "private": true, 5 | "dependencies": { 6 | "babel-plugin-macros": "3.0.1", 7 | "styled-components": "^5.2.1", 8 | "ms.macro": "^2.0.0" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /fixtures/with-commonjs-transform/.bundless/bundleMap.json: -------------------------------------------------------------------------------- 1 | { 2 | "../../node_modules/react/index.js": ".bundless/node_modules/react/index.js.js", 3 | "../../node_modules/react-dom/index.js": ".bundless/node_modules/react-dom/index.js.js" 4 | } 5 | -------------------------------------------------------------------------------- /fixtures/with-commonjs-transform/.bundless/commonjs.json: -------------------------------------------------------------------------------- 1 | { 2 | "isCommonjs": { 3 | ".bundless/node_modules/react/index.js.js": true, 4 | ".bundless/node_modules/react-dom/index.js.js": true 5 | } 6 | } -------------------------------------------------------------------------------- /fixtures/with-commonjs-transform/__mirror__/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | -------------------------------------------------------------------------------- /fixtures/with-commonjs-transform/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | -------------------------------------------------------------------------------- /fixtures/with-commonjs-transform/main.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import * as ReactNamespace from 'react' 3 | import { useState } from 'react' 4 | 5 | console.log('useState', String(useState)) 6 | console.log({ ReactAll: ReactNamespace, Fragment: ReactNamespace.Fragment }) 7 | 8 | var node = document.createElement('pre') 9 | var textnode = document.createTextNode(String(useState)) 10 | node.appendChild(textnode) 11 | document.body.appendChild(node) 12 | 13 | import('react-dom').then((react) => 14 | react.render(
, document.getElementById('root')), 15 | ) 16 | -------------------------------------------------------------------------------- /fixtures/with-commonjs-transform/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fixtures-with-commonjs-transform", 3 | "version": "0.0.0", 4 | "private": true, 5 | "dependencies": { 6 | "react": "experimental", 7 | "react-dom": "experimental" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /fixtures/with-css-modules/__mirror__/file.js: -------------------------------------------------------------------------------- 1 | export const text = 'This has been made in 2020, what a shitty year' 2 | 3 | -------------------------------------------------------------------------------- /fixtures/with-css-modules/__mirror__/file.module.css.cssjs: -------------------------------------------------------------------------------- 1 | import * as __HMR__ from '/_hmr_client.js?namespace=hmr-client'; import.meta.hot = __HMR__.createHotContext(import.meta.url); 2 | 3 | const css = ".textLarge {\n font-size: 100px;\n}\n"; 4 | 5 | if (typeof document !== 'undefined') { 6 | import.meta.hot.accept(); 7 | import.meta.hot.dispose(() => { 8 | document.head.removeChild(styleEl); 9 | }); 10 | const styleEl = document.createElement("style"); 11 | const codeEl = document.createTextNode(css); 12 | styleEl.type = 'text/css'; 13 | styleEl.appendChild(codeEl); 14 | document.head.appendChild(styleEl); 15 | } 16 | export default css -------------------------------------------------------------------------------- /fixtures/with-css-modules/__mirror__/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /fixtures/with-css-modules/__mirror__/main.js: -------------------------------------------------------------------------------- 1 | import * as __HMR__ from '/_hmr_client.js?namespace=hmr-client'; import.meta.hot = __HMR__.createHotContext(import.meta.url); import classNames from '/file.module.css.cssjs?namespace=file&t=0' 2 | import { text } from '/file.js?namespace=file&t=0' 3 | 4 | console.log({ classNames }) 5 | 6 | const node = document.createElement('pre') 7 | node.appendChild(document.createTextNode(text)) 8 | document.body.appendChild(node) 9 | 10 | if (import.meta.hot) { 11 | import.meta.hot.accept() 12 | } 13 | -------------------------------------------------------------------------------- /fixtures/with-css-modules/file.js: -------------------------------------------------------------------------------- 1 | export const text = 'This has been made in 2020, what a shitty year' 2 | 3 | -------------------------------------------------------------------------------- /fixtures/with-css-modules/file.module.css: -------------------------------------------------------------------------------- 1 | .textLarge { 2 | font-size: 100px; 3 | } 4 | -------------------------------------------------------------------------------- /fixtures/with-css-modules/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /fixtures/with-css-modules/main.js: -------------------------------------------------------------------------------- 1 | import classNames from './file.module.css' 2 | import { text } from './file' 3 | 4 | console.log({ classNames }) 5 | 6 | const node = document.createElement('pre') 7 | node.appendChild(document.createTextNode(text)) 8 | document.body.appendChild(node) 9 | 10 | if (import.meta.hot) { 11 | import.meta.hot.accept() 12 | } 13 | -------------------------------------------------------------------------------- /fixtures/with-css/__mirror__/file.css.cssjs: -------------------------------------------------------------------------------- 1 | import * as __HMR__ from '/_hmr_client.js?namespace=hmr-client'; import.meta.hot = __HMR__.createHotContext(import.meta.url); 2 | 3 | const css = "body {\n background: lightcoral;\n}\n\npre {\n background: white;\n}\n\n"; 4 | 5 | if (typeof document !== 'undefined') { 6 | import.meta.hot.accept(); 7 | import.meta.hot.dispose(() => { 8 | document.head.removeChild(styleEl); 9 | }); 10 | const styleEl = document.createElement("style"); 11 | const codeEl = document.createTextNode(css); 12 | styleEl.type = 'text/css'; 13 | styleEl.appendChild(codeEl); 14 | document.head.appendChild(styleEl); 15 | } 16 | export default css -------------------------------------------------------------------------------- /fixtures/with-css/__mirror__/file.js: -------------------------------------------------------------------------------- 1 | export const text = 'This has been made in 2020, what a shitty year' 2 | 3 | -------------------------------------------------------------------------------- /fixtures/with-css/__mirror__/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /fixtures/with-css/__mirror__/main.js: -------------------------------------------------------------------------------- 1 | import * as __HMR__ from '/_hmr_client.js?namespace=hmr-client'; import.meta.hot = __HMR__.createHotContext(import.meta.url); import '/file.css.cssjs?namespace=file&t=0' 2 | import { text } from '/file.js?namespace=file&t=0' 3 | const node = document.createElement('pre') 4 | node.appendChild(document.createTextNode(text)) 5 | document.body.appendChild(node) 6 | 7 | if (import.meta.hot) { 8 | import.meta.hot.accept() 9 | } 10 | -------------------------------------------------------------------------------- /fixtures/with-css/file.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: lightcoral; 3 | } 4 | 5 | pre { 6 | background: white; 7 | } 8 | 9 | -------------------------------------------------------------------------------- /fixtures/with-css/file.js: -------------------------------------------------------------------------------- 1 | export const text = 'This has been made in 2020, what a shitty year' 2 | 3 | -------------------------------------------------------------------------------- /fixtures/with-css/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /fixtures/with-css/main.js: -------------------------------------------------------------------------------- 1 | import './file.css' 2 | import { text } from './file' 3 | const node = document.createElement('pre') 4 | node.appendChild(document.createTextNode(text)) 5 | document.body.appendChild(node) 6 | 7 | if (import.meta.hot) { 8 | import.meta.hot.accept() 9 | } 10 | -------------------------------------------------------------------------------- /fixtures/with-custom-assets/__mirror__/file.dat: -------------------------------------------------------------------------------- 1 | export default "/file.dat" -------------------------------------------------------------------------------- /fixtures/with-custom-assets/__mirror__/file.fakecss.cssjs: -------------------------------------------------------------------------------- 1 | import * as __HMR__ from '/_hmr_client.js?namespace=hmr-client'; import.meta.hot = __HMR__.createHotContext(import.meta.url); 2 | 3 | const css = "body {\n background: blue;\n}"; 4 | 5 | if (typeof document !== 'undefined') { 6 | import.meta.hot.accept(); 7 | import.meta.hot.dispose(() => { 8 | document.head.removeChild(styleEl); 9 | }); 10 | const styleEl = document.createElement("style"); 11 | const codeEl = document.createTextNode(css); 12 | styleEl.type = 'text/css'; 13 | styleEl.appendChild(codeEl); 14 | document.head.appendChild(styleEl); 15 | } 16 | export default css -------------------------------------------------------------------------------- /fixtures/with-custom-assets/__mirror__/file.fakejs: -------------------------------------------------------------------------------- 1 | export default "i am file.fakejs"; 2 | -------------------------------------------------------------------------------- /fixtures/with-custom-assets/__mirror__/file.js: -------------------------------------------------------------------------------- 1 | import dat from '/file.dat?namespace=file&t=0' 2 | import svg from '/file.svg?namespace=file&t=0' 3 | 4 | import('/x.DAC?namespace=file&t=0').then(console.log) 5 | console.log({ dat }) 6 | 7 | const node = document.createElement('img') 8 | node.setAttribute('src', svg) 9 | document.body.appendChild(node) 10 | 11 | export const text = dat 12 | -------------------------------------------------------------------------------- /fixtures/with-custom-assets/__mirror__/file.svg: -------------------------------------------------------------------------------- 1 | export default "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIiB3aWR0aD0iMTAwIj4KICA8cGF0aCBkPSJNMzAsMWg0MGwyOSwyOXY0MGwtMjksMjloLTQwbC0yOS0yOXYtNDB6IiBzdHJva2U9IiMwMDAiIGZpbGw9Im5vbmUiLz4gCiAgPHBhdGggZD0iTTMxLDNoMzhsMjgsMjh2MzhsLTI4LDI4aC0zOGwtMjgtMjh2LTM4eiIgZmlsbD0iI2EyMyIvPiAKICA8dGV4dCB4PSI1MCIgeT0iNjgiIGZvbnQtc2l6ZT0iNDgiIGZpbGw9IiNGRkYiIHRleHQtYW5jaG9yPSJtaWRkbGUiPjwhW0NEQVRBWzQxMF1dPjwvdGV4dD4KPC9zdmc+Cg==" -------------------------------------------------------------------------------- /fixtures/with-custom-assets/__mirror__/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /fixtures/with-custom-assets/__mirror__/main.js: -------------------------------------------------------------------------------- 1 | import * as __HMR__ from '/_hmr_client.js?namespace=hmr-client'; import.meta.hot = __HMR__.createHotContext(import.meta.url); import { text } from '/file.js?namespace=file&t=0' 2 | import '/file.fakecss.cssjs?namespace=file&t=0' 3 | import fakejs from '/file.fakejs?namespace=file&t=0' 4 | 5 | const node = document.createElement('pre') 6 | node.appendChild(document.createTextNode(text + ' ' + fakejs)) 7 | document.body.appendChild(node) 8 | 9 | if (import.meta.hot) { 10 | import.meta.hot.accept() 11 | } 12 | -------------------------------------------------------------------------------- /fixtures/with-custom-assets/__mirror__/x.DAC: -------------------------------------------------------------------------------- 1 | export default "/x.DAC" -------------------------------------------------------------------------------- /fixtures/with-custom-assets/bundless.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | loader: { 3 | '.dat': 'file', 4 | '.DAC': 'file', 5 | '.svg': 'dataurl', 6 | '.fakejs': 'ts', 7 | '.fakecss': 'css', 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /fixtures/with-custom-assets/file.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/remorses/bundless/c7c167a78b03f8b643bcd1ed091f6b155fa84043/fixtures/with-custom-assets/file.dat -------------------------------------------------------------------------------- /fixtures/with-custom-assets/file.fakecss: -------------------------------------------------------------------------------- 1 | body { 2 | background: blue; 3 | } -------------------------------------------------------------------------------- /fixtures/with-custom-assets/file.fakejs: -------------------------------------------------------------------------------- 1 | 2 | export default 'i am file.fakejs' 3 | 4 | export type x = string -------------------------------------------------------------------------------- /fixtures/with-custom-assets/file.js: -------------------------------------------------------------------------------- 1 | import dat from './file.dat' 2 | import svg from './file.svg' 3 | 4 | import('./x.DAC').then(console.log) 5 | console.log({ dat }) 6 | 7 | const node = document.createElement('img') 8 | node.setAttribute('src', svg) 9 | document.body.appendChild(node) 10 | 11 | export const text = dat 12 | -------------------------------------------------------------------------------- /fixtures/with-custom-assets/file.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 410 5 | 6 | -------------------------------------------------------------------------------- /fixtures/with-custom-assets/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /fixtures/with-custom-assets/main.js: -------------------------------------------------------------------------------- 1 | import { text } from './file' 2 | import './file.fakecss' 3 | import fakejs from './file.fakejs' 4 | 5 | const node = document.createElement('pre') 6 | node.appendChild(document.createTextNode(text + ' ' + fakejs)) 7 | document.body.appendChild(node) 8 | 9 | if (import.meta.hot) { 10 | import.meta.hot.accept() 11 | } 12 | -------------------------------------------------------------------------------- /fixtures/with-custom-assets/x.DAC: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/remorses/bundless/c7c167a78b03f8b643bcd1ed091f6b155fa84043/fixtures/with-custom-assets/x.DAC -------------------------------------------------------------------------------- /fixtures/with-dependencies-assets/.bundless/bundleMap.json: -------------------------------------------------------------------------------- 1 | { 2 | "../../node_modules/tailwindcss/dist/base.css.cssjs": ".bundless/node_modules/tailwindcss/dist/base.css.js" 3 | } 4 | -------------------------------------------------------------------------------- /fixtures/with-dependencies-assets/.bundless/commonjs.json: -------------------------------------------------------------------------------- 1 | { 2 | "isCommonjs": { 3 | ".bundless/node_modules/tailwindcss/dist/base.css.js": true 4 | } 5 | } -------------------------------------------------------------------------------- /fixtures/with-dependencies-assets/__mirror__/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /fixtures/with-dependencies-assets/__mirror__/main.js: -------------------------------------------------------------------------------- 1 | import tailwindcss_dist_base_css_cjsImport0 from "/.bundless/node_modules/tailwindcss/dist/base.css.js?namespace=file&t=0"; 2 | 3 | console.log('Hello world!!!!!') 4 | 5 | const node = document.createElement('pre') 6 | document.body.appendChild(node.appendChild(document.createTextNode('hello'))) 7 | -------------------------------------------------------------------------------- /fixtures/with-dependencies-assets/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /fixtures/with-dependencies-assets/main.js: -------------------------------------------------------------------------------- 1 | import 'tailwindcss/dist/base.css' 2 | 3 | console.log('Hello world!!!!!') 4 | 5 | const node = document.createElement('pre') 6 | document.body.appendChild(node.appendChild(document.createTextNode('hello'))) 7 | -------------------------------------------------------------------------------- /fixtures/with-dependencies-assets/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fixtures-with-dependencies-assets", 3 | "version": "0.0.0", 4 | "main": "main.js", 5 | "private": true, 6 | "dependencies": { 7 | "tailwindcss": "^1.7.2" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /fixtures/with-dependencies/.bundless/bundleMap.json: -------------------------------------------------------------------------------- 1 | { 2 | "../../node_modules/slash/index.js": ".bundless/node_modules/slash/index.js.js" 3 | } 4 | -------------------------------------------------------------------------------- /fixtures/with-dependencies/.bundless/commonjs.json: -------------------------------------------------------------------------------- 1 | { 2 | "isCommonjs": { 3 | ".bundless/node_modules/slash/index.js.js": true 4 | } 5 | } -------------------------------------------------------------------------------- /fixtures/with-dependencies/__mirror__/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /fixtures/with-dependencies/__mirror__/main.js: -------------------------------------------------------------------------------- 1 | import slash_cjsImport0 from "/.bundless/node_modules/slash/index.js.js?namespace=file&t=0"; const slash = slash_cjsImport0 && slash_cjsImport0.__esModule ? slash_cjsImport0.default : slash_cjsImport0; 2 | 3 | console.log('Hello world!') 4 | 5 | const text = slash('.\\path\\to\\something') 6 | 7 | var node = document.createElement('LI') 8 | var textnode = document.createTextNode(text) 9 | node.appendChild(textnode) 10 | document.body.appendChild(node) 11 | -------------------------------------------------------------------------------- /fixtures/with-dependencies/__snapshots__: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`snapshots fixtures/with-dependencies: build 1`] = ` 4 | Array [ 5 | "index.html", 6 | "index.js", 7 | ] 8 | `; 9 | 10 | exports[`snapshots fixtures/with-dependencies: content-type headers 1`] = ` 11 | Object { 12 | "http://127.0.0.1:9000/.bundless/node_modules/slash/index.js.js?namespace=file&t=0": "application/javascript; charset=utf-8", 13 | "http://127.0.0.1:9000/_hmr_client.js?namespace=hmr-client": "application/javascript; charset=utf-8", 14 | "http://127.0.0.1:9000/index.html": "text/html; charset=utf-8", 15 | "http://127.0.0.1:9000/main.js?namespace=file": "application/javascript; charset=utf-8", 16 | } 17 | `; 18 | 19 | exports[`snapshots fixtures/with-dependencies: mirror 1`] = ` 20 | Array [ 21 | "_hmr_client.js", 22 | "index.html", 23 | "main.js", 24 | ] 25 | `; 26 | 27 | exports[`snapshots fixtures/with-dependencies: traverse result 1`] = ` 28 | Array [ 29 | Object { 30 | "importPath": "/_hmr_client.js?namespace=hmr-client", 31 | "importer": "http://127.0.0.1:9000/index.html", 32 | "resolvedImportPath": "http://127.0.0.1:9000/_hmr_client.js?namespace=hmr-client", 33 | }, 34 | Object { 35 | "importPath": "/.bundless/node_modules/slash/index.js.js?namespace=file&t=0", 36 | "importer": "http://127.0.0.1:9000/main.js?namespace=file", 37 | "resolvedImportPath": "http://127.0.0.1:9000/.bundless/node_modules/slash/index.js.js?namespace=file&t=0", 38 | }, 39 | Object { 40 | "importPath": "/main.js?namespace=file", 41 | "importer": "http://127.0.0.1:9000/index.html", 42 | "resolvedImportPath": "http://127.0.0.1:9000/main.js?namespace=file", 43 | }, 44 | ] 45 | `; 46 | -------------------------------------------------------------------------------- /fixtures/with-dependencies/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /fixtures/with-dependencies/main.js: -------------------------------------------------------------------------------- 1 | import slash from 'slash' 2 | 3 | console.log('Hello world!') 4 | 5 | const text = slash('.\\path\\to\\something') 6 | 7 | var node = document.createElement('LI') 8 | var textnode = document.createTextNode(text) 9 | node.appendChild(textnode) 10 | document.body.appendChild(node) 11 | -------------------------------------------------------------------------------- /fixtures/with-dynamic-import/__mirror__/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /fixtures/with-dynamic-import/__mirror__/main.js: -------------------------------------------------------------------------------- 1 | 2 | import('/text.js?namespace=file&t=0').then(({ text }) => { 3 | var node = document.createElement('LI') 4 | var textNode = document.createTextNode(text) 5 | node.appendChild(textNode) 6 | document.body.appendChild(node) 7 | }) 8 | -------------------------------------------------------------------------------- /fixtures/with-dynamic-import/__mirror__/text.js: -------------------------------------------------------------------------------- 1 | export const text = 'CIAO!' -------------------------------------------------------------------------------- /fixtures/with-dynamic-import/__snapshots__: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`snapshots fixtures/with-dynamic-import: build 1`] = ` 4 | Array [ 5 | "chunks/text-3I42H3S6.js", 6 | "index.html", 7 | "index.js", 8 | ] 9 | `; 10 | 11 | exports[`snapshots fixtures/with-dynamic-import: content-type headers 1`] = ` 12 | Object { 13 | "http://127.0.0.1:9000/_hmr_client.js?namespace=hmr-client": "application/javascript; charset=utf-8", 14 | "http://127.0.0.1:9000/index.html": "text/html; charset=utf-8", 15 | "http://127.0.0.1:9000/main.js?namespace=file": "application/javascript; charset=utf-8", 16 | "http://127.0.0.1:9000/text.js?namespace=file&t=0": "application/javascript; charset=utf-8", 17 | } 18 | `; 19 | 20 | exports[`snapshots fixtures/with-dynamic-import: mirror 1`] = ` 21 | Array [ 22 | "_hmr_client.js", 23 | "index.html", 24 | "main.js", 25 | "text.js", 26 | ] 27 | `; 28 | 29 | exports[`snapshots fixtures/with-dynamic-import: traverse result 1`] = ` 30 | Array [ 31 | Object { 32 | "importPath": "/_hmr_client.js?namespace=hmr-client", 33 | "importer": "http://127.0.0.1:9000/index.html", 34 | "resolvedImportPath": "http://127.0.0.1:9000/_hmr_client.js?namespace=hmr-client", 35 | }, 36 | Object { 37 | "importPath": "/main.js?namespace=file", 38 | "importer": "http://127.0.0.1:9000/index.html", 39 | "resolvedImportPath": "http://127.0.0.1:9000/main.js?namespace=file", 40 | }, 41 | Object { 42 | "importPath": "/text.js?namespace=file&t=0", 43 | "importer": "http://127.0.0.1:9000/main.js?namespace=file", 44 | "resolvedImportPath": "http://127.0.0.1:9000/text.js?namespace=file&t=0", 45 | }, 46 | ] 47 | `; 48 | -------------------------------------------------------------------------------- /fixtures/with-dynamic-import/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /fixtures/with-dynamic-import/main.js: -------------------------------------------------------------------------------- 1 | 2 | import('./text').then(({ text }) => { 3 | var node = document.createElement('LI') 4 | var textNode = document.createTextNode(text) 5 | node.appendChild(textNode) 6 | document.body.appendChild(node) 7 | }) 8 | -------------------------------------------------------------------------------- /fixtures/with-dynamic-import/text.js: -------------------------------------------------------------------------------- 1 | export const text = 'CIAO!' -------------------------------------------------------------------------------- /fixtures/with-env-plugin/__mirror__/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /fixtures/with-env-plugin/__mirror__/main.tsx: -------------------------------------------------------------------------------- 1 | const node = document.createElement("pre"); 2 | node.appendChild(document.createTextNode(process.env.SOME_VAR)); 3 | document.body.appendChild(node); 4 | console.log(process.env.SOME_VAR); 5 | 6 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9Vc2Vycy9tb3JzZS9Eb2N1bWVudHMvR2l0SHViL2VzcGFjay9maXh0dXJlcy93aXRoLWVudi1wbHVnaW4vbWFpbi50c3giXSwic291cmNlc0NvbnRlbnQiOlsiLy8gQGpzeCBqc3hcblxuY29uc3Qgbm9kZSA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ3ByZScpXG5ub2RlLmFwcGVuZENoaWxkKGRvY3VtZW50LmNyZWF0ZVRleHROb2RlKHByb2Nlc3MuZW52LlNPTUVfVkFSKSlcbmRvY3VtZW50LmJvZHkuYXBwZW5kQ2hpbGQobm9kZSlcblxuY29uc29sZS5sb2cocHJvY2Vzcy5lbnYuU09NRV9WQVIpXG4iXSwibWFwcGluZ3MiOiJBQUVBLE1BQU0sT0FBTyxTQUFTLGNBQWM7QUFDcEMsS0FBSyxZQUFZLFNBQVMsZUFBZSxRQUFRLElBQUk7QUFDckQsU0FBUyxLQUFLLFlBQVk7QUFFMUIsUUFBUSxJQUFJLFFBQVEsSUFBSTsiLCJuYW1lcyI6W119 -------------------------------------------------------------------------------- /fixtures/with-env-plugin/__snapshots__: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`snapshots fixtures/with-env-plugin: build 1`] = ` 4 | Array [ 5 | "index.html", 6 | "index.js", 7 | ] 8 | `; 9 | 10 | exports[`snapshots fixtures/with-env-plugin: content-type headers 1`] = ` 11 | Object { 12 | "http://127.0.0.1:9000/_hmr_client.js?namespace=hmr-client": "application/javascript; charset=utf-8", 13 | "http://127.0.0.1:9000/index.html": "text/html; charset=utf-8", 14 | "http://127.0.0.1:9000/main.tsx?namespace=file": "application/javascript; charset=utf-8", 15 | } 16 | `; 17 | 18 | exports[`snapshots fixtures/with-env-plugin: mirror 1`] = ` 19 | Array [ 20 | "_hmr_client.js", 21 | "index.html", 22 | "main.tsx", 23 | ] 24 | `; 25 | 26 | exports[`snapshots fixtures/with-env-plugin: traverse result 1`] = ` 27 | Array [ 28 | Object { 29 | "importPath": "/_hmr_client.js?namespace=hmr-client", 30 | "importer": "http://127.0.0.1:9000/index.html", 31 | "resolvedImportPath": "http://127.0.0.1:9000/_hmr_client.js?namespace=hmr-client", 32 | }, 33 | Object { 34 | "importPath": "/main.tsx?namespace=file", 35 | "importer": "http://127.0.0.1:9000/index.html", 36 | "resolvedImportPath": "http://127.0.0.1:9000/main.tsx?namespace=file", 37 | }, 38 | ] 39 | `; 40 | -------------------------------------------------------------------------------- /fixtures/with-env-plugin/bundless.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | const { EnvPlugin } = require('@bundless/cli/dist/plugins') 3 | 4 | module.exports = { 5 | build: { 6 | minify: false, 7 | }, 8 | plugins: [ 9 | EnvPlugin({ 10 | envFiles: ['envfile'], 11 | }), 12 | ], 13 | } 14 | -------------------------------------------------------------------------------- /fixtures/with-env-plugin/envfile: -------------------------------------------------------------------------------- 1 | SOME_VAR="ciao" -------------------------------------------------------------------------------- /fixtures/with-env-plugin/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /fixtures/with-env-plugin/main.tsx: -------------------------------------------------------------------------------- 1 | // @jsx jsx 2 | 3 | const node = document.createElement('pre') 4 | node.appendChild(document.createTextNode(process.env.SOME_VAR)) 5 | document.body.appendChild(node) 6 | 7 | console.log(process.env.SOME_VAR) 8 | -------------------------------------------------------------------------------- /fixtures/with-esbuild-plugins/__mirror__/fake.js: -------------------------------------------------------------------------------- 1 | export const text = './fake.js' -------------------------------------------------------------------------------- /fixtures/with-esbuild-plugins/__mirror__/file.gql: -------------------------------------------------------------------------------- 1 | export default "interface Node {\n x: String\n y: String\n}" -------------------------------------------------------------------------------- /fixtures/with-esbuild-plugins/__mirror__/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /fixtures/with-esbuild-plugins/__mirror__/main.js: -------------------------------------------------------------------------------- 1 | import * as __HMR__ from '/_hmr_client.js?namespace=hmr-client'; import.meta.hot = __HMR__.createHotContext(import.meta.url); import schema from '/file.gql?namespace=file&t=0' 2 | import { text } from '/fake.js?namespace=file&t=0' 3 | 4 | const node = document.createElement('pre') 5 | node.appendChild(document.createTextNode(schema)) 6 | node.appendChild(document.createTextNode('\n' + text)) 7 | document.body.appendChild(node) 8 | 9 | 10 | 11 | if (import.meta.hot) { 12 | import.meta.hot.accept() 13 | import.meta.hot.dispose(() => { 14 | document.body.removeChild(node) 15 | }) 16 | } 17 | -------------------------------------------------------------------------------- /fixtures/with-esbuild-plugins/bundless.config.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs') 2 | const path = require('path') 3 | 4 | /** 5 | * @type { import('@bundless/cli').Config } 6 | */ 7 | module.exports = { 8 | plugins: [ 9 | { 10 | name: 'onLoad', 11 | setup({ onLoad }) { 12 | onLoad({ filter: /\.gql/ }, (arg) => { 13 | return { 14 | loader: 'js', 15 | contents: `export default ${JSON.stringify( 16 | fs.readFileSync(arg.path).toString(), 17 | )}`, 18 | } 19 | }) 20 | }, 21 | }, 22 | { 23 | name: 'onResolve', 24 | setup({ onResolve }) { 25 | onResolve({ filter: /\.fake/ }, (arg) => { 26 | return { 27 | path: path.resolve(__dirname, 'fake.js'), 28 | } 29 | }) 30 | }, 31 | }, 32 | ], 33 | } 34 | -------------------------------------------------------------------------------- /fixtures/with-esbuild-plugins/fake.js: -------------------------------------------------------------------------------- 1 | export const text = './fake.js' -------------------------------------------------------------------------------- /fixtures/with-esbuild-plugins/file.gql: -------------------------------------------------------------------------------- 1 | interface Node { 2 | x: String 3 | y: String 4 | } -------------------------------------------------------------------------------- /fixtures/with-esbuild-plugins/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /fixtures/with-esbuild-plugins/main.js: -------------------------------------------------------------------------------- 1 | import schema from './file.gql' 2 | import { text } from './file.fake' 3 | 4 | const node = document.createElement('pre') 5 | node.appendChild(document.createTextNode(schema)) 6 | node.appendChild(document.createTextNode('\n' + text)) 7 | document.body.appendChild(node) 8 | 9 | 10 | 11 | if (import.meta.hot) { 12 | import.meta.hot.accept() 13 | import.meta.hot.dispose(() => { 14 | document.body.removeChild(node) 15 | }) 16 | } 17 | -------------------------------------------------------------------------------- /fixtures/with-imports/__mirror__/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /fixtures/with-imports/__mirror__/main.js: -------------------------------------------------------------------------------- 1 | import { text } from '/text.js?namespace=file&t=0' 2 | 3 | console.log('Hello world!!!!!') 4 | 5 | const node = document.createElement('pre') 6 | document.body.appendChild(node.appendChild(document.createTextNode(text))) 7 | -------------------------------------------------------------------------------- /fixtures/with-imports/__mirror__/text.js: -------------------------------------------------------------------------------- 1 | export const text = 'CIAO!' -------------------------------------------------------------------------------- /fixtures/with-imports/__snapshots__: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`snapshots fixtures/with-imports: build 1`] = ` 4 | Array [ 5 | "index.html", 6 | "index.js", 7 | ] 8 | `; 9 | 10 | exports[`snapshots fixtures/with-imports: content-type headers 1`] = ` 11 | Object { 12 | "http://127.0.0.1:9000/_hmr_client.js?namespace=hmr-client": "application/javascript; charset=utf-8", 13 | "http://127.0.0.1:9000/index.html": "text/html; charset=utf-8", 14 | "http://127.0.0.1:9000/main.js?namespace=file": "application/javascript; charset=utf-8", 15 | "http://127.0.0.1:9000/text.js?namespace=file&t=0": "application/javascript; charset=utf-8", 16 | } 17 | `; 18 | 19 | exports[`snapshots fixtures/with-imports: mirror 1`] = ` 20 | Array [ 21 | "_hmr_client.js", 22 | "index.html", 23 | "main.js", 24 | "text.js", 25 | ] 26 | `; 27 | 28 | exports[`snapshots fixtures/with-imports: traverse result 1`] = ` 29 | Array [ 30 | Object { 31 | "importPath": "/_hmr_client.js?namespace=hmr-client", 32 | "importer": "http://127.0.0.1:9000/index.html", 33 | "resolvedImportPath": "http://127.0.0.1:9000/_hmr_client.js?namespace=hmr-client", 34 | }, 35 | Object { 36 | "importPath": "/main.js?namespace=file", 37 | "importer": "http://127.0.0.1:9000/index.html", 38 | "resolvedImportPath": "http://127.0.0.1:9000/main.js?namespace=file", 39 | }, 40 | Object { 41 | "importPath": "/text.js?namespace=file&t=0", 42 | "importer": "http://127.0.0.1:9000/main.js?namespace=file", 43 | "resolvedImportPath": "http://127.0.0.1:9000/text.js?namespace=file&t=0", 44 | }, 45 | ] 46 | `; 47 | -------------------------------------------------------------------------------- /fixtures/with-imports/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /fixtures/with-imports/main.js: -------------------------------------------------------------------------------- 1 | import { text } from './text' 2 | 3 | console.log('Hello world!!!!!') 4 | 5 | const node = document.createElement('pre') 6 | document.body.appendChild(node.appendChild(document.createTextNode(text))) 7 | -------------------------------------------------------------------------------- /fixtures/with-imports/text.js: -------------------------------------------------------------------------------- 1 | export const text = 'CIAO!' -------------------------------------------------------------------------------- /fixtures/with-json/__mirror__/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /fixtures/with-json/__mirror__/main.js: -------------------------------------------------------------------------------- 1 | import json from '/text.json?namespace=file&t=0' 2 | 3 | const node = document.createElement('pre') 4 | document.body.appendChild(node.appendChild(document.createTextNode(json.text))) 5 | -------------------------------------------------------------------------------- /fixtures/with-json/__mirror__/text.json: -------------------------------------------------------------------------------- 1 | var text = "Hello World!"; 2 | var text_default = { 3 | text 4 | }; 5 | export { 6 | text_default as default, 7 | text 8 | }; 9 | -------------------------------------------------------------------------------- /fixtures/with-json/__snapshots__: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`snapshots fixtures/with-json: build 1`] = ` 4 | Array [ 5 | "index.html", 6 | "index.js", 7 | ] 8 | `; 9 | 10 | exports[`snapshots fixtures/with-json: content-type headers 1`] = ` 11 | Object { 12 | "http://127.0.0.1:9000/_hmr_client.js?namespace=hmr-client": "application/javascript; charset=utf-8", 13 | "http://127.0.0.1:9000/index.html": "text/html; charset=utf-8", 14 | "http://127.0.0.1:9000/main.js?namespace=file": "application/javascript; charset=utf-8", 15 | "http://127.0.0.1:9000/text.json?namespace=file&t=0": "application/javascript; charset=utf-8", 16 | } 17 | `; 18 | 19 | exports[`snapshots fixtures/with-json: mirror 1`] = ` 20 | Array [ 21 | "_hmr_client.js", 22 | "index.html", 23 | "main.js", 24 | "text.json", 25 | ] 26 | `; 27 | 28 | exports[`snapshots fixtures/with-json: traverse result 1`] = ` 29 | Array [ 30 | Object { 31 | "importPath": "/_hmr_client.js?namespace=hmr-client", 32 | "importer": "http://127.0.0.1:9000/index.html", 33 | "resolvedImportPath": "http://127.0.0.1:9000/_hmr_client.js?namespace=hmr-client", 34 | }, 35 | Object { 36 | "importPath": "/main.js?namespace=file", 37 | "importer": "http://127.0.0.1:9000/index.html", 38 | "resolvedImportPath": "http://127.0.0.1:9000/main.js?namespace=file", 39 | }, 40 | Object { 41 | "importPath": "/text.json?namespace=file&t=0", 42 | "importer": "http://127.0.0.1:9000/main.js?namespace=file", 43 | "resolvedImportPath": "http://127.0.0.1:9000/text.json?namespace=file&t=0", 44 | }, 45 | ] 46 | `; 47 | -------------------------------------------------------------------------------- /fixtures/with-json/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /fixtures/with-json/main.js: -------------------------------------------------------------------------------- 1 | import json from './text.json' 2 | 3 | const node = document.createElement('pre') 4 | document.body.appendChild(node.appendChild(document.createTextNode(json.text))) 5 | -------------------------------------------------------------------------------- /fixtures/with-json/text.json: -------------------------------------------------------------------------------- 1 | { 2 | "text": "Hello World!" 3 | } 4 | -------------------------------------------------------------------------------- /fixtures/with-linked-workspace/.bundless/bundleMap.json: -------------------------------------------------------------------------------- 1 | { 2 | "../../node_modules/slash/index.js": ".bundless/node_modules/slash/index.js.js", 3 | "../../node_modules/react/index.js": ".bundless/node_modules/react/index.js.js", 4 | "../with-many-dependencies/node_modules/preact/hooks/dist/hooks.module.js": ".bundless/node_modules/preact/hooks/dist/hooks.module.js.js", 5 | "../../node_modules/react-dom/index.js": ".bundless/node_modules/react-dom/index.js.js" 6 | } 7 | -------------------------------------------------------------------------------- /fixtures/with-linked-workspace/.bundless/commonjs.json: -------------------------------------------------------------------------------- 1 | { 2 | "isCommonjs": { 3 | ".bundless/node_modules/slash/index.js.js": true, 4 | ".bundless/node_modules/react/index.js.js": true, 5 | ".bundless/node_modules/react-dom/index.js.js": true 6 | } 7 | } -------------------------------------------------------------------------------- /fixtures/with-linked-workspace/__mirror__/__..__/with-many-dependencies/main.js: -------------------------------------------------------------------------------- 1 | import slash_cjsImport0 from "/.bundless/node_modules/slash/index.js.js?namespace=file&t=0"; const slash = slash_cjsImport0 && slash_cjsImport0.__esModule ? slash_cjsImport0.default : slash_cjsImport0; 2 | import react_cjsImport1 from "/.bundless/node_modules/react/index.js.js?namespace=file&t=0"; const React = react_cjsImport1 && react_cjsImport1.__esModule ? react_cjsImport1.default : react_cjsImport1; 3 | import { useState } from '/.bundless/node_modules/preact/hooks/dist/hooks.module.js.js?namespace=file&t=0' 4 | import reactDom_cjsImport3 from "/.bundless/node_modules/react-dom/index.js.js?namespace=file&t=0"; const ReactDom = reactDom_cjsImport3 && reactDom_cjsImport3.__esModule ? reactDom_cjsImport3.default : reactDom_cjsImport3; 5 | 6 | console.log('Hello world!') 7 | console.log(slash) 8 | console.log(React.useState) 9 | console.log(useState) 10 | console.log(ReactDom.render) 11 | 12 | export const variable = 10 13 | 14 | -------------------------------------------------------------------------------- /fixtures/with-linked-workspace/__mirror__/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /fixtures/with-linked-workspace/__mirror__/main.js: -------------------------------------------------------------------------------- 1 | import { variable } from '/__..__/with-many-dependencies/main.js?namespace=file&t=0' 2 | 3 | const node = document.createElement('pre') 4 | document.body.appendChild(node.appendChild(document.createTextNode(variable))) 5 | -------------------------------------------------------------------------------- /fixtures/with-linked-workspace/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /fixtures/with-linked-workspace/main.js: -------------------------------------------------------------------------------- 1 | import { variable } from 'fixtures-with-many-dependencies' 2 | 3 | const node = document.createElement('pre') 4 | document.body.appendChild(node.appendChild(document.createTextNode(variable))) 5 | -------------------------------------------------------------------------------- /fixtures/with-linked-workspace/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fixtures-with-linked-workspace", 3 | "version": "0.0.0", 4 | "private": true, 5 | "dependencies": { 6 | "fixtures-with-many-dependencies": "*" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /fixtures/with-links/__mirror__/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |

My First Heading

12 | 13 |

My first paragraph.

14 | 15 | 16 | -------------------------------------------------------------------------------- /fixtures/with-links/__snapshots__: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`snapshots fixtures/with-links: build 1`] = ` 4 | Array [ 5 | "index.html", 6 | "index.js", 7 | "manifest.json", 8 | "styles1.css", 9 | ] 10 | `; 11 | 12 | exports[`snapshots fixtures/with-links: content-type headers 1`] = ` 13 | Object { 14 | "http://127.0.0.1:9000/_hmr_client.js?namespace=hmr-client": "application/javascript; charset=utf-8", 15 | "http://127.0.0.1:9000/index.html": "text/html; charset=utf-8", 16 | } 17 | `; 18 | 19 | exports[`snapshots fixtures/with-links: mirror 1`] = ` 20 | Array [ 21 | "_hmr_client.js", 22 | "index.html", 23 | ] 24 | `; 25 | 26 | exports[`snapshots fixtures/with-links: traverse result 1`] = ` 27 | Array [ 28 | Object { 29 | "importPath": "/_hmr_client.js?namespace=hmr-client", 30 | "importer": "http://127.0.0.1:9000/index.html", 31 | "resolvedImportPath": "http://127.0.0.1:9000/_hmr_client.js?namespace=hmr-client", 32 | }, 33 | ] 34 | `; 35 | -------------------------------------------------------------------------------- /fixtures/with-links/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |

My First Heading

10 | 11 |

My first paragraph.

12 | 13 | 14 | -------------------------------------------------------------------------------- /fixtures/with-links/public/manifest.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /fixtures/with-links/public/styles1.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/remorses/bundless/c7c167a78b03f8b643bcd1ed091f6b155fa84043/fixtures/with-links/public/styles1.css -------------------------------------------------------------------------------- /fixtures/with-links/styles2.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/remorses/bundless/c7c167a78b03f8b643bcd1ed091f6b155fa84043/fixtures/with-links/styles2.css -------------------------------------------------------------------------------- /fixtures/with-many-dependencies/.bundless/bundleMap.json: -------------------------------------------------------------------------------- 1 | { 2 | "../../node_modules/slash/index.js": ".bundless/node_modules/slash/index.js.js", 3 | "../../node_modules/react/index.js": ".bundless/node_modules/react/index.js.js", 4 | "node_modules/preact/hooks/dist/hooks.module.js": ".bundless/node_modules/preact/hooks/dist/hooks.module.js.js", 5 | "../../node_modules/react-dom/index.js": ".bundless/node_modules/react-dom/index.js.js" 6 | } 7 | -------------------------------------------------------------------------------- /fixtures/with-many-dependencies/.bundless/commonjs.json: -------------------------------------------------------------------------------- 1 | { 2 | "isCommonjs": { 3 | ".bundless/node_modules/slash/index.js.js": true, 4 | ".bundless/node_modules/react/index.js.js": true, 5 | ".bundless/node_modules/react-dom/index.js.js": true 6 | } 7 | } -------------------------------------------------------------------------------- /fixtures/with-many-dependencies/__mirror__/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /fixtures/with-many-dependencies/__mirror__/main.js: -------------------------------------------------------------------------------- 1 | import slash_cjsImport0 from "/.bundless/node_modules/slash/index.js.js?namespace=file&t=0"; const slash = slash_cjsImport0 && slash_cjsImport0.__esModule ? slash_cjsImport0.default : slash_cjsImport0; 2 | import react_cjsImport1 from "/.bundless/node_modules/react/index.js.js?namespace=file&t=0"; const React = react_cjsImport1 && react_cjsImport1.__esModule ? react_cjsImport1.default : react_cjsImport1; 3 | import { useState } from '/.bundless/node_modules/preact/hooks/dist/hooks.module.js.js?namespace=file&t=0' 4 | import reactDom_cjsImport3 from "/.bundless/node_modules/react-dom/index.js.js?namespace=file&t=0"; const ReactDom = reactDom_cjsImport3 && reactDom_cjsImport3.__esModule ? reactDom_cjsImport3.default : reactDom_cjsImport3; 5 | 6 | console.log('Hello world!') 7 | console.log(slash) 8 | console.log(React.useState) 9 | console.log(useState) 10 | console.log(ReactDom.render) 11 | 12 | export const variable = 10 13 | 14 | -------------------------------------------------------------------------------- /fixtures/with-many-dependencies/bundless.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | build: { 3 | minify: false, 4 | }, 5 | } 6 | -------------------------------------------------------------------------------- /fixtures/with-many-dependencies/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /fixtures/with-many-dependencies/main.js: -------------------------------------------------------------------------------- 1 | import slash from 'slash' 2 | import React from 'react' 3 | import { useState } from 'preact/hooks' 4 | import ReactDom from 'react-dom' 5 | 6 | console.log('Hello world!') 7 | console.log(slash) 8 | console.log(React.useState) 9 | console.log(useState) 10 | console.log(ReactDom.render) 11 | 12 | export const variable = 10 13 | 14 | -------------------------------------------------------------------------------- /fixtures/with-many-dependencies/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fixtures-with-many-dependencies", 3 | "version": "0.0.0", 4 | "main": "main.js", 5 | "private": true, 6 | "dependencies": { 7 | "react": "experimental", 8 | "slash": "^3.0.0", 9 | "preact": "*", 10 | "react-dom": "experimental" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /fixtures/with-many-entries/__mirror__/a/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /fixtures/with-many-entries/__mirror__/a/main.css.cssjs: -------------------------------------------------------------------------------- 1 | import * as __HMR__ from '/_hmr_client.js?namespace=hmr-client'; import.meta.hot = __HMR__.createHotContext(import.meta.url); 2 | 3 | const css = "body {\n background: lightcoral;\n}\n"; 4 | 5 | if (typeof document !== 'undefined') { 6 | import.meta.hot.accept(); 7 | import.meta.hot.dispose(() => { 8 | document.head.removeChild(styleEl); 9 | }); 10 | const styleEl = document.createElement("style"); 11 | const codeEl = document.createTextNode(css); 12 | styleEl.type = 'text/css'; 13 | styleEl.appendChild(codeEl); 14 | document.head.appendChild(styleEl); 15 | } 16 | export default css -------------------------------------------------------------------------------- /fixtures/with-many-entries/__mirror__/a/main.js: -------------------------------------------------------------------------------- 1 | import '/a/main.css.cssjs?namespace=file&t=0' 2 | import '/common.css.cssjs?namespace=file&t=0' 3 | 4 | const text = 'A' 5 | 6 | const node = document.createElement('pre') 7 | document.body.appendChild(node.appendChild(document.createTextNode(text))) 8 | -------------------------------------------------------------------------------- /fixtures/with-many-entries/__mirror__/b/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /fixtures/with-many-entries/__mirror__/b/main.js: -------------------------------------------------------------------------------- 1 | import '/common.css.cssjs?namespace=file&t=0' 2 | import { text } from '/b/text.js?namespace=file&t=0' 3 | 4 | const node = document.createElement('pre') 5 | document.body.appendChild(node.appendChild(document.createTextNode(text))) 6 | -------------------------------------------------------------------------------- /fixtures/with-many-entries/__mirror__/b/text.js: -------------------------------------------------------------------------------- 1 | export const text = 'B' 2 | -------------------------------------------------------------------------------- /fixtures/with-many-entries/__mirror__/common.css.cssjs: -------------------------------------------------------------------------------- 1 | import * as __HMR__ from '/_hmr_client.js?namespace=hmr-client'; import.meta.hot = __HMR__.createHotContext(import.meta.url); 2 | 3 | const css = "a {\n background: blue;\n}\n"; 4 | 5 | if (typeof document !== 'undefined') { 6 | import.meta.hot.accept(); 7 | import.meta.hot.dispose(() => { 8 | document.head.removeChild(styleEl); 9 | }); 10 | const styleEl = document.createElement("style"); 11 | const codeEl = document.createTextNode(css); 12 | styleEl.type = 'text/css'; 13 | styleEl.appendChild(codeEl); 14 | document.head.appendChild(styleEl); 15 | } 16 | export default css -------------------------------------------------------------------------------- /fixtures/with-many-entries/a/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /fixtures/with-many-entries/a/main.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: lightcoral; 3 | } 4 | -------------------------------------------------------------------------------- /fixtures/with-many-entries/a/main.js: -------------------------------------------------------------------------------- 1 | import './main.css' 2 | import '../common.css' 3 | 4 | const text = 'A' 5 | 6 | const node = document.createElement('pre') 7 | document.body.appendChild(node.appendChild(document.createTextNode(text))) 8 | -------------------------------------------------------------------------------- /fixtures/with-many-entries/b/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /fixtures/with-many-entries/b/main.js: -------------------------------------------------------------------------------- 1 | import '../common.css' 2 | import { text } from './text' 3 | 4 | const node = document.createElement('pre') 5 | document.body.appendChild(node.appendChild(document.createTextNode(text))) 6 | -------------------------------------------------------------------------------- /fixtures/with-many-entries/b/text.js: -------------------------------------------------------------------------------- 1 | export const text = 'B' 2 | -------------------------------------------------------------------------------- /fixtures/with-many-entries/bundless.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @type { import('@bundless/cli').Config } 3 | */ 4 | const config = { 5 | entries: ['a/index.html', 'b/index.html'], 6 | } 7 | 8 | module.exports = config 9 | -------------------------------------------------------------------------------- /fixtures/with-many-entries/common.css: -------------------------------------------------------------------------------- 1 | a { 2 | background: blue; 3 | } 4 | -------------------------------------------------------------------------------- /fixtures/with-node-polyfills/__mirror__/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /fixtures/with-node-polyfills/__mirror__/main.js: -------------------------------------------------------------------------------- 1 | import path from '/path?namespace=node-builtins' 2 | 3 | console.log({ path }) 4 | 5 | const text = path.resolve('something') 6 | 7 | const node = document.createElement('pre') 8 | document.body.appendChild(node.appendChild(document.createTextNode(text))) 9 | -------------------------------------------------------------------------------- /fixtures/with-node-polyfills/__snapshots__: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`snapshots fixtures/with-node-polyfills: build 1`] = ` 4 | Array [ 5 | "index.html", 6 | "index.js", 7 | ] 8 | `; 9 | 10 | exports[`snapshots fixtures/with-node-polyfills: content-type headers 1`] = ` 11 | Object { 12 | "http://127.0.0.1:9000/_hmr_client.js?namespace=hmr-client": "application/javascript; charset=utf-8", 13 | "http://127.0.0.1:9000/index.html": "text/html; charset=utf-8", 14 | "http://127.0.0.1:9000/main.js?namespace=file": "application/javascript; charset=utf-8", 15 | "http://127.0.0.1:9000/path?namespace=node-builtins": "application/javascript; charset=utf-8", 16 | } 17 | `; 18 | 19 | exports[`snapshots fixtures/with-node-polyfills: mirror 1`] = ` 20 | Array [ 21 | "_hmr_client.js", 22 | "index.html", 23 | "main.js", 24 | "path", 25 | ] 26 | `; 27 | 28 | exports[`snapshots fixtures/with-node-polyfills: traverse result 1`] = ` 29 | Array [ 30 | Object { 31 | "importPath": "/_hmr_client.js?namespace=hmr-client", 32 | "importer": "http://127.0.0.1:9000/index.html", 33 | "resolvedImportPath": "http://127.0.0.1:9000/_hmr_client.js?namespace=hmr-client", 34 | }, 35 | Object { 36 | "importPath": "/main.js?namespace=file", 37 | "importer": "http://127.0.0.1:9000/index.html", 38 | "resolvedImportPath": "http://127.0.0.1:9000/main.js?namespace=file", 39 | }, 40 | Object { 41 | "importPath": "/path?namespace=node-builtins", 42 | "importer": "http://127.0.0.1:9000/main.js?namespace=file", 43 | "resolvedImportPath": "http://127.0.0.1:9000/path?namespace=node-builtins", 44 | }, 45 | ] 46 | `; 47 | -------------------------------------------------------------------------------- /fixtures/with-node-polyfills/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /fixtures/with-node-polyfills/main.js: -------------------------------------------------------------------------------- 1 | import path from 'path' 2 | 3 | console.log({ path }) 4 | 5 | const text = path.resolve('something') 6 | 7 | const node = document.createElement('pre') 8 | document.body.appendChild(node.appendChild(document.createTextNode(text))) 9 | -------------------------------------------------------------------------------- /fixtures/with-sourcemaps/.bundless/bundleMap.json: -------------------------------------------------------------------------------- 1 | { 2 | "../../node_modules/react/index.js": ".bundless/node_modules/react/index.js.js", 3 | "../../node_modules/source-map-support/source-map-support.js": ".bundless/node_modules/source-map-support/source-map-support.js.js" 4 | } 5 | -------------------------------------------------------------------------------- /fixtures/with-sourcemaps/.bundless/commonjs.json: -------------------------------------------------------------------------------- 1 | { 2 | "isCommonjs": { 3 | ".bundless/node_modules/react/index.js.js": true, 4 | ".bundless/node_modules/source-map-support/source-map-support.js.js": true 5 | } 6 | } -------------------------------------------------------------------------------- /fixtures/with-sourcemaps/__mirror__/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /fixtures/with-sourcemaps/__mirror__/js.js: -------------------------------------------------------------------------------- 1 | import * as __HMR__ from '/_hmr_client.js?namespace=hmr-client'; import.meta.hot = __HMR__.createHotContext(import.meta.url); import react_cjsImport0 from "/.bundless/node_modules/react/index.js.js?namespace=file&t=0"; const React = react_cjsImport0 && react_cjsImport0.__esModule ? react_cjsImport0.default : react_cjsImport0; const createElement = react_cjsImport0["createElement"]; 2 | import react_cjsImport1 from "/.bundless/node_modules/react/index.js.js?namespace=file&t=0"; const useState = react_cjsImport1["useState"]; 3 | import { text } from '/text.js?namespace=file&t=0' 4 | 5 | console.log('Hello world!!!!!') 6 | 7 | const node = document.createElement('pre') 8 | document.body.appendChild(node.appendChild(document.createTextNode(text))) 9 | 10 | React.createElement('div') 11 | 12 | function Comp() { 13 | const [] = useState() 14 | return createElement('div', {}) 15 | } 16 | 17 | Comp 18 | 19 | 20 | // throw new Error('I should be on line 20') 21 | 22 | if (import.meta.hot) { 23 | import.meta.hot.accept() 24 | } 25 | -------------------------------------------------------------------------------- /fixtures/with-sourcemaps/__mirror__/text.js: -------------------------------------------------------------------------------- 1 | export const text = 'CIAO!' -------------------------------------------------------------------------------- /fixtures/with-sourcemaps/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /fixtures/with-sourcemaps/js.js: -------------------------------------------------------------------------------- 1 | import React, { createElement } from 'react' 2 | import { useState } from 'react' 3 | import { text } from './text' 4 | 5 | console.log('Hello world!!!!!') 6 | 7 | const node = document.createElement('pre') 8 | document.body.appendChild(node.appendChild(document.createTextNode(text))) 9 | 10 | React.createElement('div') 11 | 12 | function Comp() { 13 | const [] = useState() 14 | return createElement('div', {}) 15 | } 16 | 17 | Comp 18 | 19 | 20 | // throw new Error('I should be on line 20') 21 | 22 | if (import.meta.hot) { 23 | import.meta.hot.accept() 24 | } 25 | -------------------------------------------------------------------------------- /fixtures/with-sourcemaps/main.ts: -------------------------------------------------------------------------------- 1 | import React, { createElement } from 'react' 2 | import { useState } from 'react' 3 | import './js.js' 4 | import { text } from './text' 5 | import so from 'source-map-support' 6 | so.getErrorSource 7 | 8 | console.log('Hello world!!!!!') 9 | 10 | const node = document.createElement('pre') 11 | document.body.appendChild(node.appendChild(document.createTextNode(text))) 12 | 13 | React.createElement('div') 14 | 15 | function Comp() { 16 | const [] = useState() 17 | return createElement('div', {}) 18 | } 19 | 20 | Comp 21 | 22 | console.log(new Error('I should be on line 22')) 23 | 24 | throw new Error('I should be on line 24') 25 | 26 | 27 | if (import.meta.hot) { 28 | import.meta.hot.accept() 29 | } 30 | -------------------------------------------------------------------------------- /fixtures/with-sourcemaps/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fixture-with-sourcemaps", 3 | "version": "0.0.0", 4 | "main": "main.js", 5 | "private": true, 6 | "dependencies": { 7 | "react": "experimental" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /fixtures/with-sourcemaps/text.js: -------------------------------------------------------------------------------- 1 | export const text = 'CIAO!' -------------------------------------------------------------------------------- /fixtures/with-svelte/.bundless/bundleMap.json: -------------------------------------------------------------------------------- 1 | { 2 | "../../node_modules/svelte/internal/index.mjs": ".bundless/node_modules/svelte/internal/index.mjs.js", 3 | "../../node_modules/svelte-hmr/runtime/hot-api-esm.js": ".bundless/node_modules/svelte-hmr/runtime/hot-api-esm.js.js", 4 | "../../node_modules/svelte-hmr/runtime/proxy-adapter-dom.js": ".bundless/node_modules/svelte-hmr/runtime/proxy-adapter-dom.js.js" 5 | } 6 | -------------------------------------------------------------------------------- /fixtures/with-svelte/.bundless/commonjs.json: -------------------------------------------------------------------------------- 1 | { 2 | "isCommonjs": { 3 | ".bundless/node_modules/svelte-hmr/runtime/proxy-adapter-dom.js.js": true 4 | } 5 | } -------------------------------------------------------------------------------- /fixtures/with-svelte/App.svelte: -------------------------------------------------------------------------------- 1 | 6 | 7 |
counts: {count}
8 | 9 | 10 | 11 | 16 | -------------------------------------------------------------------------------- /fixtures/with-svelte/__mirror__/App.svelte.css: -------------------------------------------------------------------------------- 1 | import * as __HMR__ from '/_hmr_client.js?namespace=hmr-client'; import.meta.hot = __HMR__.createHotContext(import.meta.url); 2 | 3 | const css = "div.svelte-1x83jhu{background-color:red}"; 4 | 5 | if (typeof document !== 'undefined') { 6 | import.meta.hot.accept(); 7 | import.meta.hot.dispose(() => { 8 | document.head.removeChild(styleEl); 9 | }); 10 | const styleEl = document.createElement("style"); 11 | const codeEl = document.createTextNode(css); 12 | styleEl.type = 'text/css'; 13 | styleEl.appendChild(codeEl); 14 | document.head.appendChild(styleEl); 15 | } 16 | export default css -------------------------------------------------------------------------------- /fixtures/with-svelte/__mirror__/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /fixtures/with-svelte/__mirror__/main.js: -------------------------------------------------------------------------------- 1 | import App from '/App.svelte?namespace=file&t=0'; 2 | 3 | new App({ target: document.body }); -------------------------------------------------------------------------------- /fixtures/with-svelte/bundless.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: [require('@bundless/plugin-svelte').default({})], 3 | } 4 | -------------------------------------------------------------------------------- /fixtures/with-svelte/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /fixtures/with-svelte/main.js: -------------------------------------------------------------------------------- 1 | import App from './App.svelte'; 2 | 3 | new App({ target: document.body }); -------------------------------------------------------------------------------- /fixtures/with-svelte/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fixtures-with-svelte", 3 | "version": "0.0.0", 4 | "main": "main.js", 5 | "private": true, 6 | "dependencies": { 7 | "svelte": "^3.32.1" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /fixtures/with-tsconfig-paths/__mirror__/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /fixtures/with-tsconfig-paths/__mirror__/main.tsx: -------------------------------------------------------------------------------- 1 | import {text} from "/text.ts?namespace=file&t=0"; 2 | import react_cjsImport1 from "/.bundless/node_modules/react/index.js.js?namespace=file&t=0"; const React = react_cjsImport1 && react_cjsImport1.__esModule ? react_cjsImport1.default : react_cjsImport1;; 3 | const node = document.createElement("pre"); 4 | node.appendChild(document.createTextNode(text)); 5 | document.body.appendChild(node); 6 | console.log(React.cloneElement); 7 | 8 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9Vc2Vycy9tb3JzZS9Eb2N1bWVudHMvR2l0SHViL2VzcGFjay9maXh0dXJlcy93aXRoLXRzY29uZmlnLXBhdGhzL21haW4udHN4Il0sInNvdXJjZXNDb250ZW50IjpbIi8vIEBqc3gganN4XG5pbXBvcnQgeyB0ZXh0IH0gZnJvbSAnQHZpcnR1YWwnXG5pbXBvcnQgUmVhY3QgZnJvbSAncmVhY3QnXG5cbmNvbnN0IG5vZGUgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCdwcmUnKVxubm9kZS5hcHBlbmRDaGlsZChkb2N1bWVudC5jcmVhdGVUZXh0Tm9kZSh0ZXh0KSlcbmRvY3VtZW50LmJvZHkuYXBwZW5kQ2hpbGQobm9kZSlcblxuY29uc29sZS5sb2coUmVhY3QuY2xvbmVFbGVtZW50KVxuIl0sIm1hcHBpbmdzIjoiQUFDQTtBQUNBO0FBRUEsTUFBTSxPQUFPLFNBQVMsY0FBYztBQUNwQyxLQUFLLFlBQVksU0FBUyxlQUFlO0FBQ3pDLFNBQVMsS0FBSyxZQUFZO0FBRTFCLFFBQVEsSUFBSSxNQUFNOyIsIm5hbWVzIjpbXX0= -------------------------------------------------------------------------------- /fixtures/with-tsconfig-paths/__mirror__/text.ts: -------------------------------------------------------------------------------- 1 | export const text = "virtual"; 2 | 3 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9Vc2Vycy9tb3JzZS9Eb2N1bWVudHMvR2l0SHViL2VzcGFjay9maXh0dXJlcy93aXRoLXRzY29uZmlnLXBhdGhzL3RleHQudHMiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGNvbnN0IHRleHQgPSAndmlydHVhbCdcbiJdLCJtYXBwaW5ncyI6IkFBQU8sYUFBTSxPQUFPOyIsIm5hbWVzIjpbXX0= -------------------------------------------------------------------------------- /fixtures/with-tsconfig-paths/bundless.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | const { TsconfigPathsPlugin } = require('@bundless/plugin-tsconfig-paths') 3 | 4 | module.exports = { 5 | build: { 6 | minify: false, 7 | }, 8 | plugins: [ 9 | TsconfigPathsPlugin({ 10 | paths: { 11 | '@virtual': ['text.ts'], 12 | }, 13 | }), 14 | ], 15 | } 16 | -------------------------------------------------------------------------------- /fixtures/with-tsconfig-paths/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /fixtures/with-tsconfig-paths/main.tsx: -------------------------------------------------------------------------------- 1 | // @jsx jsx 2 | import { text } from '@virtual' 3 | import React from 'react' 4 | 5 | const node = document.createElement('pre') 6 | node.appendChild(document.createTextNode(text)) 7 | document.body.appendChild(node) 8 | 9 | console.log(React.cloneElement) 10 | -------------------------------------------------------------------------------- /fixtures/with-tsconfig-paths/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fixtures-with-tsconfig-paths", 3 | "version": "0.0.0", 4 | "private": true, 5 | "dependencies": {} 6 | } 7 | -------------------------------------------------------------------------------- /fixtures/with-tsconfig-paths/text.ts: -------------------------------------------------------------------------------- 1 | export const text = 'virtual' 2 | -------------------------------------------------------------------------------- /fixtures/with-tsx/__mirror__/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /fixtures/with-tsx/__mirror__/main.tsx: -------------------------------------------------------------------------------- 1 | import {text} from "/text.ts?namespace=file&t=0"; 2 | function jsx(t, p, children) { 3 | var node = document.createElement(t); 4 | var textNode = document.createTextNode(children || p.children); 5 | node.appendChild(textNode); 6 | document.body.appendChild(node); 7 | } 8 | let x = /* @__PURE__ */ jsx("div", null, text); 9 | 10 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9Vc2Vycy9tb3JzZS9Eb2N1bWVudHMvR2l0SHViL2VzcGFjay9maXh0dXJlcy93aXRoLXRzeC9tYWluLnRzeCJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyBAanN4IGpzeFxuaW1wb3J0IHsgdGV4dCB9IGZyb20gJy4vdGV4dCdcblxuZnVuY3Rpb24ganN4KHQsIHAsIGNoaWxkcmVuKSB7XG4gICAgdmFyIG5vZGUgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KHQpXG4gICAgdmFyIHRleHROb2RlID0gZG9jdW1lbnQuY3JlYXRlVGV4dE5vZGUoY2hpbGRyZW4gfHwgcC5jaGlsZHJlbilcbiAgICBub2RlLmFwcGVuZENoaWxkKHRleHROb2RlKVxuICAgIGRvY3VtZW50LmJvZHkuYXBwZW5kQ2hpbGQobm9kZSlcbn1cblxuXG5sZXQgeCA9IDxkaXY+e3RleHR9PC9kaXY+XG4iXSwibWFwcGluZ3MiOiJBQUNBO0FBRUEsYUFBYSxHQUFHLEdBQUcsVUFBVTtBQUN6QixNQUFJLE9BQU8sU0FBUyxjQUFjO0FBQ2xDLE1BQUksV0FBVyxTQUFTLGVBQWUsWUFBWSxFQUFFO0FBQ3JELE9BQUssWUFBWTtBQUNqQixXQUFTLEtBQUssWUFBWTtBQUFBO0FBSTlCLElBQUksSUFBSSxvQkFBQyxPQUFELE1BQU07IiwibmFtZXMiOltdfQ== -------------------------------------------------------------------------------- /fixtures/with-tsx/__mirror__/text.ts: -------------------------------------------------------------------------------- 1 | import {allCaps} from "/utils.ts?namespace=file&t=0"; 2 | export const text = allCaps("works!"); 3 | 4 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9Vc2Vycy9tb3JzZS9Eb2N1bWVudHMvR2l0SHViL2VzcGFjay9maXh0dXJlcy93aXRoLXRzeC90ZXh0LnRzIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGFsbENhcHMgfSBmcm9tICcuL3V0aWxzJ1xuZXhwb3J0IGNvbnN0IHRleHQgPSBhbGxDYXBzKCd3b3JrcyEnKVxuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNPLGFBQU0sT0FBTyxRQUFROyIsIm5hbWVzIjpbXX0= -------------------------------------------------------------------------------- /fixtures/with-tsx/__mirror__/utils.ts: -------------------------------------------------------------------------------- 1 | export function allCaps(x) { 2 | return x.toUpperCase(); 3 | } 4 | 5 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9Vc2Vycy9tb3JzZS9Eb2N1bWVudHMvR2l0SHViL2VzcGFjay9maXh0dXJlcy93aXRoLXRzeC91dGlscy50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZnVuY3Rpb24gYWxsQ2Fwcyh4OiBzdHJpbmcpIHtcbiAgICByZXR1cm4geC50b1VwcGVyQ2FzZSgpXG59XG4iXSwibWFwcGluZ3MiOiJBQUFPLHdCQUFpQixHQUFXO0FBQy9CLFNBQU8sRUFBRTtBQUFBOyIsIm5hbWVzIjpbXX0= -------------------------------------------------------------------------------- /fixtures/with-tsx/__snapshots__: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`snapshots fixtures/with-tsx: build 1`] = ` 4 | Array [ 5 | "index.html", 6 | "index.js", 7 | ] 8 | `; 9 | 10 | exports[`snapshots fixtures/with-tsx: content-type headers 1`] = ` 11 | Object { 12 | "http://127.0.0.1:9000/_hmr_client.js?namespace=hmr-client": "application/javascript; charset=utf-8", 13 | "http://127.0.0.1:9000/index.html": "text/html; charset=utf-8", 14 | "http://127.0.0.1:9000/main.tsx?namespace=file": "application/javascript; charset=utf-8", 15 | "http://127.0.0.1:9000/text.ts?namespace=file&t=0": "application/javascript; charset=utf-8", 16 | "http://127.0.0.1:9000/utils.ts?namespace=file&t=0": "application/javascript; charset=utf-8", 17 | } 18 | `; 19 | 20 | exports[`snapshots fixtures/with-tsx: mirror 1`] = ` 21 | Array [ 22 | "_hmr_client.js", 23 | "index.html", 24 | "main.tsx", 25 | "text.ts", 26 | "utils.ts", 27 | ] 28 | `; 29 | 30 | exports[`snapshots fixtures/with-tsx: traverse result 1`] = ` 31 | Array [ 32 | Object { 33 | "importPath": "/_hmr_client.js?namespace=hmr-client", 34 | "importer": "http://127.0.0.1:9000/index.html", 35 | "resolvedImportPath": "http://127.0.0.1:9000/_hmr_client.js?namespace=hmr-client", 36 | }, 37 | Object { 38 | "importPath": "/main.tsx?namespace=file", 39 | "importer": "http://127.0.0.1:9000/index.html", 40 | "resolvedImportPath": "http://127.0.0.1:9000/main.tsx?namespace=file", 41 | }, 42 | Object { 43 | "importPath": "/text.ts?namespace=file&t=0", 44 | "importer": "http://127.0.0.1:9000/main.tsx?namespace=file", 45 | "resolvedImportPath": "http://127.0.0.1:9000/text.ts?namespace=file&t=0", 46 | }, 47 | Object { 48 | "importPath": "/utils.ts?namespace=file&t=0", 49 | "importer": "http://127.0.0.1:9000/text.ts?namespace=file&t=0", 50 | "resolvedImportPath": "http://127.0.0.1:9000/utils.ts?namespace=file&t=0", 51 | }, 52 | ] 53 | `; 54 | -------------------------------------------------------------------------------- /fixtures/with-tsx/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /fixtures/with-tsx/main.tsx: -------------------------------------------------------------------------------- 1 | // @jsx jsx 2 | import { text } from './text' 3 | 4 | function jsx(t, p, children) { 5 | var node = document.createElement(t) 6 | var textNode = document.createTextNode(children || p.children) 7 | node.appendChild(textNode) 8 | document.body.appendChild(node) 9 | } 10 | 11 | 12 | let x =
{text}
13 | -------------------------------------------------------------------------------- /fixtures/with-tsx/text.ts: -------------------------------------------------------------------------------- 1 | import { allCaps } from './utils' 2 | export const text = allCaps('works!') 3 | -------------------------------------------------------------------------------- /fixtures/with-tsx/utils.ts: -------------------------------------------------------------------------------- 1 | export function allCaps(x: string) { 2 | return x.toUpperCase() 3 | } 4 | -------------------------------------------------------------------------------- /fixtures/with-typescript/__mirror__/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /fixtures/with-typescript/__mirror__/main.ts: -------------------------------------------------------------------------------- 1 | import {text} from "/text.ts?namespace=file&t=0"; 2 | console.log("Hello world!"); 3 | var node = document.createElement("h1"); 4 | var textNode = document.createTextNode(text); 5 | node.appendChild(textNode); 6 | document.body.appendChild(node); 7 | 8 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9Vc2Vycy9tb3JzZS9Eb2N1bWVudHMvR2l0SHViL2VzcGFjay9maXh0dXJlcy93aXRoLXR5cGVzY3JpcHQvbWFpbi50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyB0ZXh0IH0gZnJvbSAnLi90ZXh0J1xuXG5jb25zb2xlLmxvZygnSGVsbG8gd29ybGQhJylcblxudmFyIG5vZGU6IGFueSA9IGRvY3VtZW50LmNyZWF0ZUVsZW1lbnQoJ2gxJylcbnZhciB0ZXh0Tm9kZSA9IGRvY3VtZW50LmNyZWF0ZVRleHROb2RlKHRleHQpXG5ub2RlLmFwcGVuZENoaWxkKHRleHROb2RlKVxuZG9jdW1lbnQuYm9keS5hcHBlbmRDaGlsZChub2RlKVxuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUVBLFFBQVEsSUFBSTtBQUVaLElBQUksT0FBWSxTQUFTLGNBQWM7QUFDdkMsSUFBSSxXQUFXLFNBQVMsZUFBZTtBQUN2QyxLQUFLLFlBQVk7QUFDakIsU0FBUyxLQUFLLFlBQVk7IiwibmFtZXMiOltdfQ== -------------------------------------------------------------------------------- /fixtures/with-typescript/__mirror__/text.ts: -------------------------------------------------------------------------------- 1 | import {allCaps} from "/utils.ts?namespace=file&t=0"; 2 | export const text = allCaps("works!"); 3 | 4 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9Vc2Vycy9tb3JzZS9Eb2N1bWVudHMvR2l0SHViL2VzcGFjay9maXh0dXJlcy93aXRoLXR5cGVzY3JpcHQvdGV4dC50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBhbGxDYXBzIH0gZnJvbSAnLi91dGlscydcbmV4cG9ydCBjb25zdCB0ZXh0ID0gYWxsQ2Fwcygnd29ya3MhJylcbiJdLCJtYXBwaW5ncyI6IkFBQUE7QUFDTyxhQUFNLE9BQU8sUUFBUTsiLCJuYW1lcyI6W119 -------------------------------------------------------------------------------- /fixtures/with-typescript/__mirror__/utils.ts: -------------------------------------------------------------------------------- 1 | export function allCaps(x) { 2 | return x.toUpperCase(); 3 | } 4 | 5 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9Vc2Vycy9tb3JzZS9Eb2N1bWVudHMvR2l0SHViL2VzcGFjay9maXh0dXJlcy93aXRoLXR5cGVzY3JpcHQvdXRpbHMudHMiXSwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGZ1bmN0aW9uIGFsbENhcHMoeDogc3RyaW5nKSB7XG4gICAgcmV0dXJuIHgudG9VcHBlckNhc2UoKVxufVxuIl0sIm1hcHBpbmdzIjoiQUFBTyx3QkFBaUIsR0FBVztBQUMvQixTQUFPLEVBQUU7QUFBQTsiLCJuYW1lcyI6W119 -------------------------------------------------------------------------------- /fixtures/with-typescript/__snapshots__: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`snapshots fixtures/with-typescript: build 1`] = ` 4 | Array [ 5 | "index.html", 6 | "index.js", 7 | ] 8 | `; 9 | 10 | exports[`snapshots fixtures/with-typescript: content-type headers 1`] = ` 11 | Object { 12 | "http://127.0.0.1:9000/_hmr_client.js?namespace=hmr-client": "application/javascript; charset=utf-8", 13 | "http://127.0.0.1:9000/index.html": "text/html; charset=utf-8", 14 | "http://127.0.0.1:9000/main.ts?namespace=file": "application/javascript; charset=utf-8", 15 | "http://127.0.0.1:9000/text.ts?namespace=file&t=0": "application/javascript; charset=utf-8", 16 | "http://127.0.0.1:9000/utils.ts?namespace=file&t=0": "application/javascript; charset=utf-8", 17 | } 18 | `; 19 | 20 | exports[`snapshots fixtures/with-typescript: mirror 1`] = ` 21 | Array [ 22 | "_hmr_client.js", 23 | "index.html", 24 | "main.ts", 25 | "text.ts", 26 | "utils.ts", 27 | ] 28 | `; 29 | 30 | exports[`snapshots fixtures/with-typescript: traverse result 1`] = ` 31 | Array [ 32 | Object { 33 | "importPath": "/_hmr_client.js?namespace=hmr-client", 34 | "importer": "http://127.0.0.1:9000/index.html", 35 | "resolvedImportPath": "http://127.0.0.1:9000/_hmr_client.js?namespace=hmr-client", 36 | }, 37 | Object { 38 | "importPath": "/main.ts?namespace=file", 39 | "importer": "http://127.0.0.1:9000/index.html", 40 | "resolvedImportPath": "http://127.0.0.1:9000/main.ts?namespace=file", 41 | }, 42 | Object { 43 | "importPath": "/text.ts?namespace=file&t=0", 44 | "importer": "http://127.0.0.1:9000/main.ts?namespace=file", 45 | "resolvedImportPath": "http://127.0.0.1:9000/text.ts?namespace=file&t=0", 46 | }, 47 | Object { 48 | "importPath": "/utils.ts?namespace=file&t=0", 49 | "importer": "http://127.0.0.1:9000/text.ts?namespace=file&t=0", 50 | "resolvedImportPath": "http://127.0.0.1:9000/utils.ts?namespace=file&t=0", 51 | }, 52 | ] 53 | `; 54 | -------------------------------------------------------------------------------- /fixtures/with-typescript/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /fixtures/with-typescript/main.ts: -------------------------------------------------------------------------------- 1 | import { text } from './text' 2 | 3 | console.log('Hello world!') 4 | 5 | var node: any = document.createElement('h1') 6 | var textNode = document.createTextNode(text) 7 | node.appendChild(textNode) 8 | document.body.appendChild(node) 9 | -------------------------------------------------------------------------------- /fixtures/with-typescript/text.ts: -------------------------------------------------------------------------------- 1 | import { allCaps } from './utils' 2 | export const text = allCaps('works!') 3 | -------------------------------------------------------------------------------- /fixtures/with-typescript/utils.ts: -------------------------------------------------------------------------------- 1 | export function allCaps(x: string) { 2 | return x.toUpperCase() 3 | } 4 | -------------------------------------------------------------------------------- /fixtures/with-yarn-berry-paths/$$virtual/react-dom-virtual-73426b59bc/0/cache/react-dom-npm-16.13.1-b0abd8a83a-fb5c3ad413.zip/react-dom/index.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | export const x = 'Hey!' -------------------------------------------------------------------------------- /fixtures/with-yarn-berry-paths/__mirror__/$$virtual/react-dom-virtual-73426b59bc/0/cache/react-dom-npm-16.13.1-b0abd8a83a-fb5c3ad413.zip/react-dom/index.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | export const x = 'Hey!' -------------------------------------------------------------------------------- /fixtures/with-yarn-berry-paths/__mirror__/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /fixtures/with-yarn-berry-paths/__mirror__/main.js: -------------------------------------------------------------------------------- 1 | import { x } from '/$$virtual/react-dom-virtual-73426b59bc/0/cache/react-dom-npm-16.13.1-b0abd8a83a-fb5c3ad413.zip/react-dom/index.js?namespace=file&t=0' 2 | 3 | 4 | 5 | const node = document.createElement('pre') 6 | const text = node.appendChild(document.createTextNode(x)) 7 | document.body.appendChild(text) 8 | -------------------------------------------------------------------------------- /fixtures/with-yarn-berry-paths/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /fixtures/with-yarn-berry-paths/main.js: -------------------------------------------------------------------------------- 1 | import { x } from './$$virtual/react-dom-virtual-73426b59bc/0/cache/react-dom-npm-16.13.1-b0abd8a83a-fb5c3ad413.zip/react-dom/index.js' 2 | 3 | 4 | 5 | const node = document.createElement('pre') 6 | const text = node.appendChild(document.createTextNode(x)) 7 | document.body.appendChild(text) 8 | -------------------------------------------------------------------------------- /hmr-test-app/bundless.config.js: -------------------------------------------------------------------------------- 1 | /** @type { import('@bundless/cli').Config } */ 2 | module.exports = { 3 | jsx: 'react', 4 | entries: ['public/bundless/index.html'], 5 | server: { 6 | experimentalImmutableCache: false, 7 | }, 8 | plugins: [require('@bundless/plugin-react-refresh').ReactRefreshPlugin()], 9 | } 10 | -------------------------------------------------------------------------------- /hmr-test-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hmr-test-app", 3 | "version": "0.0.0", 4 | "private": true, 5 | "description": "", 6 | "repository": "https://github.com/remorses/.git", 7 | "scripts": { 8 | "test": "yarn jest --config ../jest.config.js `pwd`", 9 | "test:all": "cross-env HRM_TESTS=1 yarn test" 10 | }, 11 | "keywords": [], 12 | "author": "Tommaso De Rossi, morse ", 13 | "license": "ISC", 14 | "devDependencies": { 15 | "@bundless/cli": "0.6.0", 16 | "@bundless/plugin-react-refresh": "2.1.0", 17 | "@snowpack/plugin-react-refresh": "^2.3.9", 18 | "es-module-traversal": "^0.0.50", 19 | "execa": "^5.0.0", 20 | "jest-specific-snapshot": "^4.0.0", 21 | "snowpack": "^2.18.4", 22 | "vite": "^1.0.0-rc.13", 23 | "vite-plugin-react": "^4.0.1", 24 | "ws": "^7.4.1" 25 | }, 26 | "dependencies": { 27 | "react": "experimental", 28 | "react-dom": "experimental" 29 | }, 30 | "peerDependencies": {} 31 | } 32 | -------------------------------------------------------------------------------- /hmr-test-app/public/bundless/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | -------------------------------------------------------------------------------- /hmr-test-app/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Snowpack test app 8 |
9 | Vite test app 10 |
11 | Bundless test app 12 |
13 | 14 | 15 | -------------------------------------------------------------------------------- /hmr-test-app/public/snowpack/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | -------------------------------------------------------------------------------- /hmr-test-app/public/vite/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | -------------------------------------------------------------------------------- /hmr-test-app/snowpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | mount: { 3 | public: '/', 4 | src: '/_dist_', 5 | }, 6 | devOptions: { 7 | open: 'none', 8 | output: 'stream', 9 | }, 10 | plugins: [ 11 | '@snowpack/plugin-react-refresh', // live reloading 12 | ], 13 | } 14 | -------------------------------------------------------------------------------- /hmr-test-app/src/bridge.jsx: -------------------------------------------------------------------------------- 1 | import React, { useLayoutEffect, useState } from 'react' 2 | import { Comp, staticVariable } from './file' 3 | import './file.css' 4 | import json from './file.json' 5 | import css from './file.module.css' 6 | 7 | export function App() { 8 | const [state, setState] = useState(0) 9 | useLayoutEffect(() => { 10 | staticVariable.count += 1 11 | }, []) 12 | return ( 13 | 14 | 15 |
{JSON.stringify({ json, css })}
16 |
{JSON.stringify(staticVariable)}
17 |
18 |
19 |
20 | 26 |
{state}
27 |
28 | ) 29 | } 30 | 31 | console.log(new Error('i am here, line 27')) 32 | 33 | // export const x = 9 34 | -------------------------------------------------------------------------------- /hmr-test-app/src/file.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: white; 3 | } 4 | -------------------------------------------------------------------------------- /hmr-test-app/src/file.json: -------------------------------------------------------------------------------- 1 | { 2 | "x": "file.json" 3 | } 4 | -------------------------------------------------------------------------------- /hmr-test-app/src/file.jsx: -------------------------------------------------------------------------------- 1 | import React, { useImperativeHandle } from 'react' 2 | import x from './file2' 3 | import { y } from './imported-many-times' 4 | 5 | export const staticVariable = { count: 0 } 6 | 7 | export const Comp = () => { 8 | return ( 9 |
10 | {y}xxx{x} 11 |
12 | ) 13 | } 14 | 15 | // setInterval(() => { 16 | // console.log(staticVariable) 17 | // }, 1000) 18 | -------------------------------------------------------------------------------- /hmr-test-app/src/file.module.css: -------------------------------------------------------------------------------- 1 | .cls { 2 | color: antiquewhite; 3 | } 4 | body { 5 | background: lightcoral; 6 | } 7 | -------------------------------------------------------------------------------- /hmr-test-app/src/file2.js: -------------------------------------------------------------------------------- 1 | export default 'file2.js' 2 | -------------------------------------------------------------------------------- /hmr-test-app/src/imported-many-times.js: -------------------------------------------------------------------------------- 1 | export const y = 'imported-many-times.js' 2 | -------------------------------------------------------------------------------- /hmr-test-app/src/main.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { App } from './bridge' 3 | import ReactDOM from 'react-dom' 4 | import { y } from './imported-many-times' 5 | 6 | ReactDOM.render( 7 | <> 8 | 9 | 16 |
17 |
18 | {y} 19 | , 20 | document.getElementById('root'), 21 | ) 22 | 23 | const noop = (x) => x 24 | 25 | if (import.meta.hot) { 26 | import.meta.hot.accept() 27 | } 28 | -------------------------------------------------------------------------------- /hmr-test-app/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.base.json", 3 | "compilerOptions": { 4 | "rootDir": "src", 5 | "outDir": "dist" 6 | }, 7 | "include": ["src"] 8 | } 9 | -------------------------------------------------------------------------------- /hmr-test-app/vite.config.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @type { import('vite').UserConfig } 3 | */ 4 | const config = { 5 | jsx: 'react', 6 | plugins: [require('vite-plugin-react')], 7 | } 8 | 9 | module.exports = config 10 | -------------------------------------------------------------------------------- /jest.config.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | 3 | /** @type {import('@jest/types').Config.InitialOptions} */ 4 | const config = { 5 | transform: { '.(ts|tsx)': '@sucrase/jest-plugin' }, 6 | testPathIgnorePatterns: ['/dist/', '/esm/', '/node_modules/'], 7 | testEnvironment: 'node', 8 | forceExit: true, 9 | bail: 1, 10 | } 11 | 12 | module.exports = config 13 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "root", 3 | "scripts": { 4 | "test": "cross-env NODE_ENV=test jest --force-exit --colors", 5 | "test:hmr": "cross-env HRM_TESTS=1 yarn jest hmr-test-app", 6 | "watch": "ultra -r watch", 7 | "cli": "ultra -r cli", 8 | "build": "ultra --build -r --filter '@bundless/*' build", 9 | "fix-mismatches": "syncpack fix-mismatches --dev --prod --indent ' '", 10 | "release": "yarn build && changeset publish" 11 | }, 12 | "workspaces": { 13 | "nohoist": [ 14 | "examples/with-many-dependencies/preact", 15 | "**/preact" 16 | ], 17 | "packages": [ 18 | "bundless", 19 | "examples/*", 20 | "website", 21 | "fixtures/*", 22 | "tests", 23 | "with-pages", 24 | "plugins/*", 25 | "hmr-test-app", 26 | "paged", 27 | "temp" 28 | ] 29 | }, 30 | "devDependencies": { 31 | "@changesets/cli": "^2.12.0", 32 | "@jest/types": "^26.6.2", 33 | "@sucrase/jest-plugin": "^2.0.0", 34 | "@types/jest": "^26.0.19", 35 | "@types/jest-specific-snapshot": "^0.5.5", 36 | "@types/react": "^17.0.0", 37 | "cross-env": "^7.0.3", 38 | "esm": "^3.2.25", 39 | "jest": "^26.6.3", 40 | "prettier": "^2.2.1", 41 | "syncpack": "^5.7.11", 42 | "typescript": "^4.1.3", 43 | "ultra-runner": "^3.6.0" 44 | }, 45 | "private": true, 46 | "repository": "https://github.com/remorses/bundless.git", 47 | "author": "remorses ", 48 | "license": "MIT" 49 | } 50 | -------------------------------------------------------------------------------- /paged/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @bundless/plugin-react-paged 2 | 3 | ## 2.0.4 4 | 5 | ### Patch Changes 6 | 7 | - Updated dependencies [undefined] 8 | - @bundless/plugin-react-refresh@2.1.0 9 | 10 | ## 2.0.3 11 | 12 | ### Patch Changes 13 | 14 | - Updated dependencies [717a68e] 15 | - @bundless/cli@0.2.4 16 | - @bundless/plugin-react-refresh@2.0.3 17 | 18 | ## 2.0.2 19 | 20 | ### Patch Changes 21 | 22 | - Updated dependencies [bd7ed34] 23 | - Updated dependencies [55d7241] 24 | - @bundless/cli@0.2.3 25 | - @bundless/plugin-react-refresh@2.0.2 26 | 27 | ## 2.0.1 28 | 29 | ### Patch Changes 30 | 31 | - Updated dependencies [73eb17a] 32 | - @bundless/plugin-react-refresh@2.0.1 33 | 34 | ## 2.0.0 35 | 36 | ### Patch Changes 37 | 38 | - Updated dependencies [9a0b4e5] 39 | - @bundless/cli@0.2.0 40 | - @bundless/plugin-react-refresh@2.0.0 41 | 42 | ## 1.0.1 43 | 44 | ### Patch Changes 45 | 46 | - 336776d: Small improvements 47 | - Updated dependencies [2e6022f] 48 | - @bundless/cli@0.1.5 49 | 50 | ## 1.0.0 51 | 52 | ### Patch Changes 53 | 54 | - Updated dependencies [81c8e26] 55 | - @bundless/cli@0.1.0 56 | -------------------------------------------------------------------------------- /paged/README.md: -------------------------------------------------------------------------------- 1 | Nextjs like framework built on top of bundless, esbuild and react router 2 | 3 | ## IDEAS 4 | 5 | - function in the rpc folder are normal functions when called in the server and trigger a fetch request when called in the client 6 | - add a docker command that builds a docker image, this is useful because otherwise the server would need to build using esbuild on start to get the static outputs, this also let me bundle the server in a single files without dependencies, which makes the docker image build lighter and faster to build 7 | 8 | -------------------------------------------------------------------------------- /paged/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@bundless/plugin-react-paged", 3 | "version": "2.0.4", 4 | "private": true, 5 | "description": "", 6 | "main": "dist/index.js", 7 | "types": "dist/index.d.ts", 8 | "repository": "https://github.com/remorses/bundless.git", 9 | "scripts": { 10 | "build": "tsc", 11 | "watch": "tsc -w" 12 | }, 13 | "files": [ 14 | "dist", 15 | "src" 16 | ], 17 | "keywords": [], 18 | "author": "Tommaso De Rossi, morse ", 19 | "license": "ISC", 20 | "devDependencies": { 21 | "@babel/types": "^7.12.10", 22 | "@bundless/cli": "0.6.0", 23 | "@types/node": "^14.14.13", 24 | "@types/react-router-dom": "^5.1.7", 25 | "@types/uuid": "^8.3.0" 26 | }, 27 | "dependencies": { 28 | "escape-string-regexp": "^4.0.0", 29 | "@bundless/plugin-react-refresh": "2.1.0", 30 | "fast-glob": "^3.2.4", 31 | "fs-extra": "^9.0.1", 32 | "koa-body": "^4.2.0", 33 | "batched-promise-all": "^0.9.2", 34 | "micro-memoize": "^4.0.9", 35 | "picomatch": "^2.2.2", 36 | "react-helmet": "^6.1.0", 37 | "react-refresh": "^0.8.2", 38 | "react-router": "^5.2.0", 39 | "react-router-dom": "^5.2.0", 40 | "swr": "^0.3.11", 41 | "uuid": "^8.3.2" 42 | }, 43 | "peerDependencies": { 44 | "@bundless/cli": "*" 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /paged/src/client/context.ts: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { HelmetData } from 'react-helmet' 3 | 4 | export const MahoContext = React.createContext<{ 5 | url?: string 6 | helmet?: HelmetData 7 | statusCode?: number 8 | routeData?: { [path: string]: any } 9 | } | null>(null) 10 | 11 | export const useMahoContext = () => { 12 | const context = React.useContext(MahoContext) 13 | if (!context) { 14 | throw new Error(`cannot get maho context`) 15 | } 16 | return context 17 | } 18 | -------------------------------------------------------------------------------- /paged/src/client/index.ts: -------------------------------------------------------------------------------- 1 | import { useLocation } from 'react-router-dom' 2 | import useSWR from 'swr' 3 | 4 | import { useMahoContext } from './context' 5 | 6 | export { useMahoContext, MahoContext } from './context' 7 | 8 | const routeDataFetcher = async (pathname: string) => { 9 | return fetch(pathname, { 10 | headers: { 11 | accept: 'application/json', 12 | }, 13 | }) 14 | .then((res) => res.json()) 15 | .then((data) => data[pathname]) 16 | } 17 | 18 | export const useRouteData = () => { 19 | const { routeData = {} } = useMahoContext() 20 | const location = useLocation() 21 | 22 | if (process['browser']) { 23 | const state = window['INITIAL_STATE'] 24 | const { data } = useSWR(location.pathname, routeDataFetcher, { 25 | suspense: true, 26 | initialData: routeData[location.pathname], 27 | revalidateOnMount: state.revalidateOnMount, 28 | }) 29 | return data 30 | } 31 | 32 | return routeData[location.pathname] || {} 33 | } 34 | 35 | export interface LoadFunctionContext { 36 | params: { 37 | [k: string]: string | string[] 38 | } 39 | } 40 | 41 | export type LoadFunction = ( 42 | ctx: LoadFunctionContext, 43 | ) => object | Promise 44 | -------------------------------------------------------------------------------- /paged/src/constants.ts: -------------------------------------------------------------------------------- 1 | import { Logger } from '@bundless/cli' 2 | import picomatch from 'picomatch' 3 | 4 | export const CLIENT_ENTRY = '_bundless_paged_entry_.jsx' 5 | export const ROUTES_ENTRY = '_bundless_paged_routes_.jsx' 6 | export const jsGlob = '**/*.{ts,tsx,js,jsx}' 7 | export const isJsPage = picomatch(jsGlob) 8 | 9 | export const logger = new Logger({ prefix: '[paged] ' }) 10 | -------------------------------------------------------------------------------- /paged/src/index.tsx: -------------------------------------------------------------------------------- 1 | export { Plugin } from './plugin' 2 | export { createServer } from './server' 3 | export { staticExport } from './export' 4 | export * from './client' 5 | -------------------------------------------------------------------------------- /paged/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.base.json", 3 | "compilerOptions": { 4 | "rootDir": "src", 5 | "outDir": "dist" 6 | }, 7 | "include": ["src"], 8 | "exclude": ["dist"] 9 | } 10 | -------------------------------------------------------------------------------- /plugins/alias/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @bundless/plugin-alias 2 | 3 | ## 0.0.1 4 | ### Patch Changes 5 | 6 | - Fix regex filter issue 7 | -------------------------------------------------------------------------------- /plugins/alias/README.md: -------------------------------------------------------------------------------- 1 | ## Example 2 | 3 | ```ts 4 | // bundless.config.js 5 | const { AliasPlugin } = require('@bundless/plugin-alias') 6 | 7 | module.exports = { 8 | plugins: [ 9 | AliasPlugin({ 10 | entries: { react: 'preact/compat' }, 11 | }), 12 | ], 13 | } 14 | ``` 15 | -------------------------------------------------------------------------------- /plugins/alias/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@bundless/plugin-alias", 3 | "version": "0.0.1", 4 | "description": "", 5 | "main": "dist/index.js", 6 | "types": "dist/index.d.ts", 7 | "repository": "https://github.com/remorses/bundless.git", 8 | "scripts": { 9 | "build": "tsc", 10 | "watch": "tsc -w", 11 | "local": "yarn publish --force --registry http://localhost:4873 --access restricted --no-git-tag-version --patch --message 'Local registry publish'" 12 | }, 13 | "files": [ 14 | "dist", 15 | "src" 16 | ], 17 | "keywords": [], 18 | "author": "Tommaso De Rossi, morse ", 19 | "license": "ISC", 20 | "devDependencies": { 21 | "@bundless/cli": "0.6.0", 22 | "@types/node": "^14.14.13", 23 | "@types/globrex": "^0.1.0" 24 | }, 25 | "dependencies": { 26 | "escape-string-regexp": "^4.0.0", 27 | "slash": "^3.0.0" 28 | }, 29 | "peerDependencies": { 30 | "@bundless/cli": "*" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /plugins/alias/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "rootDir": "src", 5 | "outDir": "dist" 6 | }, 7 | "include": ["src"] 8 | } 9 | -------------------------------------------------------------------------------- /plugins/babel/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @bundless/plugin-babel 2 | 3 | ## 0.0.2 4 | 5 | ### Patch Changes 6 | 7 | - 717a68e: Fix npm release, removed bin 8 | - Updated dependencies [717a68e] 9 | - @bundless/cli@0.2.4 10 | 11 | ## 0.0.1 12 | 13 | ### Patch Changes 14 | 15 | - 1283051: Initial release 16 | -------------------------------------------------------------------------------- /plugins/babel/README.md: -------------------------------------------------------------------------------- 1 | ## Example 2 | 3 | ```ts 4 | // bundless.config.js 5 | const { BabelPlugin } = require('@bundless/plugin-babel') 6 | 7 | module.exports = { 8 | plugins: [ 9 | BabelPlugin({ 10 | babelOptions: { 11 | plugins: [require('babel-plugin-macros')], 12 | }, 13 | }), 14 | ], 15 | } 16 | ``` 17 | -------------------------------------------------------------------------------- /plugins/babel/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@bundless/plugin-babel", 3 | "version": "0.0.2", 4 | "description": "", 5 | "main": "dist/index.js", 6 | "types": "dist/index.d.ts", 7 | "repository": "https://github.com/remorses/bundless.git", 8 | "scripts": { 9 | "build": "tsc", 10 | "watch": "tsc -w", 11 | "local": "yarn publish --force --registry http://localhost:4873 --access restricted --no-git-tag-version --patch --message 'Local registry publish'" 12 | }, 13 | "files": [ 14 | "dist", 15 | "src" 16 | ], 17 | "keywords": [], 18 | "author": "Tommaso De Rossi, morse ", 19 | "license": "ISC", 20 | "devDependencies": { 21 | "@babel/types": "^7.12.10", 22 | "@bundless/cli": "0.6.0", 23 | "@types/node": "^14.14.13" 24 | }, 25 | "dependencies": { 26 | "@babel/core": "^7.12.10", 27 | "@babel/parser": "^7.12.11" 28 | }, 29 | "peerDependencies": { 30 | "@bundless/cli": "*" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /plugins/babel/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "rootDir": "src", 5 | "outDir": "dist" 6 | }, 7 | "include": ["src"] 8 | } 9 | -------------------------------------------------------------------------------- /plugins/react-refresh/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @bundless/plugin-react-refresh 2 | 3 | ## 2.1.0 4 | 5 | ### Minor Changes 6 | 7 | - Many improvements 8 | 9 | ## 2.0.3 10 | 11 | ### Patch Changes 12 | 13 | - 717a68e: Fix npm release, removed bin 14 | - Updated dependencies [717a68e] 15 | - @bundless/cli@0.2.4 16 | 17 | ## 2.0.2 18 | 19 | ### Patch Changes 20 | 21 | - 55d7241: Run in pre mode 22 | - Updated dependencies [bd7ed34] 23 | - @bundless/cli@0.2.3 24 | 25 | ## 2.0.1 26 | 27 | ### Patch Changes 28 | 29 | - 73eb17a: try to always enable react refresh, even when non react components exports exist, fix message when non react components are exported 30 | 31 | ## 2.0.0 32 | 33 | ### Patch Changes 34 | 35 | - Updated dependencies [9a0b4e5] 36 | - @bundless/cli@0.2.0 37 | 38 | ## 1.0.8 39 | 40 | ### Patch Changes 41 | 42 | - a398d28: add babelPlugins option 43 | 44 | ## 1.0.7 45 | 46 | ### Patch Changes 47 | 48 | - aa73425: Changed isComponentLikeName to support names with \_ 49 | 50 | ## 1.0.6 51 | 52 | ### Patch Changes 53 | 54 | - d42ff9d: Fix npm files 55 | 56 | ## 1.0.5 57 | 58 | ### Patch Changes 59 | 60 | - 0b2d857: Do not warn on default export 61 | 62 | ## 1.0.4 63 | 64 | ### Patch Changes 65 | 66 | - c2e66aa: configFile: false for babel 67 | 68 | ## 1.0.3 69 | 70 | ### Patch Changes 71 | 72 | - 9931159: Don't use babelrc file 73 | 74 | ## 1.0.2 75 | 76 | ### Patch Changes 77 | 78 | - fa99696: Small improvs 79 | 80 | ## 1.0.1 81 | 82 | ### Patch Changes 83 | 84 | - cc36158: Add filename in babel transform 85 | 86 | ## 1.0.0 87 | 88 | ### Minor Changes 89 | 90 | - 81c8e26: First release 91 | 92 | ### Patch Changes 93 | 94 | - Updated dependencies [81c8e26] 95 | - @bundless/cli@0.1.0 96 | -------------------------------------------------------------------------------- /plugins/react-refresh/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@bundless/plugin-react-refresh", 3 | "version": "2.1.0", 4 | "description": "", 5 | "main": "dist/index.js", 6 | "types": "dist/index.d.ts", 7 | "repository": "https://github.com/remorses/bundless.git", 8 | "scripts": { 9 | "build": "tsc", 10 | "watch": "tsc -w", 11 | "local": "yarn publish --force --registry http://localhost:4873 --access restricted --no-git-tag-version --patch --message 'Local registry publish'" 12 | }, 13 | "files": [ 14 | "dist", 15 | "src" 16 | ], 17 | "keywords": [], 18 | "author": "Tommaso De Rossi, morse ", 19 | "license": "ISC", 20 | "devDependencies": { 21 | "@babel/types": "^7.12.10", 22 | "@bundless/cli": "0.6.0", 23 | "@types/node": "^14.14.13" 24 | }, 25 | "dependencies": { 26 | "@babel/core": "^7.12.10", 27 | "slash": "^3.0.0", 28 | "@babel/parser": "^7.12.11", 29 | "react-refresh": "^0.8.2" 30 | }, 31 | "peerDependencies": { 32 | "@bundless/cli": "*" 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /plugins/react-refresh/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "rootDir": "src", 5 | "outDir": "dist" 6 | }, 7 | "include": ["src"] 8 | } 9 | -------------------------------------------------------------------------------- /plugins/svelte/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @bundless/plugin-svelte 2 | 3 | ## 0.0.1 4 | ### Patch Changes 5 | 6 | - bbbd527: Bump 7 | -------------------------------------------------------------------------------- /plugins/svelte/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@bundless/plugin-svelte", 3 | "version": "0.0.1", 4 | "description": "", 5 | "main": "dist/index.js", 6 | "types": "dist/index.d.ts", 7 | "repository": "https://github.com/remorses/bundless.git", 8 | "scripts": { 9 | "build": "tsc", 10 | "watch": "tsc -w", 11 | "local": "yarn publish --force --registry http://localhost:4873 --access restricted --no-git-tag-version --patch --message 'Local registry publish'" 12 | }, 13 | "files": [ 14 | "dist", 15 | "src" 16 | ], 17 | "keywords": [], 18 | "author": "Tommaso De Rossi, morse ", 19 | "license": "ISC", 20 | "devDependencies": { 21 | "@bundless/cli": "0.6.0", 22 | "@types/node": "^14.14.13", 23 | "svelte": "^3.32.1" 24 | }, 25 | "dependencies": { 26 | "svelte-hmr": "^0.12.2" 27 | }, 28 | "peerDependencies": { 29 | "esbuild": "*", 30 | "svelte": "*" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /plugins/svelte/src/typescript.ts: -------------------------------------------------------------------------------- 1 | import * as esbuild from 'esbuild' 2 | 3 | import { PreprocessorGroup } from 'svelte/types/compiler/preprocess/types' 4 | 5 | export let typescriptPreprocessor: PreprocessorGroup = { 6 | async script({ content, filename, attributes }) { 7 | if ( 8 | !( 9 | typeof attributes.lang == 'string' && 10 | /typescript|ts/.test(attributes.lang) 11 | ) 12 | ) 13 | return { code: content } 14 | 15 | let result = await esbuild.transform(content, { 16 | loader: 'ts', 17 | target: 'esnext', 18 | sourcefile: filename, 19 | tsconfigRaw: { 20 | compilerOptions: { 21 | importsNotUsedAsValues: 'preserve', 22 | }, 23 | }, 24 | }) 25 | 26 | return { code: result.code } 27 | }, 28 | } 29 | -------------------------------------------------------------------------------- /plugins/svelte/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "rootDir": "src", 5 | "outDir": "dist" 6 | }, 7 | "include": ["src"] 8 | } 9 | -------------------------------------------------------------------------------- /plugins/tsconfig-paths/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@bundless/plugin-tsconfig-paths", 3 | "version": "0.0.0", 4 | "description": "", 5 | "main": "dist/index.js", 6 | "types": "dist/index.d.ts", 7 | "repository": "https://github.com/remorses/bundless.git", 8 | "scripts": { 9 | "build": "tsc", 10 | "watch": "tsc -w", 11 | "local": "yarn publish --force --registry http://localhost:4873 --access restricted --no-git-tag-version --patch --message 'Local registry publish'" 12 | }, 13 | "files": [ 14 | "dist", 15 | "src" 16 | ], 17 | "keywords": [], 18 | "author": "Tommaso De Rossi, morse ", 19 | "license": "ISC", 20 | "devDependencies": { 21 | "@bundless/cli": "0.6.0", 22 | "@types/node": "^14.14.13", 23 | "@types/globrex": "^0.1.0" 24 | }, 25 | "dependencies": { 26 | "tsconfig-paths": "^3.9.0", 27 | "globrex": "^0.1.2" 28 | }, 29 | "peerDependencies": { 30 | "@bundless/cli": "*" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /plugins/tsconfig-paths/src/index.ts: -------------------------------------------------------------------------------- 1 | import { MAIN_FIELDS, Plugin } from '@bundless/cli' 2 | import globrex from 'globrex' 3 | import path from 'path' 4 | import { createMatchPath } from 'tsconfig-paths' 5 | 6 | export default TsconfigPathsPlugin 7 | 8 | export function TsconfigPathsPlugin(options: PluginOptions): Plugin { 9 | return { 10 | name: 'tsconfig-paths-plugin', // alias plugins need to have enforce pre or node resolve will have higher priority 11 | enforce: 'pre', 12 | setup({ onResolve, pluginsExecutor, ctx: { root, config } }) { 13 | const matchPath = createMatchPath( 14 | root, 15 | options.paths, 16 | MAIN_FIELDS, // TODO allow customization with config.mainFields 17 | true, 18 | ) 19 | 20 | const regexes = Object.keys(options.paths) 21 | .map((x) => globrex(x, {})) 22 | .map((x) => x.regex) 23 | 24 | regexes.forEach((filter) => { 25 | onResolve({ filter: filter! }, async (args) => { 26 | const resolved = matchPath(args.path) 27 | if (!resolved) { 28 | return null 29 | } 30 | const res = await pluginsExecutor.resolve({ 31 | ...args, 32 | path: resolved, 33 | }) 34 | if (!res || !res.path) { 35 | return { 36 | ...res, 37 | path: resolved, 38 | } 39 | } 40 | return res 41 | }) 42 | }) 43 | }, 44 | } 45 | } 46 | 47 | type PluginOptions = { 48 | paths: Record 49 | } 50 | -------------------------------------------------------------------------------- /plugins/tsconfig-paths/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "rootDir": "src", 5 | "outDir": "dist" 6 | }, 7 | "include": ["src"] 8 | } 9 | -------------------------------------------------------------------------------- /scripts/index.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/remorses/bundless/c7c167a78b03f8b643bcd1ed091f6b155fa84043/scripts/index.html -------------------------------------------------------------------------------- /scripts/partition.ts: -------------------------------------------------------------------------------- 1 | import { TraversalGraph } from "./analyze"; 2 | 3 | 4 | 5 | export function partition(graph: TraversalGraph) { 6 | 7 | } -------------------------------------------------------------------------------- /scripts/scc.ts: -------------------------------------------------------------------------------- 1 | import { TraversalGraph } from './analyze' 2 | 3 | export function scc(graph: TraversalGraph) { 4 | const indices = new Map() 5 | const lowlinks = new Map() 6 | const onStack = new Set() 7 | const stack: string[] = [] 8 | const scc: Set[] = [] 9 | let idx = 0 10 | 11 | function strongConnect(v) { 12 | indices.set(v, idx) 13 | lowlinks.set(v, idx) 14 | idx++ 15 | stack.push(v) 16 | onStack.add(v) 17 | 18 | const deps = graph[v]?.imports || [] 19 | for (const dep of deps) { 20 | if (!indices.has(dep)) { 21 | strongConnect(dep) 22 | lowlinks.set(v, Math.min(lowlinks.get(v), lowlinks.get(dep))) 23 | } else if (onStack.has(dep)) { 24 | lowlinks.set(v, Math.min(lowlinks.get(v), indices.get(dep))) 25 | } 26 | } 27 | 28 | if (lowlinks.get(v) === indices.get(v)) { 29 | const vertices = new Set() 30 | let w: string | undefined 31 | while (v !== w) { 32 | w = stack.pop() 33 | onStack.delete(w) 34 | vertices.add(w!) 35 | } 36 | scc.push(vertices) 37 | } 38 | } 39 | 40 | for (const v of Object.keys(graph)) { 41 | if (!indices.has(v)) { 42 | strongConnect(v) 43 | } 44 | } 45 | 46 | return scc.map((x) => [...x]) 47 | } 48 | -------------------------------------------------------------------------------- /scripts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2019", 4 | "module": "commonjs", 5 | "allowJs": true, 6 | "moduleResolution": "Node", 7 | "lib": ["es2017", "es7", "ESNext", "dom"], 8 | "declaration": true, 9 | "declarationMap": true, 10 | "strict": true, 11 | "esModuleInterop": true, 12 | "noImplicitAny": false, 13 | "sourceMap": true, 14 | "downlevelIteration": true, 15 | "jsx": "react", 16 | "skipLibCheck": true 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /scripts/ws.ts: -------------------------------------------------------------------------------- 1 | import WebSocket from 'ws' 2 | import { once } from 'events' 3 | import { serve } from '@bundless/cli' 4 | 5 | const PORT = 4000 6 | 7 | async function main() { 8 | await serve({ root: __dirname, port: PORT, openBrowser: true }) 9 | const ws = new WebSocket(`ws://127.0.0.1:${PORT}`, 'esm-hmr') 10 | await once(ws, 'open') 11 | ws.addEventListener('message', ({ data }) => { 12 | const payload = JSON.parse(data) 13 | console.log('msg', data) 14 | if (payload.type === 'connected') return 15 | if (payload.type === 'multi') { 16 | } 17 | }) 18 | } 19 | 20 | main() 21 | -------------------------------------------------------------------------------- /tests/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # tests 2 | 3 | ## 0.0.9 4 | 5 | ### Patch Changes 6 | 7 | - Updated dependencies [undefined] 8 | - @bundless/cli@0.6.0 9 | 10 | ## 0.0.8 11 | 12 | ### Patch Changes 13 | 14 | - Updated dependencies [undefined] 15 | - @bundless/cli@0.5.1 16 | 17 | ## 0.0.7 18 | 19 | ### Patch Changes 20 | 21 | - Updated dependencies [undefined] 22 | - @bundless/cli@0.5.0 23 | 24 | ## 0.0.6 25 | 26 | ### Patch Changes 27 | 28 | - Updated dependencies [undefined] 29 | - @bundless/cli@0.4.0 30 | 31 | ## 0.0.5 32 | 33 | ### Patch Changes 34 | 35 | - Updated dependencies [undefined] 36 | - @bundless/cli@0.3.0 37 | 38 | ## 0.0.4 39 | 40 | ### Patch Changes 41 | 42 | - Updated dependencies [undefined] 43 | - @bundless/cli@0.2.6 44 | 45 | ## 0.0.3 46 | 47 | ### Patch Changes 48 | 49 | - Updated dependencies [undefined] 50 | - @bundless/cli@0.2.5 51 | 52 | ## 0.0.2 53 | 54 | ### Patch Changes 55 | 56 | - Updated dependencies [717a68e] 57 | - @bundless/cli@0.2.4 58 | 59 | ## 0.0.1 60 | 61 | ### Patch Changes 62 | 63 | - Updated dependencies [9a0b4e5] 64 | - @bundless/cli@0.2.0 65 | -------------------------------------------------------------------------------- /tests/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tests", 3 | "private": true, 4 | "version": "0.0.9", 5 | "dependencies": { 6 | "es-module-traversal": "^0.0.50", 7 | "@bundless/cli": "0.6.0", 8 | "glob": "^7.1.6", 9 | "jasmine-fail-fast": "^2.0.1", 10 | "jest-specific-snapshot": "^4.0.0", 11 | "node-fetch": "^2.6.1", 12 | "mime-types": "^2.1.29", 13 | "slash": "^3.0.0" 14 | }, 15 | "devDependencies": { 16 | "@types/jest": "^26.0.19" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /tests/utils.ts: -------------------------------------------------------------------------------- 1 | import Koa from 'koa' 2 | import staticServe from 'koa-static' 3 | import path from 'path' 4 | import slash from 'slash' 5 | import { TraversalResultType } from 'es-module-traversal' 6 | 7 | export async function timedRun(func) { 8 | const start = process.hrtime.bigint() 9 | await func() 10 | const end = process.hrtime.bigint() 11 | return Math.round(Number(end - start) / 1e6) 12 | } 13 | 14 | export function osAgnosticResult(x: TraversalResultType): TraversalResultType { 15 | let { importPath, importer, resolvedImportPath } = x 16 | if (!isUrl(resolvedImportPath)) { 17 | resolvedImportPath = normalizePath(resolvedImportPath) 18 | } 19 | if (!isUrl(importer)) { 20 | importer = normalizePath(importer) 21 | } 22 | return { 23 | importPath, 24 | importer, 25 | resolvedImportPath, 26 | } 27 | } 28 | 29 | function normalizePath(filePath: string) { 30 | filePath = path.relative(process.cwd(), filePath) 31 | filePath = slash(filePath) 32 | return filePath 33 | } 34 | 35 | export function isUrl(str: string) { 36 | return str && str.startsWith('http://') || str.startsWith('https://') 37 | } -------------------------------------------------------------------------------- /tsconfig.base.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2019", 4 | "module": "commonjs", 5 | "allowJs": true, 6 | "moduleResolution": "Node", 7 | "lib": [ 8 | "es2017", 9 | "es7", 10 | "es6", 11 | "dom" 12 | ], 13 | "declaration": true, 14 | "declarationMap": true, 15 | "strict": true, 16 | "esModuleInterop": true, 17 | "noImplicitAny": false, 18 | "sourceMap": true, 19 | "downlevelIteration": true, 20 | "jsx": "react", 21 | "skipLibCheck": true 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /website/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | sidebar.json 9 | 10 | # testing 11 | /coverage 12 | 13 | # next.js 14 | /.next/ 15 | /out/ 16 | 17 | # production 18 | /build 19 | 20 | # misc 21 | .DS_Store 22 | .env* 23 | 24 | # debug 25 | npm-debug.log* 26 | yarn-debug.log* 27 | yarn-error.log* 28 | -------------------------------------------------------------------------------- /website/constants.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | export const GITHUB_LINK = 'https://github.com/remorses/bundless' 4 | -------------------------------------------------------------------------------- /website/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// -------------------------------------------------------------------------------- /website/next.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | const compose = require('compose-function') 3 | const withReactSvg = require('next-react-svg') 4 | const withImages = require('next-images') 5 | 6 | const transpile = require('next-transpile-modules')(['landing-blocks', 'dokz']) 7 | const { withDokz } = require('dokz/dist/plugin') 8 | 9 | const composed = compose(withDokz, transpile, withImages) 10 | 11 | module.exports = composed({ 12 | include: path.resolve(__dirname, 'public'), 13 | pageExtensions: ['js', 'jsx', 'md', 'mdx', 'ts', 'tsx'], 14 | }) 15 | -------------------------------------------------------------------------------- /website/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "website", 3 | "version": "0.0.0", 4 | "private": true, 5 | "dependencies": { 6 | "@chakra-ui/react": "^1.1.2", 7 | "@emotion/react": "^11.1.4", 8 | "@octokit/webhooks": "^7.11.0", 9 | "baby-i-am-faded": "^2.0.1", 10 | "dokz": "^2.0.1", 11 | "framer-motion": "^3.2.0", 12 | "landing-blocks": "^2.0.2", 13 | "next": "^10.0.5", 14 | "next-images": "^1.7.0", 15 | "next-transpile-modules": "^4.1.0", 16 | "react": "experimental", 17 | "react-dom": "experimental", 18 | "react-icons": "^4.1.0" 19 | }, 20 | "devDependencies": { 21 | "@types/node": "^14.14.13", 22 | "@types/react": "^17.0.0", 23 | "compose-function": "^3.0.3", 24 | "next-react-svg": "^1.1.2", 25 | "typescript": "^4.1.3" 26 | }, 27 | "scripts": { 28 | "build": "next build", 29 | "dev": "next dev", 30 | "start": "next start" 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /website/pages/docs/benchmarks.mdx: -------------------------------------------------------------------------------- 1 | # Benchmarks 2 | 3 | The repository with the benchmarks is [here](https://github.com/remorses/bundless-benchmark) 4 | -------------------------------------------------------------------------------- /website/pages/docs/cli.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | name: Command Line 3 | --- 4 | 5 | # Cli 6 | 7 | ## Install bundless 8 | 9 | ```sh 10 | npm i -g @bundless/cli 11 | ``` 12 | 13 | ## Run the dev server 14 | 15 | ```sh 16 | bundless dev # or just bundless 17 | ``` 18 | 19 | ## Build to static assets 20 | 21 | ```sh 22 | bundless build --out ./out 23 | ``` 24 | -------------------------------------------------------------------------------- /website/pages/docs/how-it-works.mdx: -------------------------------------------------------------------------------- 1 | # How does bundless work? 2 | 3 | Bundless works differently when in development and in build, to share as much logic as possible bundless encapsulates as much logic as possible in plugins. 4 | 5 | The bundless Plugin interface is a superset of [esbuild's plugin interface](https://esbuild.github.io/plugins/), this means that the same plugins can be used both when running in development and in build phase. 6 | 7 | Esbuild is not only used in the build phase, it is also used to traverse the module graph in the `prebundle` phase and to bundle dependencies. 8 | 9 | The prebundle phase consists in 10 | 11 | - traverse the module import graph 12 | - gather all imports to files in node_modules 13 | - bundle these files in valid ES modules 14 | - store them in the `web_modules` directory 15 | 16 | The prebundle phase is necessary to make commonjs code work in the browser and reduce the number of network requests to fetch modules. 17 | 18 | In development bundless is a web server that serves your modules to the browser. 19 | 20 | It also has does some built in transformations to your files 21 | 22 | - import paths are rewritten to path on root, `import './file'` becomes `import '/path/to/file.js'` 23 | 24 | - import paths are resolved to their path 25 | s 26 | - plugins `onLoad` and `onTransform` methods are called on the module contents 27 | 28 | When building the entries are passed to `esbuild` to be bundles 29 | 30 | Html files are converted to js files that import their scripts src urls (only those that are inside your root directory) 31 | -------------------------------------------------------------------------------- /website/pages/docs/index.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | name: Getting started 3 | --- 4 | 5 | ## Getting Started 6 | 7 | Bundless is an experimental application development server and bundler. 8 | 9 | It is a replacement for tools like webpack and parcel, with the main aim being development and build speed with as less as possible compromises. 10 | 11 | To try out an example application run the following commands to setup an example application 12 | 13 | ```sh 14 | npm i -g @bundless/cli 15 | bundless quickstart ./my-app # will download an example app inside my-app 16 | cd my-app 17 | npm run dev 18 | ``` 19 | 20 | ## How is bundless faster than my favorite build tool? 21 | 22 | Bundless is different than traditional bundlers, it doesn't build your files to one large bundle, it instead serve your files directly to the browser 23 | 24 | This means that bundless doesn't need to parse your files, which is the most costly operation done by tools like webpack 25 | 26 | This means that when you make a change to a file only the changed module is fetched, this makes the hmr implementation much simpler compared to tools like webpack that need instead runtime logic to handle code replacement. 27 | -------------------------------------------------------------------------------- /website/pages/docs/integrations/alias.mdx: -------------------------------------------------------------------------------- 1 | # Alias node modules 2 | 3 | You can alias modules using the `@bundless/plugin-alias` plugin 4 | 5 | ## Example 6 | 7 | ```js 8 | // bundless.config.js 9 | const { AliasPlugin } = require('@bundless/plugin-alias') 10 | 11 | module.exports = { 12 | plugins: [ 13 | AliasPlugin({ 14 | entries: { react: 'preact/compat', /regex/: 'some-path' }, 15 | }), 16 | ], 17 | } 18 | ``` 19 | -------------------------------------------------------------------------------- /website/pages/docs/integrations/babel.mdx: -------------------------------------------------------------------------------- 1 | # Using Babel 2 | 3 | You can use babel using the `@bundless/plugin-babel` package 4 | 5 | ## Example 6 | 7 | ```js 8 | // bundless.config.js 9 | const { BabelPlugin } = require('@bundless/plugin-babel') 10 | 11 | module.exports = { 12 | plugins: [ 13 | BabelPlugin({ 14 | babelOptions: { 15 | plugins: [require('babel-plugin-macros')], 16 | }, 17 | }), 18 | ], 19 | } 20 | ``` 21 | 22 | Notice that you will need to pass your babel options explicitly and not using `.babelrc` files 23 | 24 | This API design choice has been made because usually .babelrc files contain babel presets that transpile jsx to js but this is already done in bundless, you only need to pass some specific plugins that you need 25 | -------------------------------------------------------------------------------- /website/pages/docs/integrations/react-refresh.mdx: -------------------------------------------------------------------------------- 1 | # Using react refresh 2 | 3 | React refresh lets you see changes on the browser without refreshing the page 4 | 5 | ## Example 6 | 7 | ```js 8 | // bundless.config.js 9 | const { ReactRefreshPlugin } = require('@bundless/plugin-react-refresh') 10 | 11 | module.exports = { 12 | plugins: [ReactRefreshPlugin()], 13 | } 14 | ``` 15 | -------------------------------------------------------------------------------- /website/pages/docs/migration.mdx: -------------------------------------------------------------------------------- 1 | # Migration 2 | 3 | ## Migration from create-react-app 4 | 5 | - Source code must not use `require` or `module.exports` but valid ES imports and exports 6 | - Use `jsx` instead of `js` extension for files that contain jsx 7 | - Remove ejs templates from index.html 8 | - Add your entrypoint in index.html with a script tag (for example `