@builder.io/sdk-qwik 0.7.1-4 → 0.7.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/lib/browser/index.qwik.cjs +4302 -0
- package/lib/browser/index.qwik.mjs +4302 -0
- package/lib/edge/index.qwik.cjs +7533 -0
- package/lib/edge/index.qwik.mjs +7533 -0
- package/lib/index.qwik.js +3263 -15
- package/lib/node/index.qwik.cjs +4403 -0
- package/lib/node/index.qwik.mjs +4403 -0
- package/lib/node/node-evaluate-15fe5e77.js +10 -0
- package/lib/node/node-evaluate-fc9f27d1.cjs +8 -0
- package/package.json +39 -26
- package/types/src/constants/sdk-version.d.ts +1 -1
- package/types/src/functions/evaluate/choose-eval.d.ts +6 -0
- package/types/src/functions/evaluate/evaluate.d.ts +1 -5
- package/types/src/functions/evaluate/helpers.d.ts +7 -1
- package/types/src/functions/evaluate/node-runtime/index.d.ts +1 -1
- package/types/src/functions/evaluate/node-runtime/node-runtime.d.ts +1 -1
- package/types/src/functions/evaluate/node-runtime/safeDynamicRequire.d.ts +7 -0
- package/types/src/functions/evaluate/placeholder-runtime.d.ts +2 -1
- package/types/src/functions/get-content/types.d.ts +94 -3
- package/types/src/functions/is-node-runtime.d.ts +4 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const node_module = require("node:module");
|
|
3
|
+
const noop = () => null;
|
|
4
|
+
exports.safeDynamicRequire = noop;
|
|
5
|
+
try {
|
|
6
|
+
exports.safeDynamicRequire = node_module.createRequire(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : document.currentScript && document.currentScript.src || new URL("node-evaluate-fc9f27d1.cjs", document.baseURI).href);
|
|
7
|
+
} catch (error) {
|
|
8
|
+
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@builder.io/sdk-qwik",
|
|
3
|
-
"version": "0.7.1-
|
|
3
|
+
"version": "0.7.1-5",
|
|
4
4
|
"description": "Builder.io Qwik SDK",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./lib/index.qwik.
|
|
7
|
-
"module": "./lib/index.qwik.
|
|
8
|
-
"qwik": "./lib/index.qwik.
|
|
6
|
+
"main": "./lib/edge/index.qwik.cjs",
|
|
7
|
+
"module": "./lib/edge/index.qwik.mjs",
|
|
8
|
+
"qwik": "./lib/browser/index.qwik.mjs",
|
|
9
9
|
"types": "./types/src/index.d.ts",
|
|
10
10
|
"files": [
|
|
11
11
|
"README.md",
|
|
@@ -18,68 +18,85 @@
|
|
|
18
18
|
".": {
|
|
19
19
|
"node": {
|
|
20
20
|
"types": "./types/src/index.d.ts",
|
|
21
|
-
"import": "./lib/index.qwik.
|
|
21
|
+
"import": "./lib/node/index.qwik.mjs",
|
|
22
|
+
"require": "./lib/node/index.qwik.cjs"
|
|
22
23
|
},
|
|
23
24
|
"browser": {
|
|
24
25
|
"types": "./types/src/index.d.ts",
|
|
25
|
-
"import": "./lib/index.qwik.
|
|
26
|
+
"import": "./lib/browser/index.qwik.mjs",
|
|
27
|
+
"require": "./lib/browser/index.qwik.cjs"
|
|
26
28
|
},
|
|
27
29
|
"edge-routine": {
|
|
28
30
|
"types": "./types/src/index.d.ts",
|
|
29
|
-
"import": "./lib/index.qwik.
|
|
31
|
+
"import": "./lib/edge/index.qwik.mjs",
|
|
32
|
+
"require": "./lib/edge/index.qwik.cjs"
|
|
30
33
|
},
|
|
31
34
|
"workerd": {
|
|
32
35
|
"types": "./types/src/index.d.ts",
|
|
33
|
-
"import": "./lib/index.qwik.
|
|
36
|
+
"import": "./lib/edge/index.qwik.mjs",
|
|
37
|
+
"require": "./lib/edge/index.qwik.cjs"
|
|
34
38
|
},
|
|
35
39
|
"deno": {
|
|
36
40
|
"types": "./types/src/index.d.ts",
|
|
37
|
-
"import": "./lib/index.qwik.
|
|
41
|
+
"import": "./lib/edge/index.qwik.mjs",
|
|
42
|
+
"require": "./lib/edge/index.qwik.cjs"
|
|
38
43
|
},
|
|
39
44
|
"lagon": {
|
|
40
45
|
"types": "./types/src/index.d.ts",
|
|
41
|
-
"import": "./lib/index.qwik.
|
|
46
|
+
"import": "./lib/edge/index.qwik.mjs",
|
|
47
|
+
"require": "./lib/edge/index.qwik.cjs"
|
|
42
48
|
},
|
|
43
49
|
"netlify": {
|
|
44
50
|
"types": "./types/src/index.d.ts",
|
|
45
|
-
"import": "./lib/index.qwik.
|
|
51
|
+
"import": "./lib/edge/index.qwik.mjs",
|
|
52
|
+
"require": "./lib/edge/index.qwik.cjs"
|
|
46
53
|
},
|
|
47
54
|
"edge-light": {
|
|
48
55
|
"types": "./types/src/index.d.ts",
|
|
49
|
-
"import": "./lib/index.qwik.
|
|
56
|
+
"import": "./lib/edge/index.qwik.mjs",
|
|
57
|
+
"require": "./lib/edge/index.qwik.cjs"
|
|
50
58
|
},
|
|
51
59
|
"bun": {
|
|
52
60
|
"types": "./types/src/index.d.ts",
|
|
53
|
-
"import": "./lib/index.qwik.
|
|
61
|
+
"import": "./lib/edge/index.qwik.mjs",
|
|
62
|
+
"require": "./lib/edge/index.qwik.cjs"
|
|
54
63
|
},
|
|
55
64
|
"electron": {
|
|
56
65
|
"types": "./types/src/index.d.ts",
|
|
57
|
-
"import": "./lib/index.qwik.
|
|
66
|
+
"import": "./lib/node/index.qwik.mjs",
|
|
67
|
+
"require": "./lib/node/index.qwik.cjs"
|
|
58
68
|
},
|
|
59
69
|
"default": {
|
|
60
70
|
"types": "./types/src/index.d.ts",
|
|
61
|
-
"import": "./lib/index.qwik.
|
|
71
|
+
"import": "./lib/browser/index.qwik.mjs",
|
|
72
|
+
"require": "./lib/browser/index.qwik.cjs"
|
|
62
73
|
}
|
|
63
74
|
},
|
|
64
75
|
"./edge": {
|
|
65
76
|
"types": "./types/src/index.d.ts",
|
|
66
|
-
"import": "./lib/index.qwik.
|
|
77
|
+
"import": "./lib/edge/index.qwik.mjs",
|
|
78
|
+
"require": "./lib/edge/index.qwik.cjs"
|
|
67
79
|
},
|
|
68
80
|
"./node": {
|
|
69
81
|
"types": "./types/src/index.d.ts",
|
|
70
|
-
"import": "./lib/index.qwik.
|
|
82
|
+
"import": "./lib/node/index.qwik.mjs",
|
|
83
|
+
"require": "./lib/node/index.qwik.cjs"
|
|
71
84
|
},
|
|
72
85
|
"./browser": {
|
|
73
86
|
"types": "./types/src/index.d.ts",
|
|
74
|
-
"import": "./lib/index.qwik.
|
|
87
|
+
"import": "./lib/browser/index.qwik.mjs",
|
|
88
|
+
"require": "./lib/browser/index.qwik.cjs"
|
|
75
89
|
}
|
|
76
90
|
},
|
|
77
91
|
"scripts": {
|
|
78
92
|
"release": "npm publish",
|
|
79
93
|
"typecheck": "tsc --noEmit",
|
|
80
94
|
"tsc": "tsc",
|
|
81
|
-
"build": "nx run-many -p @builder.io/sdk-qwik -t tsc build:
|
|
82
|
-
"build:one": "vite build --mode lib"
|
|
95
|
+
"build": "nx run-many -p @builder.io/sdk-qwik -t tsc build:node build:edge build:browser",
|
|
96
|
+
"build:one": "vite build --mode lib",
|
|
97
|
+
"build:node": "SDK_ENV=node yarn build:one",
|
|
98
|
+
"build:edge": "SDK_ENV=edge yarn build:one",
|
|
99
|
+
"build:browser": "SDK_ENV=browser yarn build:one"
|
|
83
100
|
},
|
|
84
101
|
"devDependencies": {
|
|
85
102
|
"@builder.io/qwik": "^1.2.6",
|
|
@@ -88,15 +105,11 @@
|
|
|
88
105
|
"nx": "^16.6.0",
|
|
89
106
|
"nx-cloud": "^16.2.0",
|
|
90
107
|
"typescript": "^5.1.6",
|
|
91
|
-
"vite": "^4.3.2"
|
|
92
|
-
"vite-plugin-top-level-await": "^1.3.1",
|
|
93
|
-
"vite-tsconfig-paths": "^4.2.1"
|
|
94
|
-
},
|
|
95
|
-
"dependencies": {
|
|
96
|
-
"isolated-vm": "^4.6.0"
|
|
108
|
+
"vite": "^4.3.2"
|
|
97
109
|
},
|
|
98
110
|
"peerDependencies": {
|
|
99
111
|
"@builder.io/qwik": ">=1.0.0",
|
|
112
|
+
"isolated-vm": "^4.6.0",
|
|
100
113
|
"undici": "^5.14.0"
|
|
101
114
|
},
|
|
102
115
|
"nx": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "0.7.1-
|
|
1
|
+
export declare const SDK_VERSION = "0.7.1-4";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ExecutorArgs } from './helpers.js';
|
|
2
|
+
/**
|
|
3
|
+
* Even though we have separate runtimes for browser/node/edge, sometimes frameworks will
|
|
4
|
+
* end up sending the server runtime code to the browser (most notably in dev mode).
|
|
5
|
+
*/
|
|
6
|
+
export declare const chooseBrowserOrServerEval: (args: ExecutorArgs) => any;
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export type EvaluatorArgs = Omit<ExecutorArgs, 'builder' | 'event'> & {
|
|
3
|
-
event?: Event;
|
|
4
|
-
isExpression?: boolean;
|
|
5
|
-
};
|
|
1
|
+
import type { EvaluatorArgs } from './helpers.js';
|
|
6
2
|
export declare function evaluate({ code, context, localState, rootState, rootSetState, event, isExpression }: EvaluatorArgs): any;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { BuilderContextInterface, BuilderRenderState } from '../../context/types.js';
|
|
2
|
-
import
|
|
2
|
+
import { getUserAttributes } from '../track/helpers.js';
|
|
3
|
+
export type EvaluatorArgs = Omit<ExecutorArgs, 'builder' | 'event'> & {
|
|
4
|
+
event?: Event;
|
|
5
|
+
isExpression?: boolean;
|
|
6
|
+
};
|
|
3
7
|
export type BuilderGlobals = {
|
|
4
8
|
isEditing: boolean | undefined;
|
|
5
9
|
isBrowser: boolean | undefined;
|
|
@@ -16,3 +20,5 @@ export type FunctionArguments = ReturnType<typeof getFunctionArguments>;
|
|
|
16
20
|
export declare const getFunctionArguments: ({ builder, context, event, state }: Pick<ExecutorArgs, "context" | "builder" | "event"> & {
|
|
17
21
|
state: BuilderRenderState;
|
|
18
22
|
}) => [string, Event | BuilderRenderState | import("../../context/types.js").BuilderRenderContext | BuilderGlobals | undefined][];
|
|
23
|
+
export declare const getBuilderGlobals: () => BuilderGlobals;
|
|
24
|
+
export declare const parseCode: (code: string, { isExpression }: Pick<EvaluatorArgs, 'isExpression'>) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { evaluator } from './node-runtime.js';
|
|
1
|
+
export { runInNode as evaluator } from './node-runtime.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ExecutorArgs } from '../helpers.js';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const runInNode: ({ code, builder, context, event, localState, rootSetState, rootState }: ExecutorArgs) => any;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* We use the less hacky, but more modern `createRequire` API for Qwik. That's because the `eval('require')` trick does
|
|
3
|
+
* not work with Qwik.
|
|
4
|
+
*/
|
|
5
|
+
/// <reference types="node" />
|
|
6
|
+
/// <reference types="react-native" />
|
|
7
|
+
export declare let safeDynamicRequire: typeof require;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ExecutorArgs } from './helpers.js';
|
|
2
|
+
export declare const evaluator: (_args: ExecutorArgs) => never;
|
|
@@ -5,11 +5,42 @@ export interface GetContentOptions {
|
|
|
5
5
|
apiKey: string;
|
|
6
6
|
/** Number of items to fetch. Default is 1 */
|
|
7
7
|
limit?: number;
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Use to specify an offset for pagination of results. The default is 0.
|
|
10
|
+
*/
|
|
11
|
+
offset?: number;
|
|
12
|
+
/**
|
|
13
|
+
* User attribute key value pairs to be used for targeting
|
|
14
|
+
* https://www.builder.io/c/docs/custom-targeting-attributes
|
|
15
|
+
*
|
|
16
|
+
* e.g.
|
|
17
|
+
* ```js
|
|
18
|
+
* userAttributes: {
|
|
19
|
+
* urlPath: '/',
|
|
20
|
+
* returnVisitor: true,
|
|
21
|
+
* device: 'mobile'
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
9
25
|
userAttributes?: (Record<string, string> & {
|
|
10
26
|
urlPath?: string;
|
|
11
27
|
}) | null;
|
|
12
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Mongodb style query of your data. E.g.:
|
|
30
|
+
*
|
|
31
|
+
* ```js
|
|
32
|
+
* query: {
|
|
33
|
+
* id: 'abc123',
|
|
34
|
+
* data: {
|
|
35
|
+
* myCustomField: { $gt: 20 },
|
|
36
|
+
* }
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* See more info on MongoDB's query operators and format.
|
|
41
|
+
*
|
|
42
|
+
* @see {@link https://docs.mongodb.com/manual/reference/operator/query/}
|
|
43
|
+
*/
|
|
13
44
|
query?: Record<string, any>;
|
|
14
45
|
/**
|
|
15
46
|
* Any other API options.
|
|
@@ -30,7 +61,7 @@ export interface GetContentOptions {
|
|
|
30
61
|
*/
|
|
31
62
|
canTrack?: boolean;
|
|
32
63
|
/**
|
|
33
|
-
* Include references in the response. Defaults to `true`.
|
|
64
|
+
* Include content of references in the response. Defaults to `true`.
|
|
34
65
|
* @deprecated use `enrich` instead
|
|
35
66
|
*/
|
|
36
67
|
includeRefs?: boolean;
|
|
@@ -48,4 +79,64 @@ export interface GetContentOptions {
|
|
|
48
79
|
* Defaults to `v3`.
|
|
49
80
|
*/
|
|
50
81
|
apiVersion?: 'v2' | 'v3';
|
|
82
|
+
/**
|
|
83
|
+
* Only include these fields.
|
|
84
|
+
* Note: 'omit' takes precedence over 'fields'
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```
|
|
88
|
+
* fields: 'id, name, data.customField'
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
fields?: string;
|
|
92
|
+
/**
|
|
93
|
+
* Omit only these fields.
|
|
94
|
+
* Note: 'omit' takes precedence over 'fields'
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```
|
|
98
|
+
* omit: 'data.bigField,data.blocks'
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
omit?: string;
|
|
102
|
+
/**
|
|
103
|
+
* Seconds to cache content. Sets the max-age of the cache-control header
|
|
104
|
+
* response header.
|
|
105
|
+
*
|
|
106
|
+
* Use a higher value for better performance, lower for content that will change more frequently
|
|
107
|
+
*
|
|
108
|
+
* @see {@link https://www.builder.io/c/docs/query-api#__next:~:text=%26includeRefs%3Dtrue-,cacheSeconds,-No}
|
|
109
|
+
*/
|
|
110
|
+
cacheSeconds?: number;
|
|
111
|
+
/**
|
|
112
|
+
* Builder.io uses stale-while-revalidate caching at the CDN level. This means we always serve
|
|
113
|
+
* from edge cache and update caches in the background for maximum possible performance. This also
|
|
114
|
+
* means that the more frequently content is requested, the more fresh it will be. The longest we
|
|
115
|
+
* will ever hold something in stale cache is 1 day by default, and you can set this to be shorter
|
|
116
|
+
* yourself as well. We suggest keeping this high unless you have content that must change rapidly
|
|
117
|
+
* and gets very little traffic.
|
|
118
|
+
*
|
|
119
|
+
* @see {@link https://www.fastly.com/blog/prevent-application-network-instability-serve-stale-content}
|
|
120
|
+
*/
|
|
121
|
+
staleCacheSeconds?: number;
|
|
122
|
+
/**
|
|
123
|
+
* Property to order results by.
|
|
124
|
+
* Use 1 for ascending and -1 for descending.
|
|
125
|
+
*
|
|
126
|
+
* The key is what you're sorting on, so the following example sorts by createdDate
|
|
127
|
+
* and because the value is 1, the sort is ascending.
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* ```
|
|
131
|
+
* createdDate: 1
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
134
|
+
sort?: {
|
|
135
|
+
[key: string]: 1 | -1;
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* Include content entries in a response that are still in
|
|
139
|
+
* draft mode and un-archived. Default is false.
|
|
140
|
+
*/
|
|
141
|
+
includeUnpublished?: boolean;
|
|
51
142
|
}
|