svelte-meta
Advanced tools
Comparing version 0.2.1 to 1.0.0
@@ -170,18 +170,20 @@ (function (global, factory) { | ||
} | ||
function mount_component(component, target, anchor) { | ||
function mount_component(component, target, anchor, customElement) { | ||
const { fragment, on_mount, on_destroy, after_update } = component.$$; | ||
fragment && fragment.m(target, anchor); | ||
// onMount happens before the initial afterUpdate | ||
add_render_callback(() => { | ||
const new_on_destroy = on_mount.map(run).filter(is_function); | ||
if (on_destroy) { | ||
on_destroy.push(...new_on_destroy); | ||
} | ||
else { | ||
// Edge case - component was destroyed immediately, | ||
// most likely as a result of a binding initialising | ||
run_all(new_on_destroy); | ||
} | ||
component.$$.on_mount = []; | ||
}); | ||
if (!customElement) { | ||
// onMount happens before the initial afterUpdate | ||
add_render_callback(() => { | ||
const new_on_destroy = on_mount.map(run).filter(is_function); | ||
if (on_destroy) { | ||
on_destroy.push(...new_on_destroy); | ||
} | ||
else { | ||
// Edge case - component was destroyed immediately, | ||
// most likely as a result of a binding initialising | ||
run_all(new_on_destroy); | ||
} | ||
component.$$.on_mount = []; | ||
}); | ||
} | ||
after_update.forEach(add_render_callback); | ||
@@ -211,3 +213,2 @@ } | ||
set_current_component(component); | ||
const prop_values = options.props || {}; | ||
const $$ = component.$$ = { | ||
@@ -224,5 +225,6 @@ fragment: null, | ||
on_destroy: [], | ||
on_disconnect: [], | ||
before_update: [], | ||
after_update: [], | ||
context: new Map(parent_component ? parent_component.$$.context : []), | ||
context: new Map(parent_component ? parent_component.$$.context : options.context || []), | ||
// everything else | ||
@@ -235,3 +237,3 @@ callbacks: blank_object(), | ||
$$.ctx = instance | ||
? instance(component, prop_values, (i, ret, ...rest) => { | ||
? instance(component, options.props || {}, (i, ret, ...rest) => { | ||
const value = rest.length ? rest[0] : ret; | ||
@@ -265,3 +267,3 @@ if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) { | ||
transition_in(component.$$.fragment); | ||
mount_component(component, options.target, options.anchor); | ||
mount_component(component, options.target, options.anchor, options.customElement); | ||
flush(); | ||
@@ -297,3 +299,3 @@ } | ||
/* src/Meta.svelte generated by Svelte v3.31.0 */ | ||
/* src/Meta.svelte generated by Svelte v3.38.2 */ | ||
@@ -312,3 +314,3 @@ function get_each_context(ctx, list, i) { | ||
// (79:2) {#if title} | ||
// (80:2) {#if title} | ||
function create_if_block_5(ctx) { | ||
@@ -347,3 +349,3 @@ let title_value; | ||
// (84:2) {#if description} | ||
// (85:2) {#if description} | ||
function create_if_block_4(ctx) { | ||
@@ -372,3 +374,3 @@ let meta; | ||
// (88:2) {#if url} | ||
// (89:2) {#if url} | ||
function create_if_block_3(ctx) { | ||
@@ -397,3 +399,3 @@ let link; | ||
// (92:2) {#if sitemapUrl} | ||
// (93:2) {#if sitemapUrl} | ||
function create_if_block_2(ctx) { | ||
@@ -423,3 +425,3 @@ let link; | ||
// (96:2) {#each Object.keys(twitter) as tag} | ||
// (97:2) {#each Object.keys(twitter) as tag} | ||
function create_each_block_1(ctx) { | ||
@@ -454,3 +456,3 @@ let meta; | ||
// (100:2) {#each Object.keys(openGraph) as tag} | ||
// (101:2) {#each Object.keys(openGraph) as tag} | ||
function create_each_block(ctx) { | ||
@@ -485,3 +487,3 @@ let meta; | ||
// (104:2) {#if url && logoUrl} | ||
// (105:2) {#if url && logoUrl} | ||
function create_if_block_1(ctx) { | ||
@@ -523,3 +525,3 @@ let html_tag; | ||
// (113:2) {#if url && searchUrl} | ||
// (114:2) {#if url && searchUrl} | ||
function create_if_block(ctx) { | ||
@@ -862,3 +864,3 @@ let html_tag; | ||
if ($$self.$$.dirty & /*image, openGraph, twitter, title*/ 1031) { | ||
{ | ||
{ | ||
if (!!image && typeof image === "string") { | ||
@@ -865,0 +867,0 @@ $$invalidate(1, openGraph = { image, ...openGraph }); |
{ | ||
"name": "svelte-meta", | ||
"description": "Easily generate SEO metadata for Svelte", | ||
"version": "0.2.1", | ||
"version": "1.0.0", | ||
"license": "MIT", | ||
@@ -9,3 +9,2 @@ "main": "./dist/index.js", | ||
"svelte": "./src/index.js", | ||
"types": "./types/index.d.ts", | ||
"scripts": { | ||
@@ -26,24 +25,22 @@ "develop": "rollup -cw", | ||
"dist", | ||
"types" | ||
"@types", | ||
"index.d.ts" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/seaneking/svelte-meta" | ||
"url": "https://github.com/peppercornstudio/svelte-meta" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/seaneking/svelte-meta/issues" | ||
"url": "https://github.com/peppercornstudio/svelte-meta/issues" | ||
}, | ||
"peerDependencies": { | ||
"svelte": "^3.31.0" | ||
"svelte": "^3.38.2" | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-node-resolve": "^10.0.0", | ||
"prettier": "^2.1.2", | ||
"rollup": "^2.33.0", | ||
"rollup-plugin-svelte": "^6.1.0", | ||
"svelte-preprocess": "^4.5.2", | ||
"svelte-types-writer": "^1.0.1", | ||
"tslib": "^2.0.3", | ||
"typescript": "^4.0.5" | ||
"@rollup/plugin-node-resolve": "^13.0.0", | ||
"prettier": "^2.3.0", | ||
"rollup": "^2.48.0", | ||
"rollup-plugin-svelte": "^7.1.0", | ||
"svelte": "^3.38.2" | ||
} | ||
} |
# Svelte Meta | ||
[![NPM](https://img.shields.io/npm/v/svelte-meta)](https://www.npmjs.com/package/svelte-meta) [![License](https://img.shields.io/npm/l/svelte-meta)](https://github.com/peppercorntsudio/svelte-meta/blob/master/LICENSE.md) | ||
Easily generate SEO metadata for Svelte. | ||
## Features | ||
### Features | ||
@@ -31,22 +33,2 @@ - Automatically set relevant social meta tags common attributes like `title` and `description` | ||
#### Svelte-preprocess | ||
`svelte-meta` is written in Typescript, and requires Svelte preprocessing to be enabled. If you're using [Sapper](https://sapper.svelte.dev/) this comes enabled by default. | ||
To enable preprocessing, install `svelte-preprocess` and include it in the svelte config in your `rollup.config.js` or `webpack.config.js` | ||
```sh | ||
npm i svelte-preprocess | ||
``` | ||
```js | ||
import autoPreprocess from 'svelte-preprocess'; | ||
svelte({ | ||
preprocess: autoPreprocess() | ||
}); | ||
``` | ||
See the [svelte-preprocess docs](https://github.com/sveltejs/svelte-preprocess) for more. | ||
### Properties | ||
@@ -71,2 +53,2 @@ | ||
- For an overview of `twitter` properties, visit [the Twitter Developer docs](https://developer.twitter.com/en/docs/twitter-for-websites/cards/overview/markup) | ||
- For an overview of `openGraph` properties, visit [the OpenGraph website](https://ogp.me/) | ||
- For an overview of `openGraph` properties, visit [the OpenGraph website](https://ogp.me/) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
61371
5
1
1754
53
1