Socket
Socket
Sign inDemoInstall

@ms-cloudpack/package-utilities

Package Overview
Dependencies
Maintainers
0
Versions
203
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ms-cloudpack/package-utilities - npm Package Compare versions

Comparing version 7.6.1 to 7.7.0

5

lib/detectModuleType.d.ts

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

/**
* Module type of a source file. Undefined implies that we can not determine the module type.
*/
export type ModuleType = 'esm' | 'cjs' | undefined;
import type { ModuleType } from '@ms-cloudpack/common-types';
export declare function detectModuleTypeFromSource(source: string): ModuleType;

@@ -6,0 +3,0 @@ /**

13

lib/detectModuleType.js
import fsPromises from 'fs/promises';
import { parse } from 'acorn';
import { simple } from 'acorn-walk';
import { simple as simpleWalk } from 'acorn-walk';
import path from 'path';

@@ -29,2 +29,11 @@ import { javascriptExtensions, typescriptExtensions } from '@ms-cloudpack/path-utilities';

}
// Basic check for AMD-style modules.
const firstNode = ast.body[0];
if (firstNode &&
firstNode.type === 'ExpressionStatement' &&
firstNode.expression.type === 'CallExpression' &&
firstNode.expression.callee.type === 'Identifier' &&
firstNode.expression.callee.name === 'define') {
return 'amd';
}
let isCJS = false;

@@ -42,3 +51,3 @@ let isESM = false;

try {
simple(ast, {
simpleWalk(ast, {
// ESM checks

@@ -45,0 +54,0 @@ ImportDeclaration: returnESM,

@@ -15,3 +15,3 @@ export { PackageDefinitions } from './PackageDefinitions.js';

export { resolve } from './resolve.js';
export { detectModuleType, type ModuleType } from './detectModuleType.js';
export { detectModuleType } from './detectModuleType.js';
export { isExternalPackage } from './isExternalPackage.js';

@@ -18,0 +18,0 @@ export { findFileInPackage, type FindFileInPackageOptions, type FindFileInPackageResult } from './findFileInPackage.js';

{
"name": "@ms-cloudpack/package-utilities",
"version": "7.6.1",
"version": "7.7.0",
"description": "Utilities for resolving/parsing packages and their imports.",

@@ -17,7 +17,7 @@ "license": "MIT",

"dependencies": {
"@ms-cloudpack/common-types": "^0.8.1",
"@ms-cloudpack/common-types": "^0.8.2",
"@ms-cloudpack/json-utilities": "^0.1.4",
"@ms-cloudpack/package-overrides": "^0.9.4",
"@ms-cloudpack/package-overrides": "^0.9.5",
"@ms-cloudpack/path-string-parsing": "^1.2.3",
"@ms-cloudpack/path-utilities": "^2.7.19",
"@ms-cloudpack/path-utilities": "^2.7.20",
"@ms-cloudpack/task-reporter": "^0.14.1",

@@ -24,0 +24,0 @@ "acorn": "^8.11.2",

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

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