@sanity/codegen
Advanced tools
Comparing version 3.59.2-corel.412 to 3.59.2-corel-fix-presentation-perspective-switching.536
@@ -73,3 +73,5 @@ import fs$1, { readFile } from "node:fs/promises"; | ||
} | ||
function parseSourceFile(source, filename, babelOptions) { | ||
function parseSourceFile(_source, _filename, babelOptions) { | ||
let source = _source, filename = _filename; | ||
filename.endsWith(".astro") && (filename += ".ts", source = parseAstro(source)); | ||
const result = parse$1(source, { | ||
@@ -83,2 +85,9 @@ ...babelOptions, | ||
} | ||
function parseAstro(source) { | ||
const codeFences = source.match(/---\n([\s\S]*?)\n---/g); | ||
return codeFences ? codeFences.map((codeFence) => codeFence.split(` | ||
`).slice(1, -1).join(` | ||
`)).join(` | ||
`) : ""; | ||
} | ||
const debug$2 = createDebug("sanity:codegen:findQueries:debug"), TAGGED_TEMPLATE_ALLOW_LIST = ["groq"], FUNCTION_WRAPPER_ALLOW_LIST = ["defineQuery"]; | ||
@@ -85,0 +94,0 @@ function resolveExpression({ |
@@ -80,3 +80,5 @@ "use strict"; | ||
} | ||
function parseSourceFile(source, filename, babelOptions) { | ||
function parseSourceFile(_source, _filename, babelOptions) { | ||
let source = _source, filename = _filename; | ||
filename.endsWith(".astro") && (filename += ".ts", source = parseAstro(source)); | ||
const result = core.parse(source, { | ||
@@ -90,2 +92,9 @@ ...babelOptions, | ||
} | ||
function parseAstro(source) { | ||
const codeFences = source.match(/---\n([\s\S]*?)\n---/g); | ||
return codeFences ? codeFences.map((codeFence) => codeFence.split(` | ||
`).slice(1, -1).join(` | ||
`)).join(` | ||
`) : ""; | ||
} | ||
const debug$2 = createDebug__default.default("sanity:codegen:findQueries:debug"), TAGGED_TEMPLATE_ALLOW_LIST = ["groq"], FUNCTION_WRAPPER_ALLOW_LIST = ["defineQuery"]; | ||
@@ -92,0 +101,0 @@ function resolveExpression({ |
{ | ||
"name": "@sanity/codegen", | ||
"version": "3.59.2-corel.412+97f610e5db", | ||
"version": "3.59.2-corel-fix-presentation-perspective-switching.536+783f0b1856", | ||
"description": "Codegen toolkit for Sanity.io", | ||
@@ -47,3 +47,3 @@ "keywords": [ | ||
"clean": "rimraf lib coverage", | ||
"lint": "eslint .", | ||
"lint": "eslint --cache .", | ||
"prepublishOnly": "turbo run build", | ||
@@ -63,5 +63,5 @@ "test": "vitest", | ||
"debug": "^4.3.4", | ||
"globby": "^10.0.0", | ||
"groq": "3.59.2-corel.412+97f610e5db", | ||
"groq-js": "^1.14.0", | ||
"globby": "^11.1.0", | ||
"groq": "3.59.2-corel-fix-presentation-perspective-switching.536+783f0b1856", | ||
"groq-js": "^1.14.2", | ||
"json5": "^2.2.3", | ||
@@ -72,4 +72,4 @@ "tsconfig-paths": "^4.2.0", | ||
"devDependencies": { | ||
"@repo/package.config": "3.65.0", | ||
"@repo/test-config": "3.65.0", | ||
"@repo/package.config": "3.71.0", | ||
"@repo/test-config": "3.71.0", | ||
"@types/babel__core": "^7.20.5", | ||
@@ -80,4 +80,4 @@ "@types/babel__generator": "^7.6.8", | ||
"@types/debug": "^4.1.12", | ||
"rimraf": "^3.0.2", | ||
"vitest": "^2.1.1" | ||
"rimraf": "^5.0.10", | ||
"vitest": "^2.1.8" | ||
}, | ||
@@ -90,3 +90,3 @@ "engines": { | ||
}, | ||
"gitHead": "97f610e5dbf362553cd664b7fc58cadf357fadd6" | ||
"gitHead": "783f0b18569c0ae5f72d8b2d7bbd9128fa8416bb" | ||
} |
@@ -6,6 +6,13 @@ import {parse, type TransformOptions} from '@babel/core' | ||
export function parseSourceFile( | ||
source: string, | ||
filename: string, | ||
_source: string, | ||
_filename: string, | ||
babelOptions: TransformOptions, | ||
): babelTypes.File { | ||
let source = _source | ||
let filename = _filename | ||
if (filename.endsWith('.astro')) { | ||
// append .ts to the filename so babel will parse it as typescript | ||
filename += '.ts' | ||
source = parseAstro(source) | ||
} | ||
const result = parse(source, { | ||
@@ -22,1 +29,15 @@ ...babelOptions, | ||
} | ||
function parseAstro(source: string): string { | ||
// find all code fences, the js code is between --- and --- | ||
const codeFences = source.match(/---\n([\s\S]*?)\n---/g) | ||
if (!codeFences) { | ||
return '' | ||
} | ||
return codeFences | ||
.map((codeFence) => { | ||
return codeFence.split('\n').slice(1, -1).join('\n') | ||
}) | ||
.join('\n') | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
314081
3713
+ Addedglobby@11.1.0(transitive)
- Removed@types/glob@7.2.0(transitive)
- Removed@types/minimatch@5.1.2(transitive)
- Removed@types/node@22.10.10(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedglob@7.2.3(transitive)
- Removedglobby@10.0.2(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedonce@1.4.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedundici-types@6.20.0(transitive)
- Removedwrappy@1.0.2(transitive)
Updatedglobby@^11.1.0
Updatedgroq@3.59.2-corel-fix-presentation-perspective-switching.536+783f0b1856
Updatedgroq-js@^1.14.2