%{?nodejs_find_provides_and_requires}
%global bootstrap 1
Name:                nodejs-source-map
Version:             0.5.6
Release:             2
Summary:             Node.js library that generates and consumes source maps
BuildArch:           noarch
ExclusiveArch:       %{nodejs_arches} noarch
License:             BSD-3-Clause
URL:                 https://github.com/mozilla/source-map
Source0:             https://github.com/mozilla/source-map/archive/%{version}/source-map-%{version}.tar.gz
BuildRequires:       nodejs-packaging
%if !0%{?bootstrap}
BuildRequires:       npm(webpack)
%endif
%description
A Node.js library that generates and consumes source maps,
A version suitable for use in the browser is available in the source-map
package.
%if !0%{?bootstrap}

%package -n source-map
Summary:             Client-side library that generates and consumes source maps
%description -n source-map
A client-side library that generates and source maps.  It is suitable for use
in browsers and is provided in original and minified form.
The Node.js library is available in the nodejs-source-map package.
%endif

%prep
%autosetup -n source-map-%{version}

%build
%if !0%{?bootstrap}
webpack --color
%endif

%install
mkdir -p %{buildroot}%{nodejs_sitelib}/source-map
cp -pr package.json source-map.js lib %{buildroot}%{nodejs_sitelib}/source-map
%if !0%{?bootstrap}
mkdir -p %{buildroot}%{_datadir}/%{name}
cp -p dist/*.js %{buildroot}%{_datadir}/%{name}/
%endif
%nodejs_symlink_deps

%check
%nodejs_symlink_deps --check
%__nodejs test/run-tests.js

%files
%doc README.md
%license LICENSE
%{nodejs_sitelib}/source-map
%if !0%{?bootstrap}

%files -n source-map
%{_datadir}/%{name}
%doc README.md
%license LICENSE
%endif

%changelog
* Mon May 9 2022 liyanan <liyanan32@h-partners.com> - 0.5.6-2
- License compliance rectification

* Wed Aug 12 2020 zhanghua <zhanghua40@huawei.com> - 0.5.6-1
- package init
