Skip to content

Commit

Permalink
chore: use node.js 12 as minimum required version
Browse files Browse the repository at this point in the history
  • Loading branch information
orlov-vo committed Nov 1, 2021
1 parent 498e967 commit 1fb12ca
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 19 deletions.
16 changes: 7 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
const path = require('path');
const { Transformer } = require('@parcel/plugin');
const { default: SourceMap } = require('@parcel/source-map');
const { relativeUrl } = require('@parcel/utils');
const { compile, preprocess } = require('svelte/compiler.js');
const { load, preSerialize, postDeserialize } = require('./loadConfig');

Object.defineProperty(exports, '__esModule', { value: true });
import path from 'path';
import { Transformer } from '@parcel/plugin';
import SourceMap from '@parcel/source-map';
import { relativeUrl } from '@parcel/utils';
import { compile, preprocess } from 'svelte/compiler.js';
import { load, preSerialize, postDeserialize } from './loadConfig';

function generateName(input) {
let name = path
Expand Down Expand Up @@ -42,7 +40,7 @@ async function handleError(sourceFileName, func) {
}
}

exports.default = new Transformer({
export default new Transformer({
loadConfig({ config, options, logger }) {
return load({ config, options, logger });
},
Expand Down
16 changes: 7 additions & 9 deletions loadConfig.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
const path = require('path');

Object.defineProperty(exports, '__esModule', { value: true });
import path from 'path';

const CONFIG_FILES = ['.svelterc', 'svelte.config.js'];
const CONFIG_PACKAGE_KEY = 'svelte';
Expand All @@ -21,7 +19,7 @@ async function configHydrator(configFile, config, options) {
});
}

exports.load = async function load({ config, options, logger }) {
export async function load({ config, options, logger }) {
const configFile = await getConfigFile(config);
if (!configFile) return;

Expand Down Expand Up @@ -68,9 +66,9 @@ exports.load = async function load({ config, options, logger }) {
config,
options,
);
};
}

exports.preSerialize = function preSerialize(config) {
export function preSerialize(config) {
if (!config.result) return;

// Ensure we don't pass preprocess functions to the serializer
Expand All @@ -80,8 +78,8 @@ exports.preSerialize = function preSerialize(config) {

// This gets re-hydrated in Deserialize, so never store this
config.result.hydrated = {};
};
}

exports.postDeserialize = function postDeserialize(config, options) {
export function postDeserialize(config, options) {
return configHydrator(config.result.raw, config, options);
};
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "parcel-transformer-svelte",
"version": "1.1.2",
"description": "Parcel 2 transformer for Svelte 3",
"type": "module",
"main": "index.js",
"author": "Vladislav Orlov <[email protected]>",
"repository": "github:orlov-vo/parcel-transformer-svelte",
Expand All @@ -16,7 +17,7 @@
"/loadConfig.js"
],
"engines": {
"node": ">=8",
"node": ">=12",
"parcel": "^2.0.0"
},
"peerDependencies": {
Expand Down

0 comments on commit 1fb12ca

Please sign in to comment.