@abcnews/aunty 15.0.3 → 16.0.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abcnews/aunty",
3
- "version": "15.0.3",
3
+ "version": "16.0.0",
4
4
  "description": "A toolkit for working with ABC News projects",
5
5
  "repository": "abcnews/aunty",
6
6
  "license": "MIT",
@@ -79,10 +79,11 @@
79
79
  "sass-loader": "^11.0.1",
80
80
  "semver": "^7.3.2",
81
81
  "style-loader": "^2.0.0",
82
- "svelte": "^4.2.8",
83
- "svelte-loader": "^3.1.9",
82
+ "svelte": "^5.17.4",
83
+ "svelte-loader": "^3.2.4",
84
84
  "svelte-preprocess": "^5.1.1",
85
85
  "tcp-ping-sync": "^1.0.0",
86
+ "ts-loader": "^9.5.1",
86
87
  "typescript": "^5.3.2",
87
88
  "update-notifier": "^6.0.2",
88
89
  "webpack": "^5.33.2",
@@ -45,14 +45,7 @@ const PROJECT_TYPES_CONFIG = {
45
45
  */
46
46
  svelte: config => {
47
47
  config.resolve = {
48
- // Make sure that only one copy of the Svelte runtime is bundled in the app
49
- alias: {
50
- svelte: resolve('node_modules', 'svelte/src/runtime')
51
- },
52
- // Recognise .svelte files
53
48
  extensions: [...config.resolve.extensions, '.svelte'],
54
- // When using Svelte components installed from npm, use the original component
55
- // source code, rather than consuming the already-compiled version
56
49
  mainFields: ['svelte', 'browser', 'module', 'main'],
57
50
  conditionNames: ['svelte', 'browser', 'import']
58
51
  };
@@ -62,31 +55,62 @@ const PROJECT_TYPES_CONFIG = {
62
55
 
63
56
  include.push(/(node_modules\/svelte)/);
64
57
 
65
- config.module.rules.push({
66
- test: /\.svelte$/,
67
- include,
68
- use: [
58
+ // options from https://github.com/sveltejs/svelte-loader
59
+ config.module.rules.push(
60
+ ...[
69
61
  {
70
- loader,
71
- options
62
+ test: /\.svelte\.ts$/,
63
+ use: [
64
+ {
65
+ loader,
66
+ options
67
+ },
68
+ { loader: require.resolve('ts-loader'), options: { transpileOnly: true } },
69
+ {
70
+ loader: require.resolve('svelte-loader'),
71
+ options: {
72
+ dev: config.mode === 'development',
73
+ emitCss: extractCSS,
74
+ preprocess: sveltePreprocess()
75
+ }
76
+ }
77
+ ]
72
78
  },
73
79
  {
74
- loader: require.resolve('svelte-loader'),
80
+ test: /(?<!\.svelte)\.ts$/,
81
+ loader: require.resolve('ts-loader'),
75
82
  options: {
76
- dev: config.mode === 'development',
77
- emitCss: extractCSS,
78
- preprocess: sveltePreprocess()
83
+ transpileOnly: true // you should use svelte-check for type checking
84
+ }
85
+ },
86
+ {
87
+ // Svelte 5+:
88
+ test: /\.(svelte|svelte\.js)$/,
89
+ include,
90
+ use: [
91
+ {
92
+ loader,
93
+ options
94
+ },
95
+ {
96
+ loader: require.resolve('svelte-loader'),
97
+ options: {
98
+ dev: config.mode === 'development',
99
+ emitCss: extractCSS,
100
+ preprocess: sveltePreprocess()
101
+ }
102
+ }
103
+ ]
104
+ },
105
+ {
106
+ // required to prevent errors from Svelte on Webpack 5+, omit on Webpack 4
107
+ test: /node_modules\/svelte\/.*\.mjs$/,
108
+ resolve: {
109
+ fullySpecified: false
79
110
  }
80
111
  }
81
112
  ]
82
- });
83
- // Required to prevent errors from Svelte on Webpack 5+
84
- config.module.rules.push({
85
- test: /node_modules\/svelte\/.*\.mjs$/,
86
- resolve: {
87
- fullySpecified: false
88
- }
89
- });
113
+ );
90
114
 
91
115
  return config;
92
116
  }
@@ -217,7 +217,7 @@ Shorthand examples (assuming xyz is your project name):
217
217
  break;
218
218
  case 'svelte':
219
219
  devDependencies.push('@testing-library/svelte');
220
- dependencies.push('svelte@4');
220
+ dependencies.push('svelte@5');
221
221
  break;
222
222
  default:
223
223
  break;
@@ -1,4 +1,4 @@
1
- import { h<% if (isTS) { %>, FunctionalComponent<% } %> } from 'preact';
1
+ import { h<% if (isTS) { %>, type FunctionalComponent<% } %> } from 'preact';
2
2
  import Worm from '../Worm';
3
3
  import styles from './styles.scss';
4
4
  <% if (isTS) { %>
@@ -1,4 +1,4 @@
1
- import { h<% if (isTS) { %>, FunctionalComponent<% } %> } from 'preact';
1
+ import { h<% if (isTS) { %>, type FunctionalComponent<% } %> } from 'preact';
2
2
  import { useEffect } from 'preact/hooks';
3
3
  import styles from './styles.scss';
4
4
  <% if (isTS) { %>
@@ -1,4 +1,4 @@
1
- import { h<% if (isTS) { %>, FunctionalComponent<% } %> } from 'preact';
1
+ import { h<% if (isTS) { %>, type FunctionalComponent<% } %> } from 'preact';
2
2
  import styles from './styles.scss';
3
3
  import worm from './worm.svg';
4
4
 
@@ -2,7 +2,7 @@ import acto from '@abcnews/alternating-case-to-object';
2
2
  import { <% if (isOdyssey) { %>whenOdysseyLoaded<% } else { %>whenDOMReady<% } %> } from '@abcnews/env-utils';
3
3
  import { getMountValue, selectMounts } from '@abcnews/mount-utils';
4
4
  import React from 'react';
5
- import { createRoot<% if (isTS) { %>, Root<% } %> } from 'react-dom/client';
5
+ import { createRoot<% if (isTS) { %>, type Root<% } %> } from 'react-dom/client';
6
6
  import App from './components/App';<% if (isTS) { %>
7
7
  import type { AppProps } from './components/App';<% } %>
8
8
 
@@ -3,6 +3,7 @@ import { <% if (isOdyssey) { %>whenOdysseyLoaded<% } else { %>whenDOMReady<% } %
3
3
  import { getMountValue, selectMounts } from '@abcnews/mount-utils';<% if (isTS) { %>
4
4
  import type { Mount } from '@abcnews/mount-utils';<% } %>
5
5
  import App from './components/App/App.svelte';
6
+ import { mount } from 'svelte';
6
7
 
7
8
  let appMountEl<% if (isTS) { %>: Mount<% } %>;
8
9
  let appProps;
@@ -12,7 +13,8 @@ let appProps;
12
13
 
13
14
  if (appMountEl) {
14
15
  appProps = acto(getMountValue(appMountEl));
15
- new App({
16
+
17
+ mount(App, {
16
18
  target: appMountEl,
17
19
  props: appProps
18
20
  });
package/ts/config.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "esModuleInterop": true,
15
15
  "forceConsistentCasingInFileNames": true,
16
16
  "allowSyntheticDefaultImports": true,
17
- "verbatimModuleSyntax": false,
17
+ "verbatimModuleSyntax": true,
18
18
  "resolveJsonModule": true,
19
19
  "isolatedModules": true,
20
20
  "strictNullChecks": true