npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@glory-js/perfumer

v0.2.0

Published

```shell yarn add @glory-js/perfumer # or npm i @glory-js/perfumer ```

Downloads

11

Readme

perfumer

Usage

yarn add @glory-js/perfumer
# or 
npm i @glory-js/perfumer

if you need antd extension:

yarn add @glory-js/perfumer-antd
# or 
npm i @glory-js/perfumer-antd

How can we work with it

Perfumer is used to create some decorators, through which we can conveniently manage an entity class (or any other class you want).

For example, in the perfumer-antd package, we created the FormController and TableController to generate the configuration items for forms and tables.

Antd Extension

In the perfumer-antd package library, we have created two sets of decorators, each serving the needs of forms and tables respectively.

import { createPerfumer } from '@glory-js/perfumer';

import {
  storeKey,
  defaultViewKey,
  viewFunctionName,
  itemBuilder,
} from './formConfig';

export const {
  Controller: FormController,
  FieldItem: FormItem,
  createFieldDecorator: createFormItemDecorator,
} = createPerfumer({
  storeKey,
  defaultViewKey,
  viewFunctionName,
  itemBuilder,
});
import { createPerfumer } from '@glory-js/perfumer';

import {
  storeKey,
  defaultViewKey,
  viewFunctionName,
  itemBuilder,
} from './tableConfig';

export const {
  Controller: TableController,
  FieldItem: TableColumn,
  createFieldDecorator: createTableColumnDecorator,
} = createPerfumer({
  storeKey,
  defaultViewKey,
  viewFunctionName,
  itemBuilder,
});

Subsequently, we can use the FormController and TableController decorators provided by the perfumer-antd package. For example, let's say we have defined an entity class:

import {
  TableController,
  TableColumn,
  TableColumnTools,
  FormController,
  FormItem,
  FormItemTools,
  withTypes,
} from '@glory/perfumer-antd';
import Base from './-base';

const tablesViewer = {
  common: ['name'],
  'common.edit': ['name', 'age'],
};

const formsViewer = {
  common: ['name', 'age'],
  'common.edit': ['name', 'age'],
};

@TableController(tablesViewer)
@FormController(formsViewer)
class UserEntity extends Base {
  @TableColumn({
    hideInSearch: true,
  })
  @FormItem({
    placeholder: 'name',
  })
  @FormItemTools.Required('please input name')
  name = {
    title: 'name title',
  };

  @TableColumnTools.HideInSearch()
  @FormItem({})
  age = {
    title: 'age title',
  };
}

export default withTypes(UserEntity, [tablesViewer, formsViewer]);

We can use the TableController and FormController decorators to define the configuration for the User entity class. Additionally, we can leverage the TableColumn and @FormItem decorators to define any properties we want for the table and form.

After that, we can then construct the configurations for the table and form components:

  const columns = UserEntity.viewTable('common');
  console.log('columns===>', columns);

  const formItems = UserEntity.viewForm('common');
  console.log('formItems==>', formItems);

You can find the specific usage of these decorators and code examples in the examples/example-perfumer.

more

Multi-mapping

We can see that the code const columns = UserEntity.viewTable('common'); passes a common parameter as the key. This key corresponds to the key value in the @TableController parameter, which guides us on which fields to use. For example, common.edit will use the fields ['name', 'id', 'age'], while common will only use the field ['name'].

Inheritance:

We can also define a base class, for example:

@TableController()
@FormController()
export default class BaseEntity {
  @TableColumn({
    hideInTable: true,
    fieldProps: {
      placeholder: 'please input search value',
    },
  })
  searchValue = { title: 'search' };

  @TableColumn({
    hideInSearch: true,
    valueType: 'index',
    width: '60px',
  })
  index = { title: 'index' };
}

Extending from this base class, the derived classes will directly inherit its fields:

@TableController(tablesViewer)
@FormController(formsViewer)
class UserEntity extends Base {
  @TableColumn({
    hideInSearch: true,
  })
  @FormItem({
    placeholder: 'name',
  })
  @FormItemTools.Required('please input name')
  name = {
    title: 'name title',
  };

  @TableColumnTools.HideInSearch()
  @FormItem({})
  age = {
    title: 'age title',
  };
}

Custom Decorators

In many cases, we might want to define some commonly used properties, such as the demo example you mentioned. We can create custom decorators to achieve this:

@FormItemTools.Required('please input name')

createPerfumer provides the createFieldDecorator function, which allows you to implement custom decorators. For example, the implementation of the Required decorator could look like this:

import { createFormItemDecorator } from './form';

export const Required = createFormItemDecorator(
  'rules',
  'please input',
  (message) => [
    {
      required: true,
      message,
    },
  ]
);

Ant Design Extension

Currently, the perfumer library provides built-in support for Ant Design's pro-components. You can add the following dependency to your project:

yarn add @glory/perfumer-antd

In the future, the perfumer library may support integrations with more external UI libraries and frameworks beyond just Ant Design's pro-components