New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@sprucelabs/babel-plugin-schema

Package Overview
Dependencies
Maintainers
3
Versions
232
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sprucelabs/babel-plugin-schema - npm Package Compare versions

Comparing version 1.1.128 to 1.2.0

build/resolve-path-aliases.d.ts

2

.vscode/settings.json
{
"debug.node.autoAttach": "off",
"debug.node.autoAttach": "on",
"git.ignoreLimitWarning": true,

@@ -4,0 +4,0 @@ "javascript.validate.enable": false,

@@ -5,5 +5,5 @@ import AbstractSpruceTest from '@sprucelabs/test';

protected static afterAll(): Promise<void>;
protected static buildsSchemaWithoutError(): Promise<void>;
protected static buildsSchemaWithoutErrorWithoutLocalHashSpruce(): Promise<void>;
private static fieldFactoryFilepath;
protected static buildsSchemaAndUsesTheHashSpruceVersionOfFiles(): Promise<void>;
protected static buildsSchemaAndUsesTheLocalHashSpruceVersionOfFiles(): Promise<void>;
protected static testBuildingFullSkillWithBabel(): Promise<void>;

@@ -10,0 +10,0 @@ private static copyDir;

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

}
static async buildsSchemaWithoutError() {
static async buildsSchemaWithoutErrorWithoutLocalHashSpruce() {
const cwd = await this.setupNewPackage();

@@ -52,4 +52,5 @@ const fieldFactoryFile = this.fieldFactoryFilepath(cwd);

const afterMapContents = fs_extra_1.default.readFileSync(fieldFactoryFile).toString();
test_1.assert.doesNotInclude(afterMapContents, cwd);
test_1.assert.doesNotInclude(afterMapContents, '#spruce');
test_1.assert.doesInclude(afterMapContents, '@sprucelabs/schema/build/.spruce/');
test_1.assert.doesInclude(afterMapContents, './../.spruce/schemas/fields/fieldClassMap');
}

@@ -59,3 +60,3 @@ static fieldFactoryFilepath(cwd) {

}
static async buildsSchemaAndUsesTheHashSpruceVersionOfFiles() {
static async buildsSchemaAndUsesTheLocalHashSpruceVersionOfFiles() {
const cwd = await this.setupNewPackage();

@@ -70,4 +71,3 @@ // copy schema files

test_1.assert.doesNotInclude(afterMapContents, '#spruce');
test_1.assert.doesNotInclude(afterMapContents, '@sprucelabs/schema/build/.spruce/');
test_1.assert.doesInclude(afterMapContents, 'build/.spruce');
test_1.assert.doesInclude(afterMapContents, './../../../../../build/.spruce/schemas/fields/fieldClassMap');
}

@@ -87,5 +87,6 @@ static async testBuildingFullSkillWithBabel() {

await this.runCommand(cwd, 'yarn build');
const checkFile = this.resolvePath(cwd, 'node_modules/@sprucelabs/schema/build/factories/FieldFactory.js');
const checkFile = this.fieldFactoryFilepath(cwd);
const checkFileContents = fs_extra_1.default.readFileSync(checkFile).toString();
test_1.assert.doesNotInclude(checkFileContents, 'src/.spruce');
test_1.assert.doesInclude(checkFileContents, './../../../../../build/.spruce/schemas/fields/fieldClassMap');
}

@@ -144,6 +145,6 @@ static async copyDir(source, destination) {

test_1.test()
], SchemaBuildsAndMapsPathsTest, "buildsSchemaWithoutError", null);
], SchemaBuildsAndMapsPathsTest, "buildsSchemaWithoutErrorWithoutLocalHashSpruce", null);
__decorate([
test_1.test()
], SchemaBuildsAndMapsPathsTest, "buildsSchemaAndUsesTheHashSpruceVersionOfFiles", null);
], SchemaBuildsAndMapsPathsTest, "buildsSchemaAndUsesTheLocalHashSpruceVersionOfFiles", null);
__decorate([

@@ -150,0 +151,0 @@ test_1.test()

@@ -6,2 +6,3 @@ export interface PluginOptions {

export declare function copyAndMap(options: PluginOptions): void;
export declare function resolveHashSpruceAliases(destination: string): void;
export default function (_: any, options: PluginOptions): {};

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.copyAndMap = void 0;
exports.resolveHashSpruceAliases = exports.copyAndMap = void 0;
const fs_1 = __importDefault(require("fs"));

@@ -23,4 +23,11 @@ const path_1 = __importDefault(require("path"));

const destination = ensureDirsAndResolveDestination(options);
resolveHashSpruceAliases(destination);
}
exports.copyAndMap = copyAndMap;
function resolveHashSpruceAliases(destination) {
let { outResolver, srcResolver } = buildResolvers(destination);
const files = globby_1.default.sync(path_1.default.join(destination, '**/*.js'));
const files = globby_1.default.sync([
path_1.default.join(destination, '**/*.js'),
path_1.default.join(destination, '**/*.d.ts'),
]);
files.forEach((file) => {

@@ -42,3 +49,4 @@ let contents = fs_1.default.readFileSync(file).toString();

}
return `"${resolved}"`;
const relative = path_1.default.relative(path_1.default.dirname(file), resolved);
return `"./${relative}"`;
});

@@ -50,3 +58,3 @@ if (found) {

}
exports.copyAndMap = copyAndMap;
exports.resolveHashSpruceAliases = resolveHashSpruceAliases;
function buildResolvers(destination) {

@@ -53,0 +61,0 @@ const config = tsconfig_paths_1.loadConfig(destination);

@@ -0,1 +1,8 @@

# [1.2.0](https://github.com/sprucelabsai/babel-plugin-schema/compare/v1.1.128...v1.2.0) (2020-09-04)
### Features
* resolve types file with resolve-path-aliases command ([d29135d](https://github.com/sprucelabsai/babel-plugin-schema/commit/d29135d))
## [1.1.128](https://github.com/sprucelabsai/babel-plugin-schema/compare/v1.1.127...v1.1.128) (2020-09-04)

@@ -2,0 +9,0 @@

{
"name": "@sprucelabs/babel-plugin-schema",
"version": "1.1.128",
"version": "1.2.0",
"description": "Builds @sprucelabs/schema and generates static paths to #spruce directories.",

@@ -9,2 +9,5 @@ "main": "build/index.js",

"license": "MIT",
"bin": {
"resolve-path-aliases": "./build/resolve-path-aliases.js"
},
"scripts": {

@@ -11,0 +14,0 @@ "test": "jest",

@@ -19,3 +19,3 @@ import { exec } from 'child_process'

@test()
protected static async buildsSchemaWithoutError() {
protected static async buildsSchemaWithoutErrorWithoutLocalHashSpruce() {
const cwd = await this.setupNewPackage()

@@ -32,4 +32,8 @@

assert.doesNotInclude(afterMapContents, cwd)
assert.doesNotInclude(afterMapContents, '#spruce')
assert.doesInclude(afterMapContents, '@sprucelabs/schema/build/.spruce/')
assert.doesInclude(
afterMapContents,
'./../.spruce/schemas/fields/fieldClassMap'
)
}

@@ -46,3 +50,3 @@

@test()
protected static async buildsSchemaAndUsesTheHashSpruceVersionOfFiles() {
protected static async buildsSchemaAndUsesTheLocalHashSpruceVersionOfFiles() {
const cwd = await this.setupNewPackage()

@@ -69,4 +73,6 @@

assert.doesNotInclude(afterMapContents, '#spruce')
assert.doesNotInclude(afterMapContents, '@sprucelabs/schema/build/.spruce/')
assert.doesInclude(afterMapContents, 'build/.spruce')
assert.doesInclude(
afterMapContents,
'./../../../../../build/.spruce/schemas/fields/fieldClassMap'
)
}

@@ -92,9 +98,10 @@

const checkFile = this.resolvePath(
cwd,
'node_modules/@sprucelabs/schema/build/factories/FieldFactory.js'
)
const checkFile = this.fieldFactoryFilepath(cwd)
const checkFileContents = fsUtil.readFileSync(checkFile).toString()
assert.doesNotInclude(checkFileContents, 'src/.spruce')
assert.doesInclude(
checkFileContents,
'./../../../../../build/.spruce/schemas/fields/fieldClassMap'
)
}

@@ -101,0 +108,0 @@

@@ -36,5 +36,12 @@ import fs from 'fs'

resolveHashSpruceAliases(destination)
}
export function resolveHashSpruceAliases(destination: string) {
let { outResolver, srcResolver } = buildResolvers(destination)
const files = globby.sync(pathUtil.join(destination, '**/*.js'))
const files = globby.sync([
pathUtil.join(destination, '**/*.js'),
pathUtil.join(destination, '**/*.d.ts'),
])

@@ -61,3 +68,5 @@ files.forEach((file) => {

}
return `"${resolved}"`
const relative = pathUtil.relative(pathUtil.dirname(file), resolved)
return `"./${relative}"`
})

@@ -84,4 +93,4 @@

const { paths, absoluteBaseUrl } = config
const srcResolver = createMatchPath(absoluteBaseUrl, paths)
const outResolver = buildOutResolver(config)

@@ -88,0 +97,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