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

parcel-codegen-loader

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parcel-codegen-loader - npm Package Compare versions

Comparing version 0.5.1 to 0.5.2-pre.363

3

lib/index.d.ts

@@ -0,1 +1,4 @@

export interface DependencyOptions {
includedInParent?: boolean;
}
export default function loader(source: string, map: string, meta: any): Promise<void>;

23

lib/index.js

@@ -51,6 +51,8 @@ "use strict";

function loader(source, map, meta) {
var _a, _b;
return __awaiter(this, void 0, void 0, function () {
var options, name, callback, generator, content;
return __generator(this, function (_a) {
switch (_a.label) {
var options, name, compiler, callback, generator, content;
var _this = this;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:

@@ -63,7 +65,18 @@ options = loader_utils_1.getOptions(this);

name = this.resourcePath;
compiler = this._compiler;
callback = this.async();
generator = reloadGenerator(name);
return [4 /*yield*/, generator.call(this)];
return [4 /*yield*/, generator.call({
name: name,
options: {
outDir: (_b = (_a = compiler === null || compiler === void 0 ? void 0 : compiler.options) === null || _a === void 0 ? void 0 : _a.output) === null || _b === void 0 ? void 0 : _b.path,
rootDir: process.cwd(),
},
addDependency: function (file, options) {
if (options === void 0) { options = {}; }
return _this.addDependency(file);
},
})];
case 1:
content = _a.sent();
content = _c.sent();
if (typeof content === 'string') {

@@ -70,0 +83,0 @@ callback(null, content, map, meta);

{
"name": "parcel-codegen-loader",
"version": "0.5.1",
"version": "0.5.2-pre.363",
"description": "A loader for .codegen files to auto-generate modules on the fly.",

@@ -39,3 +39,3 @@ "main": "lib/index.js",

},
"gitHead": "b4f877d6d0b9bf37a38082d472e7e87ab4a33e5b"
"gitHead": "01f6e275d7c09088d48bb96f3a8d7df05444ab01"
}
import * as validateOptions from 'schema-utils';
import { getOptions } from 'loader-utils';
import { Compiler } from 'webpack';

@@ -15,2 +16,6 @@ const schema = {

export interface DependencyOptions {
includedInParent?: boolean;
}
export default async function loader(source: string, map: string, meta: any) {

@@ -25,5 +30,13 @@ const options = getOptions(this);

const name = this.resourcePath;
const compiler = this._compiler as Compiler;
const callback = this.async();
const generator = reloadGenerator(name);
const content = await generator.call(this);
const content = await generator.call({
name,
options: {
outDir: compiler?.options?.output?.path,
rootDir: process.cwd(),
},
addDependency: (file: string, options: DependencyOptions = {}) => this.addDependency(file),
});

@@ -30,0 +43,0 @@ if (typeof content === 'string') {

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