@quilted/rollup 0.2.24 → 0.2.26

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/source/app.ts CHANGED
@@ -907,7 +907,7 @@ export function magicModuleAppRequestRouter({
907
907
  return multiline`
908
908
  import '@quilted/quilt/globals';
909
909
 
910
- import {jsx} from 'react/jsx-runtime';
910
+ import {jsx} from 'preact/jsx-runtime';
911
911
  import {RequestRouter} from '@quilted/quilt/request-router';
912
912
  import {renderToResponse} from '@quilted/quilt/server';
913
913
 
@@ -944,23 +944,19 @@ export function magicModuleAppBrowserEntry({
944
944
  module: MAGIC_MODULE_ENTRY,
945
945
  sideEffects: true,
946
946
  async source() {
947
- const reactRootFunction = hydrate ? 'hydrateRoot' : 'createRoot';
947
+ const reactRootFunction = hydrate ? 'hydrate' : 'render';
948
948
 
949
949
  return multiline`
950
950
  import '@quilted/quilt/globals';
951
951
 
952
- import {jsx} from 'react/jsx-runtime';
953
- import {${reactRootFunction}} from 'react-dom/client';
952
+ import {jsx} from 'preact/jsx-runtime';
953
+ import {${reactRootFunction}} from 'preact';
954
954
 
955
955
  import App from ${JSON.stringify(MAGIC_MODULE_APP_COMPONENT)};
956
956
 
957
957
  const element = document.querySelector(${JSON.stringify(selector)});
958
958
 
959
- ${
960
- hydrate
961
- ? `${reactRootFunction}(element, jsx(App));`
962
- : `${reactRootFunction}(element).render(jsx(App));`
963
- }
959
+ ${reactRootFunction}(jsx(App), element);
964
960
  `;
965
961
  },
966
962
  });
@@ -22,10 +22,17 @@ export function asyncModules({
22
22
  return {
23
23
  name: '@quilted/async',
24
24
  async resolveId(id, importer) {
25
- if (id.startsWith(IMPORT_PREFIX)) return `\0${id}`;
26
- if (!id.startsWith(MODULE_PREFIX)) return null;
25
+ let prefix: string;
26
+
27
+ if (id.startsWith(IMPORT_PREFIX)) {
28
+ prefix = IMPORT_PREFIX;
29
+ } else if (id.startsWith(MODULE_PREFIX)) {
30
+ prefix = MODULE_PREFIX;
31
+ } else {
32
+ return null;
33
+ }
27
34
 
28
- const imported = id.replace(MODULE_PREFIX, '');
35
+ const imported = id.replace(prefix, '');
29
36
 
30
37
  const resolved = await this.resolve(imported, importer, {
31
38
  skipSelf: true,
@@ -33,7 +40,7 @@ export function asyncModules({
33
40
 
34
41
  if (resolved == null) return null;
35
42
 
36
- return `\0${MODULE_PREFIX}${resolved.id}`;
43
+ return `\0${prefix}${resolved.id}`;
37
44
  },
38
45
  resolveDynamicImport(specifier) {
39
46
  if (
@@ -29,7 +29,7 @@ export function sourceCode({
29
29
  // Support very modern features
30
30
  target: 'es2022',
31
31
  jsx: 'automatic',
32
- jsxImportSource: typeof react === 'string' ? react : 'react',
32
+ jsxImportSource: typeof react === 'string' ? react : 'preact',
33
33
  exclude: 'node_modules/**',
34
34
  });
35
35
  }
@@ -47,7 +47,7 @@ export function sourceCode({
47
47
  require.resolve('@babel/preset-react'),
48
48
  {
49
49
  runtime: 'automatic',
50
- importSource: typeof react === 'string' ? react : 'react',
50
+ importSource: typeof react === 'string' ? react : 'preact',
51
51
  development: mode === 'development',
52
52
  },
53
53
  ],
@@ -269,7 +269,7 @@ const workerFunctionContent = (pkg: string) =>
269
269
 
270
270
  const KNOWN_WRAPPER_MODULES = new Map<string, Map<string, string>>([
271
271
  ['@quilted/workers', workerFunctionContent('@quilted/workers')],
272
- ['@quilted/react-workers', workerFunctionContent('@quilted/react-workers')],
272
+ ['@quilted/preact-workers', workerFunctionContent('@quilted/preact-workers')],
273
273
  ['@quilted/quilt/threads', workerFunctionContent('@quilted/quilt/threads')],
274
274
  ]);
275
275
 
package/tsconfig.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "extends": "@quilted/craft/typescript/project.json",
2
+ "extends": "@quilted/typescript/tsconfig.project.json",
3
3
  "compilerOptions": {
4
4
  "rootDir": "source",
5
5
  "outDir": "build/typescript"