unframer 2.25.5 → 2.26.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/dist/babel-jsx.d.ts +15 -0
- package/dist/babel-jsx.d.ts.map +1 -0
- package/dist/babel-jsx.js +223 -0
- package/dist/babel-jsx.js.map +1 -0
- package/dist/babel-plugin-imports.d.ts +0 -6
- package/dist/babel-plugin-imports.d.ts.map +1 -1
- package/dist/babel-plugin-imports.js +2 -135
- package/dist/babel-plugin-imports.js.map +1 -1
- package/dist/cli.d.ts +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +31 -6
- package/dist/cli.js.map +1 -1
- package/dist/css.js +13 -13
- package/dist/esbuild.d.ts.map +1 -1
- package/dist/esbuild.js +5 -5
- package/dist/esbuild.js.map +1 -1
- package/dist/example-code.test.js +39 -39
- package/dist/example-code.test.js.map +1 -1
- package/dist/exporter.d.ts.map +1 -1
- package/dist/exporter.js +137 -87
- package/dist/exporter.js.map +1 -1
- package/dist/flat-cache-interceptor.d.ts +27 -0
- package/dist/flat-cache-interceptor.d.ts.map +1 -0
- package/dist/flat-cache-interceptor.js +99 -0
- package/dist/flat-cache-interceptor.js.map +1 -0
- package/dist/framer.d.ts.map +1 -1
- package/dist/framer.js +837 -684
- package/dist/framer.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +15 -3
- package/dist/react.js.map +1 -1
- package/dist/sentry.d.ts.map +1 -1
- package/dist/sentry.js +1 -16
- package/dist/sentry.js.map +1 -1
- package/dist/undici-dispatcher.d.ts +2 -0
- package/dist/undici-dispatcher.d.ts.map +1 -0
- package/dist/undici-dispatcher.js +13 -0
- package/dist/undici-dispatcher.js.map +1 -0
- package/dist/utils.d.ts +3 -3
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +4 -10
- package/dist/utils.js.map +1 -1
- package/dist/utils.test.d.ts +2 -0
- package/dist/utils.test.d.ts.map +1 -0
- package/dist/utils.test.js +143 -0
- package/dist/utils.test.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/esm/babel-jsx.d.ts +15 -0
- package/esm/babel-jsx.d.ts.map +1 -0
- package/esm/babel-jsx.js +219 -0
- package/esm/babel-jsx.js.map +1 -0
- package/esm/babel-plugin-imports.d.ts +0 -6
- package/esm/babel-plugin-imports.d.ts.map +1 -1
- package/esm/babel-plugin-imports.js +2 -134
- package/esm/babel-plugin-imports.js.map +1 -1
- package/esm/cli.d.ts +1 -0
- package/esm/cli.d.ts.map +1 -1
- package/esm/cli.js +31 -6
- package/esm/cli.js.map +1 -1
- package/esm/css.js +13 -13
- package/esm/esbuild.d.ts.map +1 -1
- package/esm/esbuild.js +4 -4
- package/esm/esbuild.js.map +1 -1
- package/esm/example-code.test.js +40 -40
- package/esm/example-code.test.js.map +1 -1
- package/esm/exporter.d.ts.map +1 -1
- package/esm/exporter.js +100 -50
- package/esm/exporter.js.map +1 -1
- package/esm/flat-cache-interceptor.d.ts +27 -0
- package/esm/flat-cache-interceptor.d.ts.map +1 -0
- package/esm/flat-cache-interceptor.js +95 -0
- package/esm/flat-cache-interceptor.js.map +1 -0
- package/esm/framer.d.ts.map +1 -1
- package/esm/framer.js +813 -672
- package/esm/framer.js.map +1 -1
- package/esm/index.d.ts +1 -1
- package/esm/index.d.ts.map +1 -1
- package/esm/react.d.ts.map +1 -1
- package/esm/react.js +15 -3
- package/esm/react.js.map +1 -1
- package/esm/sentry.d.ts.map +1 -1
- package/esm/sentry.js +1 -16
- package/esm/sentry.js.map +1 -1
- package/esm/undici-dispatcher.d.ts +2 -0
- package/esm/undici-dispatcher.d.ts.map +1 -0
- package/esm/undici-dispatcher.js +10 -0
- package/esm/undici-dispatcher.js.map +1 -0
- package/esm/utils.d.ts +3 -3
- package/esm/utils.d.ts.map +1 -1
- package/esm/utils.js +3 -9
- package/esm/utils.js.map +1 -1
- package/esm/utils.test.d.ts +2 -0
- package/esm/utils.test.d.ts.map +1 -0
- package/esm/utils.test.js +141 -0
- package/esm/utils.test.js.map +1 -0
- package/esm/version.d.ts +1 -1
- package/esm/version.js +1 -1
- package/package.json +8 -10
- package/src/babel-jsx.ts +277 -0
- package/src/babel-plugin-imports.ts +6 -169
- package/src/cli.ts +45 -6
- package/src/css.ts +13 -13
- package/src/esbuild.ts +5 -4
- package/src/example-code.test.ts +40 -41
- package/src/exporter.ts +124 -54
- package/src/flat-cache-interceptor.ts +114 -0
- package/src/framer.js +902 -739
- package/src/index.ts +1 -1
- package/src/react.tsx +15 -1
- package/src/sentry.ts +1 -20
- package/src/undici-dispatcher.ts +13 -0
- package/src/utils.test.ts +148 -0
- package/src/utils.ts +4 -17
- package/src/version.ts +1 -1
package/esm/css.js
CHANGED
|
@@ -69,7 +69,7 @@ export function getFontsStyles(_fontsDefs) {
|
|
|
69
69
|
let str = '';
|
|
70
70
|
str += dedent `
|
|
71
71
|
@font-face {
|
|
72
|
-
font-family: '${x.family}';
|
|
72
|
+
font-family: '${x.family}';
|
|
73
73
|
src: url('${x.url}');\n
|
|
74
74
|
`;
|
|
75
75
|
if (x.style) {
|
|
@@ -103,42 +103,42 @@ export const breakpointsStylesLegacy = (breakpointSizes) => {
|
|
|
103
103
|
return /* css */ `
|
|
104
104
|
/* Base */
|
|
105
105
|
@media (min-width: ${breakpointSizes.base}px) and (max-width: ${breakpointSizes.sm - 1}px) {
|
|
106
|
-
.unframer-hidden.unframer-base {
|
|
106
|
+
.unframer-hidden.unframer-base {
|
|
107
107
|
display: contents;
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
/* Small */
|
|
112
112
|
@media (min-width: ${breakpointSizes.sm}px) and (max-width: ${breakpointSizes.md - 1}px) {
|
|
113
|
-
.unframer-hidden.unframer-sm {
|
|
113
|
+
.unframer-hidden.unframer-sm {
|
|
114
114
|
display: contents;
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
/* Medium */
|
|
119
119
|
@media (min-width: ${breakpointSizes.md}px) and (max-width: ${breakpointSizes.lg - 1}px) {
|
|
120
|
-
.unframer-hidden.unframer-md {
|
|
120
|
+
.unframer-hidden.unframer-md {
|
|
121
121
|
display: contents;
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
/* Large */
|
|
126
126
|
@media (min-width: ${breakpointSizes.lg}px) and (max-width: ${breakpointSizes.xl - 1}px) {
|
|
127
|
-
.unframer-hidden.unframer-lg {
|
|
127
|
+
.unframer-hidden.unframer-lg {
|
|
128
128
|
display: contents;
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
/* Extra Large */
|
|
133
133
|
@media (min-width: ${breakpointSizes.xl}px) and (max-width: ${breakpointSizes['2xl'] - 1}px) {
|
|
134
|
-
.unframer-hidden.unframer-xl {
|
|
134
|
+
.unframer-hidden.unframer-xl {
|
|
135
135
|
display: contents;
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
/* 2 Extra Large */
|
|
140
140
|
@media (min-width: ${breakpointSizes['2xl']}px) {
|
|
141
|
-
.unframer-hidden.unframer-2xl {
|
|
141
|
+
.unframer-hidden.unframer-2xl {
|
|
142
142
|
display: contents;
|
|
143
143
|
}
|
|
144
144
|
}
|
|
@@ -153,42 +153,42 @@ export const breakpointsStyles = (breakpointSizes) => {
|
|
|
153
153
|
return /* css */ `
|
|
154
154
|
/* Base */
|
|
155
155
|
@media (min-width: ${breakpointSizes.base}px) and (max-width: ${breakpointSizes.sm - 1}px) {
|
|
156
|
-
.unframer:not(.unframer-base) {
|
|
156
|
+
.unframer:not(.unframer-base) {
|
|
157
157
|
display: none !important;
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
|
|
161
161
|
/* Small */
|
|
162
162
|
@media (min-width: ${breakpointSizes.sm}px) and (max-width: ${breakpointSizes.md - 1}px) {
|
|
163
|
-
.unframer:not(.unframer-sm) {
|
|
163
|
+
.unframer:not(.unframer-sm) {
|
|
164
164
|
display: none !important;
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
/* Medium */
|
|
169
169
|
@media (min-width: ${breakpointSizes.md}px) and (max-width: ${breakpointSizes.lg - 1}px) {
|
|
170
|
-
.unframer:not(.unframer-md) {
|
|
170
|
+
.unframer:not(.unframer-md) {
|
|
171
171
|
display: none !important;
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
/* Large */
|
|
176
176
|
@media (min-width: ${breakpointSizes.lg}px) and (max-width: ${breakpointSizes.xl - 1}px) {
|
|
177
|
-
.unframer:not(.unframer-lg) {
|
|
177
|
+
.unframer:not(.unframer-lg) {
|
|
178
178
|
display: none !important;
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
/* Extra Large */
|
|
183
183
|
@media (min-width: ${breakpointSizes.xl}px) and (max-width: ${breakpointSizes['2xl'] - 1}px) {
|
|
184
|
-
.unframer:not(.unframer-xl) {
|
|
184
|
+
.unframer:not(.unframer-xl) {
|
|
185
185
|
display: none !important;
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
/* 2 Extra Large */
|
|
190
190
|
@media (min-width: ${breakpointSizes['2xl']}px) {
|
|
191
|
-
.unframer:not(.unframer-2xl) {
|
|
191
|
+
.unframer:not(.unframer-2xl) {
|
|
192
192
|
display: none !important;
|
|
193
193
|
}
|
|
194
194
|
}
|
package/esm/esbuild.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"esbuild.d.ts","sourceRoot":"","sources":["../src/esbuild.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAI9B,OAAO,EAAE,MAAM,EAAiC,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"esbuild.d.ts","sourceRoot":"","sources":["../src/esbuild.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAI9B,OAAO,EAAE,MAAM,EAAiC,MAAM,SAAS,CAAA;AAK/D,eAAO,MAAM,uBAAuB,UAMnC,CAAA;AAID,eAAO,MAAM,iBAAiB,GAAI,qBAG/B;IACC,QAAQ,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IAC/C,IAAI,EAAE,MAAM,CAAA;CACf,WAcA,CAAA;AAED,wBAAgB,+BAA+B,CAAC,EAC5C,MAA6C,EAC7C,gBAAiC,EACjC,cAAsB,EACtB,MAAM,EACN,gBAAsC,GACzC;;;;;8BAD4B,MAAM;CAClC,UAyMA;AAED,wBAAsB,eAAe,CAAC,EAClC,aAAa,EACb,MAAM,EACN,GAAG,GACN,EAAE;IACC,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,aAAa,CAAC,EAAE,GAAG,CAAA;IACnB,MAAM,CAAC,EAAE,WAAW,CAAA;CACvB,gBAkBA;AAED,wBAAsB,wBAAwB,CAC1C,GAAG,CAAC,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,WAAW,+BAmBvB;AAID,eAAO,MAAM,cAAc,EAYtB,OAAO,KAAK,CAAA;AAEjB,wBAAgB,UAAU,CAAC,CAAC,SAAS,QAAQ,EAAE,EAAE,EAAE,QAAQ,GAAG,QAAQ,CAarE;AAED,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CASzD"}
|
package/esm/esbuild.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { fetch } from 'undici';
|
|
2
2
|
import { RateLimit, Sema } from 'async-sema';
|
|
3
|
-
import {
|
|
3
|
+
import { logger, spinner } from './utils';
|
|
4
4
|
import { transform } from 'esbuild';
|
|
5
5
|
import { resolvePackage } from './exporter';
|
|
6
6
|
import { notifyError } from './sentry';
|
|
7
|
+
import { dispatcher } from './undici-dispatcher';
|
|
7
8
|
export const defaultExternalPackages = [
|
|
8
9
|
'react',
|
|
9
10
|
'react-dom',
|
|
@@ -230,11 +231,10 @@ export async function recursiveResolveRedirect(url, signal) {
|
|
|
230
231
|
}
|
|
231
232
|
return url;
|
|
232
233
|
}
|
|
233
|
-
let semaphore = new Sema(
|
|
234
|
-
let rateLimiter = RateLimit(
|
|
234
|
+
let semaphore = new Sema(3);
|
|
235
|
+
let rateLimiter = RateLimit(20, { timeUnit: 1000 });
|
|
235
236
|
export const fetchWithRetry = retryTwice(async (url, options) => {
|
|
236
237
|
await semaphore.acquire();
|
|
237
|
-
await rateLimiter();
|
|
238
238
|
const timeout = setTimeout(() => {
|
|
239
239
|
logger.error('fetch taking more than 10s', url);
|
|
240
240
|
}, 10000);
|
package/esm/esbuild.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"esbuild.js","sourceRoot":"","sources":["../src/esbuild.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAC9B,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"esbuild.js","sourceRoot":"","sources":["../src/esbuild.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAC9B,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEzC,OAAO,EAAU,SAAS,EAAsB,MAAM,SAAS,CAAA;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAEhD,MAAM,CAAC,MAAM,uBAAuB,G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CAAqB,EAAY;IACvD,OAAO,KAAK,EAAE,GAAG,IAAI,EAAE,EAAE;QACrB,IAAI,CAAC;YACD,OAAO,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC,CAAA;QAC5B,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YACd,sBAAsB;YACtB,IAAI,CAAC,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;gBAC1B,OAAM;YACV,CAAC;YACD,MAAM,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC,CAAA;YACnC,OAAO,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC,CAAA;QAC5B,CAAC;IACL,CAAC,CAAA;AACL,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,UAAkB;IAC7C,yBAAyB;IACzB,IAAI,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7B,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QAC3C,IAAI,CAAC,IAAI;YAAE,OAAO,UAAU,CAAA;QAC5B,OAAO,GAAG,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IAC3C,CAAC;IACD,0BAA0B;IAC1B,OAAO,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;AACnC,CAAC"}
|
package/esm/example-code.test.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createExampleComponentCode } from './exporter.js';
|
|
1
|
+
import { describe, expect, test } from 'vitest';
|
|
3
2
|
import { configFromFetch } from './cli.js';
|
|
3
|
+
import { createExampleComponentCode } from './exporter.js';
|
|
4
4
|
describe('createExampleComponentCode', () => {
|
|
5
5
|
test('should create example component code', async () => {
|
|
6
6
|
const projectId = 'cf755ed7d59e0319';
|
|
@@ -25,44 +25,44 @@ describe('createExampleComponentCode', () => {
|
|
|
25
25
|
import ArticlesCardFramerComponent from './src/articles-card'
|
|
26
26
|
|
|
27
27
|
export default function App() {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
28
|
+
return (
|
|
29
|
+
<div className='flex flex-col items-center gap-3 '>
|
|
30
|
+
<NavigationFramerComponent.Responsive
|
|
31
|
+
ctaVariant={"Primary"}
|
|
32
|
+
/>
|
|
33
|
+
<HeroFramerComponent.Responsive/>
|
|
34
|
+
<PricingBannerFramerComponent.Responsive/>
|
|
35
|
+
<FooterFramerComponent.Responsive
|
|
36
|
+
year={"2024"}
|
|
37
|
+
/>
|
|
38
|
+
<FeatureListFramerComponent.Responsive/>
|
|
39
|
+
<ServiceSliderFramerComponent.Responsive/>
|
|
40
|
+
<SectionTitleFramerComponent.Responsive
|
|
41
|
+
text={"We are pioneers in harnessing the power of Blockchain and Web3 technologies to drive innovation, security, and decentralization."}
|
|
42
|
+
title={"Smart Automation"}
|
|
43
|
+
tagline={"Systems and Building Web3"}
|
|
44
|
+
iconVisible={true}
|
|
45
|
+
textVisible={true}
|
|
46
|
+
/>
|
|
47
|
+
<ButtonFramerComponent.Responsive
|
|
48
|
+
link={"/news"}
|
|
49
|
+
buttonTitle={"Read all blog"}
|
|
50
|
+
iconVisibility={true}
|
|
51
|
+
/>
|
|
52
|
+
<BrandLogoFramerComponent.Responsive/>
|
|
53
|
+
<TestmonialItemFramerComponent.Responsive
|
|
54
|
+
name1={"Wade Warren"}
|
|
55
|
+
paragraph={"Security is non-negotiable in the decentralized world, and we take this aspect very seriously. Our solutions are built with a robust emphasis on security, utilizing advanced cryptographic"}
|
|
56
|
+
designation={"Flutter Developer"}
|
|
57
|
+
/>
|
|
58
|
+
<ArticlesCardFramerComponent.Responsive
|
|
59
|
+
date={"Mar 06, 2024 "}
|
|
60
|
+
link={"/news/:slug"}
|
|
61
|
+
title={"Discoveries from Our Thinkers"}
|
|
62
|
+
excerpt={"Experience seamless integration with decentralized applications (DApps)."}
|
|
63
|
+
/>
|
|
64
|
+
</div>
|
|
65
|
+
);
|
|
66
66
|
};"
|
|
67
67
|
`);
|
|
68
68
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"example-code.test.js","sourceRoot":"","sources":["../src/example-code.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"example-code.test.js","sourceRoot":"","sources":["../src/example-code.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC1C,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAA;AAE1D,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IACxC,IAAI,CAAC,sCAAsC,EAAE,KAAK,IAAI,EAAE;QACpD,MAAM,SAAS,GAAG,kBAAkB,CAAA;QAEpC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,eAAe,CAAC,EAAE,SAAS,EAAE,CAAC,CAAA;QACvD,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,0BAA0B,CAAC;YACrD,MAAM;YACN,MAAM,EAAE,KAAK;SAChB,CAAC,CAAA;QACF,MAAM,CAAC,WAAW,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAuDzC,CAAC,CAAA;IACN,CAAC,CAAC,CAAA;AACN,CAAC,EAAE,IAAI,GAAG,EAAE,CAAC,CAAA"}
|
package/esm/exporter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exporter.d.ts","sourceRoot":"","sources":["../src/exporter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,KAAK,YAAY,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"exporter.d.ts","sourceRoot":"","sources":["../src/exporter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkB,KAAK,YAAY,EAAE,MAAM,SAAS,CAAA;AAKxE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAiB9B,OAAO,EACH,mBAAmB,EAOtB,MAAM,UAAU,CAAA;AAMjB,OAAO,EAGH,gBAAgB,EAEnB,MAAM,aAAa,CAAA;AAcpB,MAAM,MAAM,UAAU,GAAG;IACrB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,wBAAsB,MAAM,CAAC,EACzB,MAAM,EACN,GAAG,EAAE,GAAQ,EACb,KAAa,EACb,MAA6C,GAChD,EAAE;IACC,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,MAAM,CAAC,EAAE,WAAW,CAAA;CACvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0jBA;AAID,wBAAgB,cAAc,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE;;;CAAA,+BAiC1C;AAED,wBAAsB,oBAAoB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C;QACd,iBAAiB,EAAE,MAAM,CAAA;QACzB,IAAI,EAAE,MAAM,CAAA;QACZ,GAAG,EAAE,MAAM,CAAA;QACX,aAAa,EAAE,MAAM,CAAA;QACrB,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;KACtC,CAAC,CAAA;CACL,CAAA"}
|
package/esm/exporter.js
CHANGED
|
@@ -3,17 +3,21 @@ import packageJson from '../package.json';
|
|
|
3
3
|
import url from 'url';
|
|
4
4
|
import { Sema } from 'async-sema';
|
|
5
5
|
import { nodeModulesPolyfillPlugin } from 'esbuild-plugins-node-modules-polyfill';
|
|
6
|
+
import { transform } from '@babel/core';
|
|
6
7
|
import { exec } from 'child_process';
|
|
8
|
+
import { error } from 'console';
|
|
7
9
|
import fs from 'fs';
|
|
8
10
|
import path from 'path';
|
|
9
|
-
import dedent from '
|
|
11
|
+
import { dedent } from './utils.js';
|
|
12
|
+
import { babelPluginJsxTransform, removeJsxExpressionContainer, } from './babel-jsx.js';
|
|
13
|
+
import { propCamelCaseJustLikeFramer } from './compat.js';
|
|
10
14
|
import { breakpointsStyles, breakpointsStylesLegacy, defaultBreakpointSizes, getFontsStyles, groupBy, logFontsUsage, } from './css.js';
|
|
11
15
|
import { defaultExternalPackages, esbuildPluginBundleDependencies, resolveRedirect, } from './esbuild';
|
|
12
16
|
import { ControlType, combinedCSSRules, } from './framer.js';
|
|
13
|
-
import { stackblitzDemoExample, kebabCase, logger, spinner, terminalMarkdown, } from './utils.js';
|
|
14
|
-
import { error } from 'console';
|
|
15
17
|
import { notifyError } from './sentry';
|
|
16
|
-
import {
|
|
18
|
+
import { kebabCase, logger, spinner, stackblitzDemoExample, terminalMarkdown, } from './utils.js';
|
|
19
|
+
import { Biome, Distribution } from '@biomejs/js-api';
|
|
20
|
+
let biome;
|
|
17
21
|
export async function bundle({ config, cwd: out = '', watch = false, signal = undefined, }) {
|
|
18
22
|
const { components, breakpoints, tokens, framerWebPages } = config;
|
|
19
23
|
out ||= path.resolve(process.cwd(), 'example');
|
|
@@ -22,7 +26,7 @@ export async function bundle({ config, cwd: out = '', watch = false, signal = un
|
|
|
22
26
|
await fs.promises.mkdir(out, { recursive: true });
|
|
23
27
|
}
|
|
24
28
|
catch (e) { }
|
|
25
|
-
spinner.start();
|
|
29
|
+
spinner.start('exporting components...');
|
|
26
30
|
const otherRoutes = Object.fromEntries((config.framerWebPages || []).map((page) => [
|
|
27
31
|
page.webPageId,
|
|
28
32
|
{ path: page.path },
|
|
@@ -50,6 +54,7 @@ export async function bundle({ config, cwd: out = '', watch = false, signal = un
|
|
|
50
54
|
};
|
|
51
55
|
}),
|
|
52
56
|
jsx: 'automatic',
|
|
57
|
+
// jsxFactory: '_jsx',
|
|
53
58
|
bundle: true,
|
|
54
59
|
platform: 'browser',
|
|
55
60
|
metafile: true,
|
|
@@ -169,25 +174,52 @@ export async function bundle({ config, cwd: out = '', watch = false, signal = un
|
|
|
169
174
|
});
|
|
170
175
|
spinner.update('Finished build');
|
|
171
176
|
for (let file of buildResult.outputFiles) {
|
|
172
|
-
const
|
|
177
|
+
const resultPathAbsJs = path.resolve(out, file.path);
|
|
178
|
+
const resultPathAbsJsx = resultPathAbsJs.replace(/\.js$/, '.jsx');
|
|
173
179
|
const existing = await fs.promises
|
|
174
|
-
.readFile(
|
|
180
|
+
.readFile(resultPathAbsJsx, 'utf-8')
|
|
175
181
|
.catch(() => null);
|
|
176
|
-
|
|
177
|
-
// babelrc: false,
|
|
178
|
-
// sourceType: 'module',
|
|
179
|
-
// plugins: [
|
|
180
|
-
// babelPluginDeduplicateImports,
|
|
181
|
-
// babelPluginJsxTransform(),
|
|
182
|
-
// ],
|
|
183
|
-
// filename: 'x.js',
|
|
184
|
-
// compact: true,
|
|
185
|
-
// sourceMaps: false,
|
|
186
|
-
// })
|
|
187
|
-
// let inputCode = res!.code!
|
|
188
|
-
const tooBigSize = 1 * 1024 * 1024;
|
|
182
|
+
const tooBigSize = 0.7 * 1024 * 1024;
|
|
189
183
|
let formatted = file.text;
|
|
190
|
-
|
|
184
|
+
let tooBig = file.text.length >= tooBigSize;
|
|
185
|
+
let didFormat = false;
|
|
186
|
+
if (config.jsx &&
|
|
187
|
+
!tooBig &&
|
|
188
|
+
!resultPathAbsJs.includes('/chunks/') &&
|
|
189
|
+
!resultPathAbsJs.includes('\\chunks\\')) {
|
|
190
|
+
try {
|
|
191
|
+
let res = transform(file.text || '', {
|
|
192
|
+
babelrc: false,
|
|
193
|
+
sourceType: 'module',
|
|
194
|
+
plugins: [
|
|
195
|
+
// babelPluginDeduplicateImports,
|
|
196
|
+
babelPluginJsxTransform,
|
|
197
|
+
removeJsxExpressionContainer,
|
|
198
|
+
],
|
|
199
|
+
// ast: true,
|
|
200
|
+
// code: false,
|
|
201
|
+
filename: 'x.jsx',
|
|
202
|
+
compact: false,
|
|
203
|
+
sourceMaps: false,
|
|
204
|
+
});
|
|
205
|
+
if (res?.code) {
|
|
206
|
+
if (!biome) {
|
|
207
|
+
biome = await Biome.create({
|
|
208
|
+
distribution: Distribution.NODE,
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
let result = biome.formatContent(res.code, {
|
|
212
|
+
filePath: 'example.jsx',
|
|
213
|
+
});
|
|
214
|
+
didFormat = true;
|
|
215
|
+
formatted = result.content;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
catch (e) {
|
|
219
|
+
notifyError(e, 'babel transform and format');
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
// let inputCode = res!.code!
|
|
191
223
|
// let shouldFormat = !tooBig && !file.path.includes('chunks')
|
|
192
224
|
// if (shouldFormat) {
|
|
193
225
|
// spinner.update(`Formatting ${path.relative(out, file.path)}`)
|
|
@@ -206,10 +238,6 @@ export async function bundle({ config, cwd: out = '', watch = false, signal = un
|
|
|
206
238
|
// )}, too big`,
|
|
207
239
|
// )
|
|
208
240
|
// }
|
|
209
|
-
let codeNew = `// @ts-nocheck\n` +
|
|
210
|
-
`/* eslint-disable */\n` +
|
|
211
|
-
doNotEditComment +
|
|
212
|
-
formatted;
|
|
213
241
|
// if (framerWebPages?.length) {
|
|
214
242
|
// codeNew = replaceWebPageIds({
|
|
215
243
|
// code: codeNew,
|
|
@@ -225,14 +253,22 @@ export async function bundle({ config, cwd: out = '', watch = false, signal = un
|
|
|
225
253
|
// logger.log(`${path.resolve(out, file.path)}:${line + 1}`)
|
|
226
254
|
// })
|
|
227
255
|
// }
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
256
|
+
const prefix = `// @ts-nocheck\n` + `/* eslint-disable */\n` + doNotEditComment;
|
|
257
|
+
const codeJsx = prefix + formatted;
|
|
258
|
+
const codeJs = prefix + file.text;
|
|
259
|
+
// if (existing === codeJsx) {
|
|
260
|
+
// continue
|
|
261
|
+
// }
|
|
231
262
|
logger.log(`writing`, path.relative(out, file.path));
|
|
232
|
-
await fs.promises.mkdir(path.dirname(
|
|
263
|
+
await fs.promises.mkdir(path.dirname(resultPathAbsJsx), {
|
|
233
264
|
recursive: true,
|
|
234
265
|
});
|
|
235
|
-
|
|
266
|
+
if (codeJs !== codeJsx || !didFormat) {
|
|
267
|
+
await fs.promises.writeFile(resultPathAbsJs, codeJs, 'utf-8');
|
|
268
|
+
}
|
|
269
|
+
if (didFormat) {
|
|
270
|
+
await fs.promises.writeFile(resultPathAbsJsx, codeJsx, 'utf-8');
|
|
271
|
+
}
|
|
236
272
|
}
|
|
237
273
|
spinner.stop();
|
|
238
274
|
await fs.promises.writeFile(path.resolve(out, '.cursorignore'), `**/*.js\nchunks\n`, 'utf-8');
|
|
@@ -241,7 +277,7 @@ export async function bundle({ config, cwd: out = '', watch = false, signal = un
|
|
|
241
277
|
}
|
|
242
278
|
const packageJson = path.resolve(out, 'package.json');
|
|
243
279
|
await fs.promises.writeFile(packageJson, JSON.stringify({ type: 'module' }), 'utf-8');
|
|
244
|
-
const sema = new Sema(stackblitzDemoExample ? 5 :
|
|
280
|
+
const sema = new Sema(stackblitzDemoExample ? 5 : 6);
|
|
245
281
|
spinner.update('Extracting types');
|
|
246
282
|
logger.log(`using node path`, nodePath);
|
|
247
283
|
let allFonts = [];
|
|
@@ -250,11 +286,15 @@ export async function bundle({ config, cwd: out = '', watch = false, signal = un
|
|
|
250
286
|
await sema.acquire();
|
|
251
287
|
const name = path
|
|
252
288
|
.relative(out, file.path)
|
|
253
|
-
.replace(/\.
|
|
289
|
+
.replace(/\.jsx?$/, '');
|
|
254
290
|
const resultPathAbs = path.resolve(out, file.path);
|
|
255
291
|
if (!components[name]) {
|
|
256
292
|
return;
|
|
257
293
|
}
|
|
294
|
+
if (!fs.existsSync(resultPathAbs)) {
|
|
295
|
+
spinner.error(`cannot extract types for ${name}, missing output file`);
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
258
298
|
logger.log(`extracting types for ${name}`);
|
|
259
299
|
spinner.update(`Extracting types for ${name}`);
|
|
260
300
|
const { propertyControls, fonts } = await extractPropControlsUnsafe(resultPathAbs, name);
|
|
@@ -304,8 +344,12 @@ export async function bundle({ config, cwd: out = '', watch = false, signal = un
|
|
|
304
344
|
getFontsStyles(allFonts);
|
|
305
345
|
await fs.promises.writeFile(path.resolve(out, 'styles.css'), cssString, 'utf-8');
|
|
306
346
|
logFontsUsage(allFonts)
|
|
307
|
-
|
|
347
|
+
?.split('\n')
|
|
308
348
|
.forEach((x) => logger.log(x));
|
|
349
|
+
const jsxFiles = buildResult.outputFiles
|
|
350
|
+
.filter((x) => x.path.endsWith('.js') &&
|
|
351
|
+
fs.existsSync(x.path.replace(/\.js$/, '.jsx')))
|
|
352
|
+
.map((x) => x.path.replace(/\.js$/, '.jsx'));
|
|
309
353
|
const outFiles = buildResult.outputFiles
|
|
310
354
|
.map((x) => path.resolve(out, x.path))
|
|
311
355
|
.concat([
|
|
@@ -314,8 +358,14 @@ export async function bundle({ config, cwd: out = '', watch = false, signal = un
|
|
|
314
358
|
path.resolve(out, '.cursorignore'),
|
|
315
359
|
path.resolve(out, 'styles.css'),
|
|
316
360
|
])
|
|
317
|
-
.concat(
|
|
318
|
-
|
|
361
|
+
.concat(jsxFiles)
|
|
362
|
+
.concat(buildResult.outputFiles.map((x) => path.resolve(out, x.path.replace(/\.jsx?$/, '.d.ts'))));
|
|
363
|
+
const filesToDelete = prevFiles
|
|
364
|
+
.filter((x) => !outFiles.includes(x))
|
|
365
|
+
.concat(buildResult.outputFiles
|
|
366
|
+
.map((x) => x.path)
|
|
367
|
+
.filter((js) => js.endsWith('.js') &&
|
|
368
|
+
jsxFiles.some((x) => x.startsWith(js))));
|
|
319
369
|
for (let file of filesToDelete) {
|
|
320
370
|
logger.log('deleting', path.relative(out, file));
|
|
321
371
|
try {
|
|
@@ -436,7 +486,7 @@ export function resolvePackage({ cwd, pkg }) {
|
|
|
436
486
|
}, (error, stdout, stderr) => {
|
|
437
487
|
if (error) {
|
|
438
488
|
logger.log(stderr);
|
|
439
|
-
reject(new Error(
|
|
489
|
+
reject(new Error(`${pkg} is not installed in your project`));
|
|
440
490
|
return;
|
|
441
491
|
}
|
|
442
492
|
const version = stdout.trim();
|
|
@@ -873,7 +923,7 @@ function splitOnce(str, separator) {
|
|
|
873
923
|
return [str.slice(0, index), str.slice(index + 1)];
|
|
874
924
|
}
|
|
875
925
|
export function componentCamelCase(str) {
|
|
876
|
-
str = str?.replace(/\.
|
|
926
|
+
str = str?.replace(/\.jsx?$/, '');
|
|
877
927
|
if (!str) {
|
|
878
928
|
return 'FramerComponent';
|
|
879
929
|
}
|
|
@@ -947,6 +997,8 @@ async function recursiveReaddir(dir) {
|
|
|
947
997
|
return files.flat();
|
|
948
998
|
}
|
|
949
999
|
function indentWithTabs(str, tabs) {
|
|
1000
|
+
if (!str)
|
|
1001
|
+
return '';
|
|
950
1002
|
return str
|
|
951
1003
|
.split('\n')
|
|
952
1004
|
.map((line, i) => (!i ? line : tabs + line))
|
|
@@ -956,14 +1008,14 @@ export async function createExampleComponentCode({ outDir, config, }) {
|
|
|
956
1008
|
const outDirForExample = path.posix
|
|
957
1009
|
.relative(process.cwd(), outDir)
|
|
958
1010
|
.replace(/^src\//, ''); // remove src so file works inside src
|
|
959
|
-
const instances = config?.componentInstancesInIndexPage
|
|
1011
|
+
const instances = config?.componentInstancesInIndexPage?.sort((a, b) => {
|
|
960
1012
|
// Order first by nodeDepth (lower is better)
|
|
961
1013
|
return a.nodeDepth - b.nodeDepth || a.pageOrdering - b.pageOrdering;
|
|
962
1014
|
});
|
|
963
|
-
const imports = instances
|
|
1015
|
+
const imports = instances?.map((exampleComponent) => {
|
|
964
1016
|
return `import ${componentCamelCase(exampleComponent?.componentPathSlug)} from './${outDirForExample}/${exampleComponent?.componentPathSlug}'`;
|
|
965
1017
|
});
|
|
966
|
-
const jsx = instances
|
|
1018
|
+
const jsx = instances?.map((exampleComponent) => {
|
|
967
1019
|
let propStr = '';
|
|
968
1020
|
for (let [key, value] of Object.entries(exampleComponent.controls || {})) {
|
|
969
1021
|
if (key === 'variant') {
|
|
@@ -974,13 +1026,11 @@ export async function createExampleComponentCode({ outDir, config, }) {
|
|
|
974
1026
|
}
|
|
975
1027
|
// TODO get property controls to render enums much better? maybe do this in plugin instead
|
|
976
1028
|
propStr += '\n';
|
|
977
|
-
propStr += `
|
|
1029
|
+
propStr += ` ${key}={${JSON.stringify(value)}}`;
|
|
978
1030
|
}
|
|
979
1031
|
if (propStr)
|
|
980
1032
|
propStr += '\n';
|
|
981
|
-
const responsiveComponent =
|
|
982
|
-
<${componentCamelCase(exampleComponent?.componentPathSlug)}.Responsive${propStr}/>
|
|
983
|
-
`;
|
|
1033
|
+
const responsiveComponent = `<${componentCamelCase(exampleComponent?.componentPathSlug)}.Responsive${propStr}/>`;
|
|
984
1034
|
return responsiveComponent;
|
|
985
1035
|
});
|
|
986
1036
|
let containerClasses = '';
|
|
@@ -991,14 +1041,14 @@ export async function createExampleComponentCode({ outDir, config, }) {
|
|
|
991
1041
|
const exampleCode = dedent `
|
|
992
1042
|
import './${outDirForExample}/styles.css'
|
|
993
1043
|
|
|
994
|
-
${indentWithTabs(imports
|
|
1044
|
+
${indentWithTabs(imports?.join('\n'), '')}
|
|
995
1045
|
|
|
996
1046
|
export default function App() {
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1047
|
+
return (
|
|
1048
|
+
<div className='flex flex-col items-center gap-3 ${containerClasses}'>
|
|
1049
|
+
${indentWithTabs(jsx?.join('\n'), ' ')}
|
|
1050
|
+
</div>
|
|
1051
|
+
);
|
|
1002
1052
|
};
|
|
1003
1053
|
`;
|
|
1004
1054
|
return {
|