@nuxt/scripts 0.1.5 → 0.1.7
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/client/200.html +7 -6
- package/dist/client/404.html +7 -6
- package/dist/client/_nuxt/BG_OyJVq.js +1 -0
- package/dist/client/_nuxt/{YkgnKQjM.js → BVIyUFBp.js} +3 -3
- package/dist/client/_nuxt/{C6qP6ksw.js → CV_REd8b.js} +1 -1
- package/dist/client/_nuxt/{D2oMNJSZ.js → D1ek2jBE.js} +1 -1
- package/dist/client/_nuxt/DnLUQrgA.js +1 -0
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/b5db882d-dfbd-4edf-87b5-38d1f0a456e3.json +1 -0
- package/dist/client/_nuxt/{BBafEUG8.js → vqIOxd68.js} +1 -1
- package/dist/client/index.html +7 -6
- package/dist/module.d.mts +13 -67
- package/dist/module.d.ts +13 -67
- package/dist/module.json +1 -1
- package/dist/module.mjs +185 -120
- package/dist/runtime/composables/useScript.mjs +3 -2
- package/dist/runtime/composables/validateScriptInputSchema.d.ts +2 -7
- package/dist/runtime/composables/validateScriptInputSchema.mjs +9 -7
- package/dist/runtime/registry/cloudflare-web-analytics.mjs +3 -7
- package/dist/runtime/registry/confetti.d.ts +9 -1
- package/dist/runtime/registry/confetti.mjs +8 -5
- package/dist/runtime/registry/facebook-pixel.d.ts +1 -1
- package/dist/runtime/registry/facebook-pixel.mjs +4 -7
- package/dist/runtime/registry/fathom-analytics.d.ts +1 -2
- package/dist/runtime/registry/fathom-analytics.mjs +4 -7
- package/dist/runtime/registry/hotjar.d.ts +4 -5
- package/dist/runtime/registry/hotjar.mjs +4 -6
- package/dist/runtime/registry/intercom.d.ts +5 -5
- package/dist/runtime/registry/intercom.mjs +4 -6
- package/dist/runtime/registry/npm.d.ts +12 -0
- package/dist/runtime/registry/npm.mjs +18 -0
- package/dist/runtime/registry/segment.d.ts +4 -5
- package/dist/runtime/registry/segment.mjs +3 -6
- package/dist/runtime/types.d.ts +32 -3
- package/package.json +5 -5
- package/dist/client/_nuxt/CkMwVfOK.js +0 -1
- package/dist/client/_nuxt/builds/meta/72c1a85e-b70c-4e27-93ec-d6316f40b143.json +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Input } from 'valibot';
|
|
2
|
-
import type { NuxtUseScriptOptions } from '#nuxt-scripts';
|
|
3
|
-
declare const IntercomOptions: import("valibot").ObjectSchema<{
|
|
2
|
+
import type { NuxtUseScriptOptions, ScriptDynamicSrcInput } from '#nuxt-scripts';
|
|
3
|
+
export declare const IntercomOptions: import("valibot").ObjectSchema<{
|
|
4
4
|
app_id: import("valibot").StringSchema<string>;
|
|
5
5
|
api_base: import("valibot").OptionalSchema<import("valibot").UnionSchema<(import("valibot").LiteralSchema<"https://api-iam.intercom.io", "https://api-iam.intercom.io"> | import("valibot").LiteralSchema<"https://api-iam.eu.intercom.io", "https://api-iam.eu.intercom.io"> | import("valibot").LiteralSchema<"https://api-iam.au.intercom.io", "https://api-iam.au.intercom.io">)[], "https://api-iam.intercom.io" | "https://api-iam.eu.intercom.io" | "https://api-iam.au.intercom.io">, undefined, "https://api-iam.intercom.io" | "https://api-iam.eu.intercom.io" | "https://api-iam.au.intercom.io" | undefined>;
|
|
6
6
|
name: import("valibot").OptionalSchema<import("valibot").StringSchema<string>, undefined, string | undefined>;
|
|
@@ -19,13 +19,13 @@ declare const IntercomOptions: import("valibot").ObjectSchema<{
|
|
|
19
19
|
horizontal_padding?: number | undefined;
|
|
20
20
|
vertical_padding?: number | undefined;
|
|
21
21
|
}>;
|
|
22
|
+
export type IntercomInput = ScriptDynamicSrcInput<typeof IntercomOptions>;
|
|
22
23
|
export interface IntercomApi {
|
|
23
24
|
Intercom: ((event: 'boot', data?: Input<typeof IntercomOptions>) => void) & ((event: 'shutdown') => void) & ((event: 'update', options?: Input<typeof IntercomOptions>) => void) & ((event: 'hide') => void) & ((event: 'show') => void) & ((event: 'showSpace', spaceName: 'home' | 'messages' | 'help' | 'news' | 'tasks' | 'tickets' | string) => void) & ((event: 'showMessages') => void) & ((event: 'showNewMessage', content?: string) => void) & ((event: 'onHide', fn: () => void) => void) & ((event: 'onShow', fn: () => void) => void) & ((event: 'onUnreadCountChange', fn: () => void) => void) & ((event: 'trackEvent', eventName: string, metadata?: Record<string, any>) => void) & ((event: 'getVisitorId') => Promise<string>) & ((event: 'startTour', tourId: string | number) => void) & ((event: 'showArticle', articleId: string | number) => void) & ((event: 'showNews', newsItemId: string | number) => void) & ((event: 'startSurvey', surveyId: string | number) => void) & ((event: 'startChecklist', checklistId: string | number) => void) & ((event: 'showTicket', ticketId: string | number) => void) & ((event: 'showConversation', conversationId: string | number) => void) & ((event: 'onUserEmailSupplied', fn: () => void) => void) & ((event: string, ...params: any[]) => void);
|
|
24
25
|
}
|
|
25
26
|
declare global {
|
|
26
27
|
interface Window extends IntercomApi {
|
|
27
|
-
intercomSettings?:
|
|
28
|
+
intercomSettings?: IntercomInput;
|
|
28
29
|
}
|
|
29
30
|
}
|
|
30
|
-
export declare function useScriptIntercom<T extends IntercomApi>(options?:
|
|
31
|
-
export {};
|
|
31
|
+
export declare function useScriptIntercom<T extends IntercomApi>(options?: IntercomInput, _scriptOptions?: Omit<NuxtUseScriptOptions<T>, 'beforeInit' | 'use'>): any;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { literal, number, object, optional, string, union } from "valibot";
|
|
2
|
+
import { joinURL } from "ufo";
|
|
2
3
|
import { useScript, validateScriptInputSchema } from "#imports";
|
|
3
|
-
const IntercomOptions = object({
|
|
4
|
+
export const IntercomOptions = object({
|
|
4
5
|
app_id: string(),
|
|
5
6
|
api_base: optional(union([literal("https://api-iam.intercom.io"), literal("https://api-iam.eu.intercom.io"), literal("https://api-iam.au.intercom.io")])),
|
|
6
7
|
name: optional(string()),
|
|
@@ -14,18 +15,15 @@ const IntercomOptions = object({
|
|
|
14
15
|
export function useScriptIntercom(options, _scriptOptions) {
|
|
15
16
|
const scriptOptions = _scriptOptions || {};
|
|
16
17
|
scriptOptions.beforeInit = () => {
|
|
17
|
-
validateScriptInputSchema(IntercomOptions, options);
|
|
18
|
+
import.meta.dev && validateScriptInputSchema(IntercomOptions, options);
|
|
18
19
|
if (import.meta.client)
|
|
19
20
|
window.intercomSettings = options;
|
|
20
21
|
};
|
|
21
22
|
return useScript({
|
|
22
23
|
key: "intercom",
|
|
23
|
-
src: `https://widget.intercom.io/widget
|
|
24
|
-
defer: true
|
|
24
|
+
src: options?.src || joinURL(`https://widget.intercom.io/widget`, options?.app_id || "")
|
|
25
25
|
}, {
|
|
26
|
-
trigger: "onNuxtReady",
|
|
27
26
|
...scriptOptions,
|
|
28
|
-
assetStrategy: "bundle",
|
|
29
27
|
use() {
|
|
30
28
|
return { Intercom: window.Intercom };
|
|
31
29
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { NuxtUseScriptOptions, ScriptDynamicSrcInput } from '#nuxt-scripts';
|
|
2
|
+
export declare const NpmOptions: import("valibot").ObjectSchema<{
|
|
3
|
+
packageName: import("valibot").StringSchema<string>;
|
|
4
|
+
file: import("valibot").OptionalSchema<import("valibot").StringSchema<string>, undefined, string | undefined>;
|
|
5
|
+
version: import("valibot").OptionalSchema<import("valibot").StringSchema<string>, undefined, string | undefined>;
|
|
6
|
+
}, undefined, {
|
|
7
|
+
packageName: string;
|
|
8
|
+
file?: string | undefined;
|
|
9
|
+
version?: string | undefined;
|
|
10
|
+
}>;
|
|
11
|
+
export type NpmInput = ScriptDynamicSrcInput<typeof NpmOptions>;
|
|
12
|
+
export declare function useScriptNpm<T>(options: NpmInput, _scriptOptions?: NuxtUseScriptOptions<T>): any;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { object, optional, string } from "valibot";
|
|
2
|
+
import { withBase } from "ufo";
|
|
3
|
+
import { useScript, validateScriptInputSchema } from "#imports";
|
|
4
|
+
export const NpmOptions = object({
|
|
5
|
+
packageName: string(),
|
|
6
|
+
file: optional(string()),
|
|
7
|
+
version: optional(string())
|
|
8
|
+
});
|
|
9
|
+
export function useScriptNpm(options, _scriptOptions) {
|
|
10
|
+
const scriptOptions = _scriptOptions || {};
|
|
11
|
+
scriptOptions.beforeInit = () => {
|
|
12
|
+
import.meta.dev && validateScriptInputSchema(NpmOptions, options);
|
|
13
|
+
};
|
|
14
|
+
return useScript({
|
|
15
|
+
key: options.packageName,
|
|
16
|
+
src: options.src || withBase(options.file || "", `https://unpkg.com/${options?.packageName}@${options.version || "latest"}`)
|
|
17
|
+
}, scriptOptions);
|
|
18
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
declare const SegmentOptions: import("valibot").ObjectSchema<{
|
|
1
|
+
import type { NuxtUseScriptOptions, ScriptDynamicSrcInput } from '#nuxt-scripts';
|
|
2
|
+
export declare const SegmentOptions: import("valibot").ObjectSchema<{
|
|
4
3
|
writeKey: import("valibot").StringSchema<string>;
|
|
5
4
|
analyticsKey: import("valibot").OptionalSchema<import("valibot").StringSchema<string>, undefined, string | undefined>;
|
|
6
5
|
}, undefined, {
|
|
7
6
|
writeKey: string;
|
|
8
7
|
analyticsKey?: string | undefined;
|
|
9
8
|
}>;
|
|
9
|
+
export type SegmentInput = ScriptDynamicSrcInput<typeof SegmentOptions>;
|
|
10
10
|
export interface SegmentApi {
|
|
11
11
|
analytics: {
|
|
12
12
|
track: (event: string, properties?: Record<string, any>) => void;
|
|
@@ -21,5 +21,4 @@ declare global {
|
|
|
21
21
|
interface Window extends SegmentApi {
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
export declare function useScriptSegment<T extends SegmentApi>(options?:
|
|
25
|
-
export {};
|
|
24
|
+
export declare function useScriptSegment<T extends SegmentApi>(options?: SegmentInput, _scriptOptions?: Omit<NuxtUseScriptOptions<T>, 'beforeInit' | 'use'>): any;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { object, optional, string } from "valibot";
|
|
2
2
|
import { useScript, validateScriptInputSchema } from "#imports";
|
|
3
|
-
const SegmentOptions = object({
|
|
3
|
+
export const SegmentOptions = object({
|
|
4
4
|
writeKey: string(),
|
|
5
5
|
analyticsKey: optional(string())
|
|
6
6
|
});
|
|
7
7
|
export function useScriptSegment(options, _scriptOptions) {
|
|
8
8
|
const scriptOptions = _scriptOptions || {};
|
|
9
9
|
scriptOptions.beforeInit = () => {
|
|
10
|
-
validateScriptInputSchema(SegmentOptions, options);
|
|
10
|
+
import.meta.dev && validateScriptInputSchema(SegmentOptions, options);
|
|
11
11
|
if (import.meta.client) {
|
|
12
12
|
window.analytics = window.analytics || [];
|
|
13
13
|
window.analytics.methods = ["track", "page", "identify", "group", "alias", "reset"];
|
|
@@ -30,12 +30,9 @@ export function useScriptSegment(options, _scriptOptions) {
|
|
|
30
30
|
return useScript({
|
|
31
31
|
"key": "segment",
|
|
32
32
|
"data-global-segment-analytics-key": analyticsKey,
|
|
33
|
-
"src": `https://cdn.segment.com/analytics.js/v1/${options?.writeKey}/analytics.min.js
|
|
34
|
-
"defer": true
|
|
33
|
+
"src": options?.src || `https://cdn.segment.com/analytics.js/v1/${options?.writeKey}/analytics.min.js`
|
|
35
34
|
}, {
|
|
36
|
-
trigger: "onNuxtReady",
|
|
37
35
|
...scriptOptions,
|
|
38
|
-
assetStrategy: "bundle",
|
|
39
36
|
use() {
|
|
40
37
|
return { analytics: window[analyticsKey] };
|
|
41
38
|
}
|
package/dist/runtime/types.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import type { UseScriptOptions } from '@unhead/schema';
|
|
2
2
|
import type { UseScriptInput, VueScriptInstance } from '@unhead/vue';
|
|
3
3
|
import type { ComputedRef, Ref } from 'vue';
|
|
4
|
+
import type { Input, ObjectSchema } from 'valibot';
|
|
5
|
+
import type { Import } from 'unimport';
|
|
6
|
+
import type { CloudflareWebAnalyticsOptions } from '~/src/runtime/registry/cloudflare-web-analytics';
|
|
7
|
+
import type { FacebookPixelOptions } from '~/src/runtime/registry/facebook-pixel';
|
|
8
|
+
import type { FathomAnalyticsOptions } from '~/src/runtime/registry/fathom-analytics';
|
|
9
|
+
import type { HotjarOptions } from '~/src/runtime/registry/hotjar';
|
|
10
|
+
import type { SegmentOptions } from '~/src/runtime/registry/segment';
|
|
11
|
+
import type { IntercomOptions } from '~/src/runtime/registry/intercom';
|
|
4
12
|
export type NuxtUseScriptOptions<T = any> = Omit<UseScriptOptions<T>, 'trigger'> & {
|
|
5
13
|
/**
|
|
6
14
|
* The trigger to load the script:
|
|
@@ -13,8 +21,10 @@ export type NuxtUseScriptOptions<T = any> = Omit<UseScriptOptions<T>, 'trigger'>
|
|
|
13
21
|
* Should the script be bundled as an asset and loaded from your server. This is useful for improving the
|
|
14
22
|
* performance by avoiding the extra DNS lookup and reducing the number of requests. It also
|
|
15
23
|
* improves privacy by not sharing the user's IP address with third-party servers.
|
|
24
|
+
* - `bundle` - Bundle the script as an asset.
|
|
25
|
+
* - `null` - Do not bundle the script.
|
|
16
26
|
*/
|
|
17
|
-
assetStrategy?: 'bundle';
|
|
27
|
+
assetStrategy?: null | 'bundle';
|
|
18
28
|
/**
|
|
19
29
|
* A hook to run when a script does not exist and will be initialized for the first time.
|
|
20
30
|
*/
|
|
@@ -43,9 +53,28 @@ export interface NuxtAppScript {
|
|
|
43
53
|
$script: VueScriptInstance<any>;
|
|
44
54
|
events: {
|
|
45
55
|
type: string;
|
|
46
|
-
fn?: string;
|
|
56
|
+
fn?: string | symbol;
|
|
47
57
|
args?: any;
|
|
48
|
-
|
|
58
|
+
status?: string;
|
|
59
|
+
trigger?: NuxtUseScriptOptions['trigger'];
|
|
49
60
|
at: number;
|
|
50
61
|
}[];
|
|
51
62
|
}
|
|
63
|
+
export type ScriptRegistryEntry<T extends ObjectSchema<any>> = Input<T> | [Input<T>, NuxtUseScriptOptions<T>];
|
|
64
|
+
export interface ScriptRegistry {
|
|
65
|
+
cloudflareWebAnalytics?: ScriptRegistryEntry<typeof CloudflareWebAnalyticsOptions>;
|
|
66
|
+
confetti?: ScriptRegistryEntry<typeof CloudflareWebAnalyticsOptions>;
|
|
67
|
+
facebookPixel?: ScriptRegistryEntry<typeof FacebookPixelOptions>;
|
|
68
|
+
fathomAnalytics?: ScriptRegistryEntry<typeof FathomAnalyticsOptions>;
|
|
69
|
+
hotjar?: ScriptRegistryEntry<typeof HotjarOptions>;
|
|
70
|
+
segment?: ScriptRegistryEntry<typeof SegmentOptions>;
|
|
71
|
+
intercom?: ScriptRegistryEntry<typeof IntercomOptions>;
|
|
72
|
+
}
|
|
73
|
+
export type ScriptDynamicSrcInput<T extends ObjectSchema<any>> = Input<T> & {
|
|
74
|
+
src?: string;
|
|
75
|
+
};
|
|
76
|
+
export type RegistryScripts = (Import & {
|
|
77
|
+
src?: string;
|
|
78
|
+
key?: string;
|
|
79
|
+
transform?: (options: any) => string;
|
|
80
|
+
})[];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuxt/scripts",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.7",
|
|
5
5
|
"packageManager": "pnpm@8.15.5",
|
|
6
6
|
"description": "Next-gen Scripts for Nuxt",
|
|
7
7
|
"author": {
|
|
@@ -51,15 +51,16 @@
|
|
|
51
51
|
"ohash": "^1.1.3",
|
|
52
52
|
"pathe": "^1.1.2",
|
|
53
53
|
"pkg-types": "^1.0.3",
|
|
54
|
-
"shiki": "^1.2.
|
|
54
|
+
"shiki": "^1.2.2",
|
|
55
55
|
"sirv": "^2.0.4",
|
|
56
56
|
"ufo": "^1.5.3",
|
|
57
|
-
"
|
|
57
|
+
"unimport": "^3.7.1",
|
|
58
|
+
"unplugin": "^1.10.1",
|
|
58
59
|
"unstorage": "^1.10.2",
|
|
59
60
|
"valibot": "^0.30.0"
|
|
60
61
|
},
|
|
61
62
|
"devDependencies": {
|
|
62
|
-
"@antfu/eslint-config": "2.
|
|
63
|
+
"@antfu/eslint-config": "2.11.6",
|
|
63
64
|
"@nuxt/devtools-ui-kit": "^1.1.5",
|
|
64
65
|
"@nuxt/module-builder": "^0.5.5",
|
|
65
66
|
"@nuxt/test-utils": "3.12.0",
|
|
@@ -71,7 +72,6 @@
|
|
|
71
72
|
"nuxt-scripts-devtools": "latest",
|
|
72
73
|
"playwright-core": "^1.42.1",
|
|
73
74
|
"typescript": "^5.4.3",
|
|
74
|
-
"unimport": "^3.7.1",
|
|
75
75
|
"vitest": "^1.4.0"
|
|
76
76
|
},
|
|
77
77
|
"resolutions": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=Object.freeze({displayName:"HashiCorp HCL",fileTypes:["hcl"],name:"hcl",patterns:[{include:"#comments"},{include:"#attribute_definition"},{include:"#block"},{include:"#expressions"}],repository:{attribute_access:{begin:"\\.(?!\\*)",beginCaptures:{0:{name:"keyword.operator.accessor.hcl"}},comment:"Matches traversal attribute access such as .attr",end:"[[:alpha:]][\\w-]*|\\d*",endCaptures:{0:{patterns:[{comment:"Attribute name",match:"(?!null|false|true)[[:alpha:]][\\w-]*",name:"variable.other.member.hcl"},{comment:"Optional attribute index",match:"\\d+",name:"constant.numeric.integer.hcl"}]}}},attribute_definition:{captures:{1:{name:"punctuation.section.parens.begin.hcl"},2:{name:"variable.other.readwrite.hcl"},3:{name:"punctuation.section.parens.end.hcl"},4:{name:"keyword.operator.assignment.hcl"}},comment:'Identifier "=" with optional parens',match:"(\\()?(\\b(?!null\\b|false\\b|true\\b)[[:alpha:]][[:alnum:]_-]*)(\\))?\\s*(\\=(?!\\=|\\>))\\s*",name:"variable.declaration.hcl"},attribute_splat:{begin:"\\.",beginCaptures:{0:{name:"keyword.operator.accessor.hcl"}},comment:"Legacy attribute-only splat",end:"\\*",endCaptures:{0:{name:"keyword.operator.splat.hcl"}}},block:{begin:"([\\w][\\-\\w]*)([^{\\r\\n]*)(\\{)",beginCaptures:{1:{patterns:[{comment:"Block type",match:"\\b(?!null|false|true)[[:alpha:]][[:alnum:]_-]*\\b",name:"entity.name.type.hcl"}]},2:{patterns:[{comment:"Block label (String Literal)",match:'\\"[^\\"\\r\\n]*\\"',name:"variable.other.enummember.hcl"},{comment:"Block label (Indentifier)",match:"[[:alpha:]][[:alnum:]_-]*",name:"variable.other.enummember.hcl"}]},3:{name:"punctuation.section.block.begin.hcl"}},comment:'This will match HCL blocks like `thing1 "one" "two" {` or `thing2 {`',end:"\\}",endCaptures:{0:{name:"punctuation.section.block.end.hcl"}},name:"meta.block.hcl",patterns:[{include:"#comments"},{include:"#attribute_definition"},{include:"#expressions"},{include:"#block"}]},block_inline_comments:{begin:"/\\*",captures:{0:{name:"punctuation.definition.comment.hcl"}},comment:"Inline comments start with the /* sequence and end with the */ sequence, and may have any characters within except the ending sequence. An inline comment is considered equivalent to a whitespace sequence",end:"\\*/",name:"comment.block.hcl"},brackets:{begin:"\\[",beginCaptures:{0:{name:"punctuation.section.brackets.begin.hcl"}},end:"\\]",endCaptures:{0:{name:"punctuation.section.brackets.end.hcl"}},patterns:[{comment:"Splat operator",match:"\\*",name:"keyword.operator.splat.hcl"},{include:"#comma"},{include:"#comments"},{include:"#inline_for_expression"},{include:"#inline_if_expression"},{include:"#expressions"},{include:"#local_identifiers"}]},char_escapes:{comment:"Character Escapes",match:'\\\\[nrt"\\\\]|\\\\u(\\h{8}|\\h{4})',name:"constant.character.escape.hcl"},comma:{comment:"Commas - used in certain expressions",match:"\\,",name:"punctuation.separator.hcl"},comments:{patterns:[{include:"#hash_line_comments"},{include:"#double_slash_line_comments"},{include:"#block_inline_comments"}]},double_slash_line_comments:{begin:"//",captures:{0:{name:"punctuation.definition.comment.hcl"}},comment:"Line comments start with // sequence and end with the next newline sequence. A line comment is considered equivalent to a newline sequence",end:"$\\n?",name:"comment.line.double-slash.hcl"},expressions:{patterns:[{include:"#literal_values"},{include:"#operators"},{include:"#tuple_for_expression"},{include:"#object_for_expression"},{include:"#brackets"},{include:"#objects"},{include:"#attribute_access"},{include:"#attribute_splat"},{include:"#functions"},{include:"#parens"}]},for_expression_body:{patterns:[{comment:"in keyword",match:"\\bin\\b",name:"keyword.operator.word.hcl"},{comment:"if keyword",match:"\\bif\\b",name:"keyword.control.conditional.hcl"},{match:"\\:",name:"keyword.operator.hcl"},{include:"#expressions"},{include:"#comments"},{include:"#comma"},{include:"#local_identifiers"}]},functions:{begin:"([:\\-\\w]+)(\\()",beginCaptures:{1:{patterns:[{match:"\\b[[:alpha:]][\\w_-]*::([[:alpha:]][\\w_-]*::)?[[:alpha:]][\\w_-]*\\b",name:"support.function.namespaced.hcl"},{match:"\\b[[:alpha:]][\\w_-]*\\b",name:"support.function.builtin.hcl"}]},2:{name:"punctuation.section.parens.begin.hcl"}},comment:"Built-in function calls",end:"\\)",endCaptures:{0:{name:"punctuation.section.parens.end.hcl"}},name:"meta.function-call.hcl",patterns:[{include:"#comments"},{include:"#expressions"},{include:"#comma"}]},hash_line_comments:{begin:"#",captures:{0:{name:"punctuation.definition.comment.hcl"}},comment:"Line comments start with # sequence and end with the next newline sequence. A line comment is considered equivalent to a newline sequence",end:"$\\n?",name:"comment.line.number-sign.hcl"},hcl_type_keywords:{comment:"Type keywords known to HCL.",match:"\\b(any|string|number|bool|list|set|map|tuple|object)\\b",name:"storage.type.hcl"},heredoc:{begin:"(\\<\\<\\-?)\\s*(\\w+)\\s*$",beginCaptures:{1:{name:"keyword.operator.heredoc.hcl"},2:{name:"keyword.control.heredoc.hcl"}},comment:"String Heredoc",end:"^\\s*\\2\\s*$",endCaptures:{0:{name:"keyword.control.heredoc.hcl"}},name:"string.unquoted.heredoc.hcl",patterns:[{include:"#string_interpolation"}]},inline_for_expression:{begin:"(for)\\b",beginCaptures:{1:{name:"keyword.control.hcl"}},end:"\\n",patterns:[{match:"\\=\\>",name:"storage.type.function.hcl"},{include:"#for_expression_body"}]},inline_if_expression:{begin:"(if)\\b",beginCaptures:{1:{name:"keyword.control.conditional.hcl"}},end:"\\n",patterns:[{include:"#expressions"},{include:"#comments"},{include:"#comma"},{include:"#local_identifiers"}]},language_constants:{comment:"Language Constants",match:"\\b(true|false|null)\\b",name:"constant.language.hcl"},literal_values:{patterns:[{include:"#numeric_literals"},{include:"#language_constants"},{include:"#string_literals"},{include:"#heredoc"},{include:"#hcl_type_keywords"}]},local_identifiers:{comment:"Local Identifiers",match:"\\b(?!null|false|true)[[:alpha:]][[:alnum:]_-]*\\b",name:"variable.other.readwrite.hcl"},numeric_literals:{patterns:[{captures:{1:{name:"punctuation.separator.exponent.hcl"}},comment:"Integer, no fraction, optional exponent",match:"\\b\\d+([Ee][+-]?)\\d+\\b",name:"constant.numeric.float.hcl"},{captures:{1:{name:"punctuation.separator.decimal.hcl"},2:{name:"punctuation.separator.exponent.hcl"}},comment:"Integer, fraction, optional exponent",match:"\\b\\d+(\\.)\\d+(?:([Ee][+-]?)\\d+)?\\b",name:"constant.numeric.float.hcl"},{comment:"Integers",match:"\\b\\d+\\b",name:"constant.numeric.integer.hcl"}]},object_for_expression:{begin:"(\\{)\\s?(for)\\b",beginCaptures:{1:{name:"punctuation.section.braces.begin.hcl"},2:{name:"keyword.control.hcl"}},end:"\\}",endCaptures:{0:{name:"punctuation.section.braces.end.hcl"}},patterns:[{match:"\\=\\>",name:"storage.type.function.hcl"},{include:"#for_expression_body"}]},object_key_values:{patterns:[{include:"#comments"},{include:"#literal_values"},{include:"#operators"},{include:"#tuple_for_expression"},{include:"#object_for_expression"},{include:"#heredoc"},{include:"#functions"}]},objects:{begin:"\\{",beginCaptures:{0:{name:"punctuation.section.braces.begin.hcl"}},end:"\\}",endCaptures:{0:{name:"punctuation.section.braces.end.hcl"}},name:"meta.braces.hcl",patterns:[{include:"#comments"},{include:"#objects"},{include:"#inline_for_expression"},{include:"#inline_if_expression"},{captures:{1:{name:"meta.mapping.key.hcl variable.other.readwrite.hcl"},2:{name:"keyword.operator.assignment.hcl"}},comment:"Literal, named object key",match:"\\b((?!null|false|true)[[:alpha:]][[:alnum:]_-]*)\\s*(\\=(?!=))\\s*"},{captures:{1:{name:"meta.mapping.key.hcl string.quoted.double.hcl"},2:{name:"punctuation.definition.string.begin.hcl"},3:{name:"punctuation.definition.string.end.hcl"},4:{name:"keyword.operator.hcl"}},comment:"String object key",match:'^\\s*((").*("))\\s*(\\=)\\s*'},{begin:"^\\s*\\(",beginCaptures:{0:{name:"punctuation.section.parens.begin.hcl"}},comment:"Computed object key (any expression between parens)",end:"(\\))\\s*(=|:)\\s*",endCaptures:{1:{name:"punctuation.section.parens.end.hcl"},2:{name:"keyword.operator.hcl"}},name:"meta.mapping.key.hcl",patterns:[{include:"#attribute_access"},{include:"#attribute_splat"}]},{include:"#object_key_values"}]},operators:{patterns:[{match:"\\>\\=",name:"keyword.operator.hcl"},{match:"\\<\\=",name:"keyword.operator.hcl"},{match:"\\=\\=",name:"keyword.operator.hcl"},{match:"\\!\\=",name:"keyword.operator.hcl"},{match:"\\+",name:"keyword.operator.arithmetic.hcl"},{match:"\\-",name:"keyword.operator.arithmetic.hcl"},{match:"\\*",name:"keyword.operator.arithmetic.hcl"},{match:"\\/",name:"keyword.operator.arithmetic.hcl"},{match:"\\%",name:"keyword.operator.arithmetic.hcl"},{match:"\\&\\&",name:"keyword.operator.logical.hcl"},{match:"\\|\\|",name:"keyword.operator.logical.hcl"},{match:"\\!",name:"keyword.operator.logical.hcl"},{match:"\\>",name:"keyword.operator.hcl"},{match:"\\<",name:"keyword.operator.hcl"},{match:"\\?",name:"keyword.operator.hcl"},{match:"\\.\\.\\.",name:"keyword.operator.hcl"},{match:"\\:",name:"keyword.operator.hcl"},{match:"\\=\\>",name:"keyword.operator.hcl"}]},parens:{begin:"\\(",beginCaptures:{0:{name:"punctuation.section.parens.begin.hcl"}},comment:"Parens - matched *after* function syntax",end:"\\)",endCaptures:{0:{name:"punctuation.section.parens.end.hcl"}},patterns:[{include:"#comments"},{include:"#expressions"}]},string_interpolation:{begin:"(?<![%$])([%$]{)",beginCaptures:{1:{name:"keyword.other.interpolation.begin.hcl"}},comment:"String interpolation",end:"\\}",endCaptures:{0:{name:"keyword.other.interpolation.end.hcl"}},name:"meta.interpolation.hcl",patterns:[{comment:"Trim left whitespace",match:"\\~\\s",name:"keyword.operator.template.left.trim.hcl"},{comment:"Trim right whitespace",match:"\\s\\~",name:"keyword.operator.template.right.trim.hcl"},{comment:"if/else/endif and for/in/endfor directives",match:"\\b(if|else|endif|for|in|endfor)\\b",name:"keyword.control.hcl"},{include:"#expressions"},{include:"#local_identifiers"}]},string_literals:{begin:'"',beginCaptures:{0:{name:"punctuation.definition.string.begin.hcl"}},comment:"Strings",end:'"',endCaptures:{0:{name:"punctuation.definition.string.end.hcl"}},name:"string.quoted.double.hcl",patterns:[{include:"#string_interpolation"},{include:"#char_escapes"}]},tuple_for_expression:{begin:"(\\[)\\s?(for)\\b",beginCaptures:{1:{name:"punctuation.section.brackets.begin.hcl"},2:{name:"keyword.control.hcl"}},end:"\\]",endCaptures:{0:{name:"punctuation.section.brackets.end.hcl"}},patterns:[{include:"#for_expression_body"}]}},scopeName:"source.hcl"});var n=[e];export{n as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"id":"72c1a85e-b70c-4e27-93ec-d6316f40b143","timestamp":1711777231401,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
|