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

@tokey/imports-parser

Package Overview
Dependencies
Maintainers
3
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tokey/imports-parser - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

9

dist/imports-parser.d.ts
import { Token, Descriptors } from '@tokey/core';
declare type Delimiters = ',' | ';' | ':' | '{' | '}' | '[' | ']' | '(' | ')' | '*';
export declare type CodeToken = Token<Descriptors | Delimiters>;
type Delimiters = ',' | ';' | ':' | '{' | '}' | '[' | ']' | '(' | ')' | '*';
export type CodeToken = Token<Descriptors | Delimiters>;
export declare function parseImports(source: string, blockStart?: string, blockEnd?: string, taggedImportSupport?: boolean, strictSemiColon?: boolean): ImportValue[];

@@ -8,4 +8,4 @@ export interface ImportValue {

defaultName: string | undefined;
named: Record<string, string> | undefined;
tagged: Record<string, Record<string, string>> | undefined;
named: NamedMapping[] | undefined;
tagged: Record<string, NamedMapping[] | undefined>;
from: string | undefined;

@@ -16,3 +16,4 @@ errors: string[];

}
type NamedMapping = [from: string, to: string];
export {};
//# sourceMappingURL=imports-parser.d.ts.map

@@ -45,3 +45,3 @@ "use strict";

let named = undefined;
let tagged = undefined;
let tagged = {};
let from;

@@ -137,2 +137,3 @@ t = s.next();

else {
s.back();
errors.push('invalid missing source');

@@ -152,3 +153,3 @@ }

named,
tagged: tagged,
tagged,
from,

@@ -165,3 +166,3 @@ errors,

var _a;
const named = {};
const named = [];
const tagged = {};

@@ -205,7 +206,7 @@ const tokens = [];

const name = tokens[0].value;
named[name] = name;
named.push([name, name]);
}
else if (tokens.length === 3) {
if (tokens[1].value === 'as') {
named[tokens[0].value] = tokens[2].value;
named.push([tokens[0].value, tokens[2].value]);
}

@@ -212,0 +213,0 @@ }

{
"name": "@tokey/imports-parser",
"description": "parser for esm like imports",
"version": "0.1.0",
"version": "0.1.1",
"main": "dist/imports-parser.js",

@@ -6,0 +6,0 @@ "types": "dist/imports-parser.d.ts",

@@ -62,4 +62,4 @@ import {

defaultName: string | undefined;
named: Record<string, string> | undefined;
tagged: Record<string, Record<string, string>> | undefined;
named: NamedMapping[] | undefined;
tagged: Record<string, NamedMapping[] | undefined>;
from: string | undefined;

@@ -71,2 +71,4 @@ errors: string[];

type NamedMapping = [from: string, to: string];
const isImportBlockEndError = (token: CodeToken) => token.value === 'from' || token.type === ';';

@@ -94,4 +96,4 @@

let star = false;
let named = undefined;
let tagged = undefined;
let named: ImportValue['named'] = undefined;
let tagged: ImportValue['tagged'] = {};
let from;

@@ -178,2 +180,3 @@ t = s.next();

} else {
s.back();
errors.push('invalid missing source');

@@ -193,3 +196,3 @@ }

named,
tagged: tagged,
tagged,
from,

@@ -206,4 +209,4 @@ errors,

function processNamedBlock(block: CodeToken[], errors: string[], taggedImportSupport: boolean) {
const named: Record<string, string> = {};
const tagged: Record<string, Record<string, string>> = {};
const named: [from: string, to: string][] = [];
const tagged: Record<string, [from: string, to: string][]> = {};
const tokens: CodeToken[] = [];

@@ -247,6 +250,6 @@

const name = tokens[0].value;
named[name] = name;
named.push([name, name]);
} else if (tokens.length === 3) {
if (tokens[1].value === 'as') {
named[tokens[0].value] = tokens[2].value;
named.push([tokens[0].value, tokens[2].value]);
}

@@ -253,0 +256,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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