@jscutlery/swc-angular 0.13.0 → 0.13.1

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 CHANGED
@@ -1,9 +1,9 @@
1
- ## 0.13.0 (2024-05-02)
1
+ ## 0.13.1 (2024-05-03)
2
2
 
3
3
 
4
- ### 🚀 Features
4
+ ### 🩹 Fixes
5
5
 
6
- - ✨ add support for playwright 1.43 ([#358](https://github.com/jscutlery/devkit/pull/358))
6
+ - **swc-angular:** 🐞 fix stackblitz support ([#364](https://github.com/jscutlery/devkit/pull/364))
7
7
 
8
8
 
9
9
  ### ❤️ Thank You
@@ -12,61 +12,52 @@
12
12
 
13
13
  ## 0.12.0 (2024-04-12)
14
14
 
15
-
16
15
  ### 🚀 Features
17
16
 
18
17
  - **swc-angular:** ✨ rename swc-angular packages ([#324](https://github.com/jscutlery/devkit/pull/324))
19
18
 
20
-
21
- ### ❤️ Thank You
19
+ ### ❤️ Thank You
22
20
 
23
21
  - Younes Jaaidi
24
22
 
25
23
  ## 0.3.0 (2024-04-11)
26
24
 
27
-
28
25
  ### 🚀 Features
29
26
 
30
- - **swc-angular-preset:** ✨ fail gracefully if @swc/core is incompatible ([#322](https://github.com/jscutlery/devkit/pull/322))
27
+ - **swc-angular-preset:** ✨ fail gracefully if @swc/core is
28
+ incompatible ([#322](https://github.com/jscutlery/devkit/pull/322))
31
29
 
32
-
33
- ### ❤️ Thank You
30
+ ### ❤️ Thank You
34
31
 
35
32
  - Younes Jaaidi
36
33
 
37
34
  ## 0.2.2 (2024-04-09)
38
35
 
39
-
40
36
  ### 🩹 Fixes
41
37
 
42
38
  - **swc-angular-preset:** 🐞 fix jest preset typing ([9c6de1c](https://github.com/jscutlery/devkit/commit/9c6de1c))
43
39
 
44
-
45
- ### ❤️ Thank You
40
+ ### ❤️ Thank You
46
41
 
47
42
  - Younes Jaaidi
48
43
 
49
44
  ## 0.2.1 (2024-04-08)
50
45
 
51
-
52
46
  ### 🩹 Fixes
53
47
 
54
48
  - **swc-plugin-angular:** 🐞 transform async/await ([#313](https://github.com/jscutlery/devkit/pull/313))
55
49
 
56
-
57
- ### ❤️ Thank You
50
+ ### ❤️ Thank You
58
51
 
59
52
  - Younes Jaaidi
60
53
 
61
54
  ## 0.2.0 (2024-04-04)
62
55
 
63
-
64
56
  ### 🚀 Features
65
57
 
66
58
  - **swc-angular-preset:** ✨ add vite support ([#307](https://github.com/jscutlery/devkit/pull/307))
67
59
 
68
-
69
- ### ❤️ Thank You
60
+ ### ❤️ Thank You
70
61
 
71
62
  - Younes Jaaidi
72
63
 
@@ -76,28 +67,24 @@
76
67
 
77
68
  - **swc-angular-preset:** 🐞 publish dist artefact
78
69
 
79
-
80
70
  ## 0.1.1 (2024-03-29)
81
71
 
82
-
83
72
  ### 🩹 Fixes
84
73
 
85
- - **swc-angular-preset:** 🐞 allow recent versions of swc-plugin-angular ([c715414](https://github.com/jscutlery/devkit/commit/c715414))
86
-
74
+ - **swc-angular-preset:** 🐞 allow recent versions of
75
+ swc-plugin-angular ([c715414](https://github.com/jscutlery/devkit/commit/c715414))
87
76
 
88
- ### ❤️ Thank You
77
+ ### ❤️ Thank You
89
78
 
90
79
  - Edouard Bozon @edbzn
91
80
  - Younes Jaaidi
92
81
 
93
82
  ## 0.1.0 (2024-03-26)
94
83
 
95
-
96
84
  ### 🚀 Features
97
85
 
98
86
  - ✨ add swc-angular-preset and swc-plugin-angular ([#273](https://github.com/jscutlery/devkit/pull/273))
99
87
 
100
-
101
- ### ❤️ Thank You
88
+ ### ❤️ Thank You
102
89
 
103
90
  - Edouard Bozon @edbzn
package/index.cjs.js CHANGED
@@ -3,6 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var core = require('@swc/core');
6
+ var node_fs = require('node:fs');
7
+ var node_path = require('node:path');
6
8
 
7
9
  function _extends() {
8
10
  _extends = Object.assign || function assign(target) {
@@ -15,7 +17,15 @@ function _extends() {
15
17
  return _extends.apply(this, arguments);
16
18
  }
17
19
 
18
- assertCompatibleSwcCoreVersion();
20
+ class FileSystem {
21
+ readJsonFile(path) {
22
+ const content = node_fs.readFileSync(path, 'utf-8');
23
+ return JSON.parse(content);
24
+ }
25
+ }
26
+ const fileSystem = new FileSystem();
27
+
28
+ assertCompatibleSwcCoreVersion(core.version);
19
29
  function swcAngularPreset(options = {}) {
20
30
  return {
21
31
  jsc: {
@@ -72,10 +82,15 @@ function swcAngularUnpluginOptions() {
72
82
  /**
73
83
  * @deprecated Use {@link swcAngularVitePreset}, {@link swcAngularJestTransformer} or {@link swcAngularPreset} instead.
74
84
  */ var index = swcAngularPreset();
75
- function assertCompatibleSwcCoreVersion() {
76
- if (!core.version.startsWith('1.4.')) {
85
+ function assertCompatibleSwcCoreVersion(version) {
86
+ /* Fallback to reading version from package.json when not exported.
87
+ * This happens on Stackblitz. */ if (version == undefined) {
88
+ const packageJsonPath = node_path.join(node_path.dirname(require.resolve('@swc/core')), 'package.json');
89
+ version = fileSystem.readJsonFile(packageJsonPath).version;
90
+ }
91
+ if (!version.startsWith('1.4.')) {
77
92
  console.error(`
78
- @swc/core version ${core.version} is incompatible with @jscutlery/swc-angular.
93
+ @swc/core version ${version} is incompatible with @jscutlery/swc-angular.
79
94
  Please use @swc/core version 1.4.x.
80
95
  > npm add -D @swc/core@~1.4.0
81
96
  `);
package/index.esm.js CHANGED
@@ -1,4 +1,6 @@
1
1
  import { version } from '@swc/core';
2
+ import { readFileSync } from 'node:fs';
3
+ import { join, dirname } from 'node:path';
2
4
 
3
5
  function _extends() {
4
6
  _extends = Object.assign || function assign(target) {
@@ -11,7 +13,15 @@ function _extends() {
11
13
  return _extends.apply(this, arguments);
12
14
  }
13
15
 
14
- assertCompatibleSwcCoreVersion();
16
+ class FileSystem {
17
+ readJsonFile(path) {
18
+ const content = readFileSync(path, 'utf-8');
19
+ return JSON.parse(content);
20
+ }
21
+ }
22
+ const fileSystem = new FileSystem();
23
+
24
+ assertCompatibleSwcCoreVersion(version);
15
25
  function swcAngularPreset(options = {}) {
16
26
  return {
17
27
  jsc: {
@@ -68,7 +78,12 @@ function swcAngularUnpluginOptions() {
68
78
  /**
69
79
  * @deprecated Use {@link swcAngularVitePreset}, {@link swcAngularJestTransformer} or {@link swcAngularPreset} instead.
70
80
  */ var index = swcAngularPreset();
71
- function assertCompatibleSwcCoreVersion() {
81
+ function assertCompatibleSwcCoreVersion(version) {
82
+ /* Fallback to reading version from package.json when not exported.
83
+ * This happens on Stackblitz. */ if (version == undefined) {
84
+ const packageJsonPath = join(dirname(require.resolve('@swc/core')), 'package.json');
85
+ version = fileSystem.readJsonFile(packageJsonPath).version;
86
+ }
72
87
  if (!version.startsWith('1.4.')) {
73
88
  console.error(`
74
89
  @swc/core version ${version} is incompatible with @jscutlery/swc-angular.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jscutlery/swc-angular",
3
- "version": "0.13.0",
3
+ "version": "0.13.1",
4
4
  "repository": {
5
5
  "url": "https://github.com/jscutlery/devkit"
6
6
  },
package/src/utils.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export declare class FileSystem {
2
+ readJsonFile<T>(path: string): T;
3
+ }
4
+ export declare const fileSystem: FileSystem;