Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vanilla-extract/integration

Package Overview
Dependencies
Maintainers
4
Versions
125
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vanilla-extract/integration - npm Package Compare versions

Comparing version 0.0.0-filescope-urls-202281122225 to 0.0.0-filescope-urls-202281281125

3

dist/declarations/src/addFileScope.d.ts

@@ -1,2 +0,1 @@

declare type FilescopeTarget = 'esm' | 'cjs' | 'bundle';
interface AddFileScopeParams {

@@ -7,5 +6,5 @@ source: string;

packageName: string;
target?: FilescopeTarget;
target?: 'library' | 'app';
}
export declare function addFileScope({ source, filePath, rootPath, packageName, target, }: AddFileScopeParams): string;
export {};
import { FileScope, Adapter } from '@vanilla-extract/css';
export declare function stringifyFileScope({ packageName, filePath, }: FileScope): string;
export declare function stringifyFileScope({ packageName, filePath, url, }: FileScope): string;
export declare function parseFileScope(serialisedFileScope: string): FileScope;

@@ -4,0 +4,0 @@ export declare type IdentifierOption = ReturnType<Adapter['getIdentOption']>;

@@ -17,2 +17,3 @@ 'use strict';

var esbuild = require('esbuild');
var url = require('url');

@@ -55,11 +56,13 @@ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }

packageName,
filePath
filePath,
url
}) {
return packageName ? `${filePath}$$$${packageName}` : filePath;
return packageName ? `${filePath}$$$${packageName}$$$${url}` : filePath;
}
function parseFileScope(serialisedFileScope) {
const [filePath, packageName] = serialisedFileScope.split('$$$');
const [filePath, packageName, url] = serialisedFileScope.split('$$$');
return {
filePath,
packageName
packageName,
url
};

@@ -295,22 +298,18 @@ }

packageName,
target = 'bundle'
target = 'app'
}) {
let fileScopePath;
const fileUrl = target === 'library' ? 'import.meta.url' : JSON.stringify(url.pathToFileURL(filePath));
if (target === 'bundle') {
// Encode windows file paths as posix
fileScopePath = `"${path.posix.relative(rootPath, filePath)}"`;
} else if (target === 'esm') {
fileScopePath = 'import.meta.url';
} else {
fileScopePath = '__filename';
}
if (source.indexOf('@vanilla-extract/css/fileScope') > -1) {
return source.replace(/setFileScope\(((\n|.)*?)\)/, `setFileScope(${fileScopePath}, "${packageName}")`);
return source.replace(/setFileScope\(((\n|.)*?)\)/, (_, params) => {
const paramList = params.split(',').map(param => param.trim()).filter(Boolean);
const fixedParams = [paramList[0], paramList[1] || 'undefined', fileUrl].join(', ');
return `setFileScope(${fixedParams})`;
});
}
const rootRelativeFilePath = path.posix.relative(rootPath, filePath);
return `
import { setFileScope, endFileScope } from "@vanilla-extract/css/fileScope";
setFileScope(${fileScopePath}, "${packageName}");
setFileScope("${rootRelativeFilePath}", "${packageName}", ${fileUrl});
${source}

@@ -317,0 +316,0 @@ endFileScope();

@@ -17,2 +17,3 @@ 'use strict';

var esbuild = require('esbuild');
var url = require('url');

@@ -55,11 +56,13 @@ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }

packageName,
filePath
filePath,
url
}) {
return packageName ? `${filePath}$$$${packageName}` : filePath;
return packageName ? `${filePath}$$$${packageName}$$$${url}` : filePath;
}
function parseFileScope(serialisedFileScope) {
const [filePath, packageName] = serialisedFileScope.split('$$$');
const [filePath, packageName, url] = serialisedFileScope.split('$$$');
return {
filePath,
packageName
packageName,
url
};

@@ -295,22 +298,18 @@ }

packageName,
target = 'bundle'
target = 'app'
}) {
let fileScopePath;
const fileUrl = target === 'library' ? 'import.meta.url' : JSON.stringify(url.pathToFileURL(filePath));
if (target === 'bundle') {
// Encode windows file paths as posix
fileScopePath = `"${path.posix.relative(rootPath, filePath)}"`;
} else if (target === 'esm') {
fileScopePath = 'import.meta.url';
} else {
fileScopePath = '__filename';
}
if (source.indexOf('@vanilla-extract/css/fileScope') > -1) {
return source.replace(/setFileScope\(((\n|.)*?)\)/, `setFileScope(${fileScopePath}, "${packageName}")`);
return source.replace(/setFileScope\(((\n|.)*?)\)/, (_, params) => {
const paramList = params.split(',').map(param => param.trim()).filter(Boolean);
const fixedParams = [paramList[0], paramList[1] || 'undefined', fileUrl].join(', ');
return `setFileScope(${fixedParams})`;
});
}
const rootRelativeFilePath = path.posix.relative(rootPath, filePath);
return `
import { setFileScope, endFileScope } from "@vanilla-extract/css/fileScope";
setFileScope(${fileScopePath}, "${packageName}");
setFileScope("${rootRelativeFilePath}", "${packageName}", ${fileUrl});
${source}

@@ -317,0 +316,0 @@ endFileScope();

{
"name": "@vanilla-extract/integration",
"version": "0.0.0-filescope-urls-202281122225",
"version": "0.0.0-filescope-urls-202281281125",
"description": "Zero-runtime Stylesheets-in-TypeScript",

@@ -17,3 +17,3 @@ "main": "dist/vanilla-extract-integration.cjs.js",

"dependencies": {
"@vanilla-extract/css": "^0.0.0-filescope-urls-202281122225",
"@vanilla-extract/css": "^0.0.0-filescope-urls-202281281125",
"esbuild": "^0.11.16",

@@ -20,0 +20,0 @@ "eval": "0.1.6",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc