@quilted/rollup 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/build/cjs/app.cjs +150 -136
- package/build/cjs/features/assets.cjs +130 -0
- package/build/cjs/{env.cjs → features/env.cjs} +4 -4
- package/build/cjs/{request-router.cjs → features/request-router.cjs} +3 -3
- package/build/cjs/features/source-code.cjs +40 -0
- package/build/cjs/features/system-js.cjs +35 -0
- package/build/cjs/index.cjs +0 -7
- package/build/cjs/shared/rollup.cjs +0 -4
- package/build/esm/app.mjs +152 -138
- package/build/esm/features/assets.mjs +107 -0
- package/build/esm/{env.mjs → features/env.mjs} +4 -4
- package/build/esm/{request-router.mjs → features/request-router.mjs} +3 -3
- package/build/esm/features/source-code.mjs +38 -0
- package/build/esm/features/system-js.mjs +33 -0
- package/build/esm/index.mjs +1 -3
- package/build/esm/shared/rollup.mjs +1 -4
- package/build/esnext/app.esnext +152 -138
- package/build/esnext/features/assets.esnext +107 -0
- package/build/esnext/{env.esnext → features/env.esnext} +4 -4
- package/build/esnext/{request-router.esnext → features/request-router.esnext} +3 -3
- package/build/esnext/features/source-code.esnext +38 -0
- package/build/esnext/features/system-js.esnext +33 -0
- package/build/esnext/index.esnext +1 -3
- package/build/esnext/shared/rollup.esnext +1 -4
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/typescript/app.d.ts +32 -144
- package/build/typescript/app.d.ts.map +1 -1
- package/build/typescript/features/assets.d.ts +13 -0
- package/build/typescript/features/assets.d.ts.map +1 -0
- package/build/typescript/features/css.d.ts +16 -0
- package/build/typescript/features/css.d.ts.map +1 -0
- package/build/typescript/features/env.d.ts +57 -0
- package/build/typescript/features/env.d.ts.map +1 -0
- package/build/typescript/features/graphql/transform.d.ts +17 -0
- package/build/typescript/features/graphql/transform.d.ts.map +1 -0
- package/build/typescript/features/graphql.d.ts +6 -0
- package/build/typescript/features/graphql.d.ts.map +1 -0
- package/build/typescript/features/request-router.d.ts +15 -0
- package/build/typescript/features/request-router.d.ts.map +1 -0
- package/build/typescript/features/source-code.d.ts +5 -0
- package/build/typescript/features/source-code.d.ts.map +1 -0
- package/build/typescript/features/system-js.d.ts +7 -0
- package/build/typescript/features/system-js.d.ts.map +1 -0
- package/build/typescript/index.d.ts +1 -3
- package/build/typescript/index.d.ts.map +1 -1
- package/build/typescript/shared/source-code.d.ts +5 -0
- package/build/typescript/shared/source-code.d.ts.map +1 -0
- package/package.json +15 -2
- package/source/app.ts +173 -118
- package/source/features/assets.ts +183 -0
- package/source/features/css.ts +91 -0
- package/source/{env.ts → features/env.ts} +4 -4
- package/source/{request-router.ts → features/request-router.ts} +3 -3
- package/source/features/source-code.ts +64 -0
- package/source/features/system-js.ts +36 -0
- package/source/index.ts +0 -5
- /package/build/cjs/{graphql → features/graphql}/transform.cjs +0 -0
- /package/build/cjs/{graphql.cjs → features/graphql.cjs} +0 -0
- /package/build/esm/{graphql → features/graphql}/transform.mjs +0 -0
- /package/build/esm/{graphql.mjs → features/graphql.mjs} +0 -0
- /package/build/esnext/{graphql → features/graphql}/transform.esnext +0 -0
- /package/build/esnext/{graphql.esnext → features/graphql.esnext} +0 -0
- /package/source/{graphql → features/graphql}/transform.ts +0 -0
- /package/source/{graphql.ts → features/graphql.ts} +0 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import {createRequire} from 'module';
|
|
2
|
+
|
|
3
|
+
import babel from '@rollup/plugin-babel';
|
|
4
|
+
|
|
5
|
+
const require = createRequire(import.meta.url);
|
|
6
|
+
|
|
7
|
+
export function sourceCode({
|
|
8
|
+
mode,
|
|
9
|
+
targets,
|
|
10
|
+
}: {
|
|
11
|
+
mode?: 'development' | 'production';
|
|
12
|
+
targets?: string[];
|
|
13
|
+
}) {
|
|
14
|
+
return babel({
|
|
15
|
+
configFile: false,
|
|
16
|
+
babelrc: false,
|
|
17
|
+
presets: [
|
|
18
|
+
require.resolve('@babel/preset-typescript'),
|
|
19
|
+
[
|
|
20
|
+
require.resolve('@babel/preset-react'),
|
|
21
|
+
{
|
|
22
|
+
runtime: 'automatic',
|
|
23
|
+
importSource: 'react',
|
|
24
|
+
development: mode === 'development',
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
[
|
|
28
|
+
require.resolve('@babel/preset-env'),
|
|
29
|
+
{
|
|
30
|
+
// @ts-expect-error This is a valid option
|
|
31
|
+
corejs: '3.15',
|
|
32
|
+
useBuiltIns: 'usage',
|
|
33
|
+
bugfixes: true,
|
|
34
|
+
shippedProposals: true,
|
|
35
|
+
// I thought I wanted this on, but if you do this, Babel
|
|
36
|
+
// stops respecting the top-level `targets` option and tries
|
|
37
|
+
// to use the targets passed to the preset directly instead.
|
|
38
|
+
ignoreBrowserslistConfig: true,
|
|
39
|
+
} satisfies import('@babel/preset-env').Options,
|
|
40
|
+
],
|
|
41
|
+
],
|
|
42
|
+
plugins: [
|
|
43
|
+
[
|
|
44
|
+
require.resolve('@babel/plugin-proposal-decorators'),
|
|
45
|
+
{version: '2023-01'},
|
|
46
|
+
],
|
|
47
|
+
],
|
|
48
|
+
targets,
|
|
49
|
+
extensions: [
|
|
50
|
+
'.ts',
|
|
51
|
+
'.tsx',
|
|
52
|
+
'.mts',
|
|
53
|
+
'.mtsx',
|
|
54
|
+
'.js',
|
|
55
|
+
'.jsx',
|
|
56
|
+
'.es6',
|
|
57
|
+
'.es',
|
|
58
|
+
'.mjs',
|
|
59
|
+
],
|
|
60
|
+
exclude: 'node_modules/**',
|
|
61
|
+
babelHelpers: 'bundled',
|
|
62
|
+
skipPreflightCheck: true,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {readFile} from 'fs/promises';
|
|
2
|
+
import {createRequire} from 'module';
|
|
3
|
+
|
|
4
|
+
import type {Plugin} from 'rollup';
|
|
5
|
+
|
|
6
|
+
export function systemJS({minify = false} = {}) {
|
|
7
|
+
return {
|
|
8
|
+
name: '@quilted/system-js',
|
|
9
|
+
async renderChunk(_, chunk, options) {
|
|
10
|
+
if (options.format !== 'system' || !chunk.isEntry) return null;
|
|
11
|
+
|
|
12
|
+
const require = createRequire(import.meta.url);
|
|
13
|
+
const systemjs = minify
|
|
14
|
+
? require.resolve('systemjs/dist/s.min.js')
|
|
15
|
+
: require.resolve('systemjs/dist/s.js');
|
|
16
|
+
|
|
17
|
+
// We write the systemjs loader to a dedicated file, and we make it the
|
|
18
|
+
// "first import" of the chunk so that it is the first file listed in
|
|
19
|
+
// the manifest.
|
|
20
|
+
const fileHandle = this.emitFile({
|
|
21
|
+
type: 'asset',
|
|
22
|
+
name: 'loader.js',
|
|
23
|
+
source: (await readFile(systemjs, {encoding: 'utf8'})).replace(
|
|
24
|
+
// Remove the source map comment, if it is present, because we don’t upload the
|
|
25
|
+
// sourcemap for this file.
|
|
26
|
+
/\n?[/][/]# sourceMappingURL=s.*\.map\n?$/,
|
|
27
|
+
'',
|
|
28
|
+
),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
chunk.imports.unshift(this.getFileName(fileHandle));
|
|
32
|
+
|
|
33
|
+
return null;
|
|
34
|
+
},
|
|
35
|
+
} satisfies Plugin;
|
|
36
|
+
}
|
package/source/index.ts
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
export {magicModuleEnv, type MagicModuleEnvOptions} from './env.ts';
|
|
2
1
|
export {
|
|
3
2
|
quiltAppBrowser,
|
|
4
3
|
quiltAppServer,
|
|
5
|
-
magicModuleAppComponent,
|
|
6
|
-
magicModuleAppBrowserEntry,
|
|
7
|
-
magicModuleAppRequestRouter,
|
|
8
4
|
type AppOptions,
|
|
9
5
|
type AppBrowserOptions,
|
|
10
6
|
type AppServerOptions,
|
|
11
7
|
} from './app.ts';
|
|
12
|
-
export {magicModuleRequestRouterEntry} from './request-router.ts';
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|