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 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 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 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 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 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 |
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 |
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 |
increment
9 |
decrement
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 | setState((x) => x + 1)}
23 | >
24 | +1
25 |
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 | {
11 | import(noop('/src/main.jsx?sdf'))
12 | }}
13 | >
14 | refetch
15 |
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 `